質問 > フロント機能 > おすすめ商品の表示を変えたい |
フロント機能
フラット表示 | 前のトピック | 次のトピック |
投稿者 | スレッド |
---|---|
tonton |
投稿日時: 2009/3/12 15:43
対応状況: −−−
|
仙人 登録日: 2008/8/14 居住地: 投稿: 437 |
Re: おすすめ商品の表示を変えたい >/data/smarty/templates/default/bloc/best5.tplのソースを下記に変更で1行、5つ表示になるのではないかと思います。
>よかったら試してみてください。 ------ 追記: すみません; 5個で改行させる処理が抜けてましたので追記します。 <!--▼おすすめ情報ここから--> <!--{if count($arrBestProducts) > 0}--> <div id="recomendarea"> <h2> <img src="<!--{$TPL_DIR}-->img/top/osusume.jpg" width="400" height="29" alt="おすすめ情報" /> </h2> <!--{section name=cnt loop=$arrBestProducts step=1 max=5}--> <div class="recomendblock"> <div class="recomendleft"> <!--{if $arrBestProducts[cnt].main_list_image != ""}--> <!--{assign var=image_path value="`$arrBestProducts[cnt].main_list_image`"}--> <!--{else}--> <!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--> <!--{/if}--> <a href="<!--{$smarty.const.URL_DIR}-->products/detail.php?product_id=<!--{$arrBestProducts[cnt].product_id}-->"> <img src="<!--{$smarty.const.SITE_URL}-->resize_image.php?image=<!--{$image_path|sfRmDupSlash}-->&width=48&height=48" alt="<!--{$arrBestProducts[cnt].name|escape}-->" /> </a> <h3> <a href="<!--{$smarty.const.URL_DIR}-->products/detail.php?product_id=<!--{$arrBestProducts[cnt].product_id}-->"><!--{$arrBestProducts[cnt].name|escape}--></a> </h3> <!--{assign var=price01 value=`$arrBestProducts[cnt].price01_min`}--> <!--{assign var=price02 value=`$arrBestProducts[cnt].price02_min`}--> <p>価格<span class="mini">(税込)</span>:<span class="price"> <!--{if $price02 == ""}--> <!--{$price01|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}--> <!--{else}--> <!--{$price02|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}--> <!--{/if}-->円 </span> </p> <p class="mini"><!--{$arrBestProducts[cnt].comment|escape|nl2br}--></p> </div> </div> <!--{if $smarty.section.cnt.iteration % 5 == 0 and $smarty.section.cnt.last == false}--><br class="clear"><!--{else}--><!--{/if}--> <!--{/section}--> </div> <!--{/if}--> <!--▲おすすめ情報ここまで--> ----------- このソースを忘れていました。↓ <!--{if $smarty.section.cnt.iteration % 5 == 0 and $smarty.section.cnt.last == false}--><!--ここに改行したい場所で表示させるhtml--><br class="clear"><!--{else}--><!--ここに改行させない間の商品表示用のソース--><!--{/if}--> 説明も付記しておきますね。 元のオススメソースから商品データを2個飛ばしとか3個飛ばしで表示させるstep=2などの処理を一旦削除し、max=で指定した数まで1行に商品をずらっと表示させます。 その後、上記ソースで、全体の商品数を%5と指定した数(=つまり改行したい数)で割って、割り切れるところまたは最後に改行するHTMLソースを入れるようにしています。 %5を%7にすれば7つで1行です。 <!--{if $smarty.section.cnt.iterationから<!--{/if}-->までを<!--{/section}-->の手前に置いて、改行位置に<br />などのタグを入れるということができます。<!--{section}-->内で使用します。 私の場合は、表示させたい1行の数が多くなると、step数を矛盾なく変えるつじつま合わせに毎回苦労したのと、ここのリストアップのソースを変えて<li>タグなどで1商品リストにすることもあるので、このようにしました。 左列と右列で背景色を交互にしたいといった場合は、step、同じ表示を繰り返して、折り返しのところだけhtmlタグを入れたい(または変えたい)ときは、iterationを使うといいかもしれません。 step数を変える場合とiterationを使った場合と、そのときによって使いたい方法が違うかもしれませんが、一案ということで。(^^) 思ったとおり実現できて良かったですね!! |
フラット表示 | 前のトピック | 次のトピック |
題名 | 投稿者 | 日時 |
---|---|---|
おすすめ商品の表示を変えたい | ecbg | 2009/3/11 17:01 |
Re: おすすめ商品の表示を変えたい | seasoft | 2009/3/11 17:19 |
Re: おすすめ商品の表示を変えたい | ecbg | 2009/3/11 19:34 |
Re: おすすめ商品の表示を変えたい | takoyaki | 2009/3/11 22:31 |
Re: おすすめ商品の表示を変えたい | tonton | 2009/3/11 23:33 |
Re: おすすめ商品の表示を変えたい | ecbg | 2009/3/12 14:26 |
» Re: おすすめ商品の表示を変えたい | tonton | 2009/3/12 15:43 |
Re: おすすめ商品の表示を変えたい | ecbg | 2009/3/12 17:45 |
Re: おすすめ商品の表示を変えたい | ecnobu | 2009/7/22 21:06 |
Re: おすすめ商品の表示を変えたい | ecbg | 2009/7/22 21:26 |
Re: おすすめ商品の表示を変えたい | ecnobu | 2009/7/22 22:10 |