機能要望 > フロント機能 > 新入荷商品ブロックを追加し、商品説明も載せたい |
フロント機能
スレッド表示 | 新しいものから | 前のトピック | 次のトピック | 下へ |
投稿者 | スレッド |
---|---|
enzine |
投稿日時: 2010/8/20 18:59
対応状況: −−−
|
新米 ![]() ![]() 登録日: 2010/8/20 居住地: 投稿: 4 |
新入荷商品ブロックを追加し、商品説明も載せたい ▼EC-CUBEで、新着商品の紹介をトップページに表示する方法。
http://www.naga-blog.com/archives/2009/03/101727.php 上記の記事と、このコミュニティの過去ログを参考にして、新入荷商品ブロックを設置することに成功しました。 そこで、商品それぞれに商品説明も表示したいと思い、自分なりに.phpを編集してみましたが、エラーが出てしまいうまくいきませんでした。 どのようにすれば商品説明も表示できるでしょうか? また、このカスタマイズでは新入荷商品が2個ずつ繰り返しで表示されていますが、できれば4個ずつの繰り返しで表示させたいです。 これも.tplを編集してみましたがうまくいきませんでした。 ご教授のほど、何卒よろしくお願いいたします。 |
AMUAMU |
投稿日時: 2010/8/21 15:20
対応状況: −−−
|
神 ![]() ![]() 登録日: 2009/5/2 居住地: 東京都 投稿: 2712 |
Re: 新入荷商品ブロックを追加し、商品説明も載せたい どのように編集してみて、どのようにうまくいかなかったのか、修正した内容やエラーの内容を添えて質問されるとお答えしやすいです。
|
enzine |
投稿日時: 2010/8/21 16:49
対応状況: −−−
|
新米 ![]() ![]() 登録日: 2010/8/20 居住地: 投稿: 4 |
Re: 新入荷商品ブロックを追加し、商品説明も載せたい ご返信ありがとうございます。
新入荷商品を呼び出す.tplのsectionには<!--{$arrFlagProducts[cnt].comment|escape|nl2br}--> という、商品説明を呼び出す記述がありましたが、 商品説明は表示されませんでした。 これは$arrFlagProductsに商品説明の値が格納されてないからだと判断し、LC_Page_FrontParts_Bloc_Best5.phpをコピーして作ったLC_Page_FrontParts_Bloc_ProductFlag.phpの編集が必要だと考えました。 そこで、LC_Page_FrontParts_Bloc_ProductFlag.phpの $col = "DISTINCT price02_min, product_id, price02_max, main_image, product_flag, name"; の部分を $col = "DISTINCT A.*, price02_min, product_id, price02_max, main_image, product_flag, name"; や $col = "DISTINCT comment, price02_min, product_id, price02_max, main_image, product_flag, name"; のように変更しましたがエラーが表示されてうまくいきませんでした。 おすすめ商品表示ブロックのtplやphpファイルを参考に作業をしていますが、うまくいきません。 よろしくお願い致します。 ▼LC_Page_FrontParts_Bloc_ProductFlag.php <?php // {{{ requires require_once(CLASS_PATH . "pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php"); /** * productStatus のページクラス. * * @package Page */ class LC_Page_FrontParts_Bloc_ProductFlag extends LC_Page_FrontParts_Bloc { // }}} // {{{ functions /** * Page を初期化する. * * @return void */ function init() { parent::init(); $bloc_file = 'productFlag.tpl'; $this->setTplMainpage($bloc_file); } /** * Page のプロセス. * * @return void */ function process() { if (defined("MOBILE_SITE") && MOBILE_SITE) { $objView = new SC_MobileView(); } else { $objView = new SC_SiteView(); } $objSiteInfo = $objView->objSiteInfo; // 基本情報を渡す $objSiteInfo = new SC_SiteInfo(); $this->arrInfo = $objSiteInfo->data; $objQuery = new SC_Query(); //検索したい商品のステータスを設定 //NEW→1, 残りわずか→2, ポイント2倍→3, オススメ→4, 限定品→5 $productFlag = 1; //検索する商品のステータスをランダムに決定し、表示させたい場合は以下のコメントを外してください。 //$id_count = $objQuery->count(mtb_status); //$productFlag = rand(1,$id_count); $this->statusName =$objQuery->get( "mtb_status_image", "name", "id={$productFlag}"); //表示する商品の件数 $listCount = 4; $ret = ""; $arrTmp[$productFlag] = "1"; for($i = 1; $i <= $productFlag; $i++) { if($arrTmp[$i] == "1") { $ret.= "1"; } else { $ret.= "_"; } } if($ret != "") { $ret.= "%"; } //$col = "dtb_products.product_id, dtb_products.name, dtb_products.main_image, //MIN(dtb_products_class.price02) AS price02_min, MAX(dtb_products_class.price02) AS price02_max"; //$from = "dtb_products INNER JOIN dtb_products_class using(product_id)"; //$where = "product_flag LIKE \"{$ret}\""; //$groupby = "product_id"; //$this->groupby=$objQuery->setgroupby($groupby); //商品の表示はupdate_dateが新しい順 //$order = "dtb_products.update_date DESC"; //$this->order=$objQuery->setorder($order); $col = "DISTINCT price02_min, product_id, price02_max, main_image, product_flag, name"; $from = "vw_products_allclass AS T1"; $where = "product_flag LIKE '{$ret}'"; //商品の表示はproduct_id逆順 $order = "product_id DESC"; $this->order=$objQuery->setorder($order); $arrFlagList = $objQuery->select($col, $from, $where); //商品の表示をランダムに抽出する場合は以下のコメントを外してください。 //srand((double)microtime()*1000000);//乱数生成器を初期化 //shuffle($arrFlagList); $this->arrFlagProducts = array_slice($arrFlagList, 0, $listCount); $objSubView = new SC_SiteView(); $objSubView->assignobj($this); $objSubView->display($this->tpl_mainpage); } /** * デストラクタ. * * @return void */ function destroy() { parent::destroy(); } } ?> ▼productFlag.tpl <!--▼新着商品ここから--> <!--{if count($arrFlagProducts) > 0}--> <div id="weddingRank" class="section"> <h3 class="indent">ウエディングのお祝い用バルーンギフトランキング</h3> <!--{section name=cnt loop=$arrFlagProducts step=2}--> <div class="section"> <p><img src="images/index/rank01.png" alt="バルーンギフトランキング1位" width="155" height="18" /></p> <p class="item"><a href="<!--{$smarty.const.URL_DIR}-->products/detail.php?product_id=<!--{$arrFlagProducts[cnt].product_id}-->"> <!--{if $arrFlagProducts[cnt].main_list_image != ""}--> <!--{assign var=image_path value="`$arrFlagProducts[cnt].main_list_image`"}--> <!--{else}--> <!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--> <!--{/if}--> <img src="<!--{$smarty.const.SITE_URL}-->resize_image.php?image=<!--{$arrFlagProducts[cnt].main_image|sfRmDupSlash}-->&width=65&height=65" alt="<!--{$arrFlagProducts[cnt].name|escape}-->" /> </a></p> <!--{assign var=price01 value=`$arrFlagProducts[cnt].price01_min`}--> <!--{assign var=price02 value=`$arrFlagProducts[cnt].price02_min`}--> <p><a href="<!--{$smarty.const.URL_DIR}-->products/detail.php?product_id=<!--{$arrFlagProducts[cnt].product_id}-->"><!--{$arrFlagProducts[cnt].name|escape}--></a><br /> 価格<span class="font-size-2minus">(税込)</span>: <!--{if $price02 == ""}--> <!--{$price01|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}--> <!--{else}--> <!--{$price02|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}--> <!--{/if}-->円<br /> <span class="coment"><!--{$arrFlagProducts[cnt].comment|escape|nl2br}--></span></p> </div> <!--{assign var=cnt2 value=`$smarty.section.cnt.iteration*$smarty.section.cnt.step-1` }--> <!--{if $arrFlagProducts[$cnt2]|count > 0}--> <div class="section"> <p><img src="images/index/rank02.png" alt="バルーンギフトランキング2位" width="155" height="18" /></p> <p class="item"><a href="<!--{$smarty.const.URL_DIR}-->products/detail.php?product_id=<!--{$arrFlagProducts[$cnt2].product_id}-->"> <!--{if $arrFlagProducts[$cnt2].main_list_image != ""}--> <!--{assign var=image_path value="`$arrFlagProducts[$cnt2].main_list_image`"}--> <!--{else}--> <!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--> <!--{/if}--> <img src="<!--{$smarty.const.SITE_URL}-->resize_image.php?image=<!--{$arrFlagProducts[$cnt2].main_image|sfRmDupSlash}-->&width=65&height=65" alt="<!--{$arrFlagProducts[$cnt2].name|escape}-->" /> </a></p> <!--{assign var=price01 value=`$arrFlagProducts[$cnt2].price01_min`}--> <!--{assign var=price02 value=`$arrFlagProducts[$cnt2].price02_min`}--> <p><a href="<!--{$smarty.const.URL_DIR}-->products/detail.php?product_id=<!--{$arrFlagProducts[$cnt2].product_id}-->"><!--{$arrFlagProducts[$cnt2].name|escape}--></a><br />価格<span class="font-size-2minus">(税込)</span>:<em class="font-color-red"> <!--{if $price02 == ""}--> <!--{$price01|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}--> <!--{else}--> <!--{$price02|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}--> <!--{/if}-->円</em><br /> <span class="coment"><!--{$arrFlagProducts[$cnt2].comment|escape|nl2br}--></span></p> </div> <!--{/if}--> <!--{/section}--> </div> <!--{/if}--> <!--▲新着商品情報ここまで--> |
enzine |
投稿日時: 2010/8/21 20:19
対応状況: −−−
|
新米 ![]() ![]() 登録日: 2010/8/20 居住地: 投稿: 4 |
自分で順位を指定して商品ランキングを表示したい 4個表示にすることはできました。
新しいものから順に並ぶので ランキングには不向きかもしれません。 自分で順位を指定して表示できればいいのですが・・・ ▼productFlag.tpl <!--▼新着商品ここから--> <!--{if count($arrFlagProducts) > 0}--> <div id="weddingRank" class="section"> <h3 class="indent">ウエディングのお祝い用バルーンギフトランキング</h3> <!--{section name=cnt loop=$arrFlagProducts step=4}--> <div class="section"> <p><img src="images/index/rank01.png" alt="バルーンギフトランキング1位" width="155" height="18" /></p> <p class="item"><a href="<!--{$smarty.const.URL_DIR}-->products/detail.php?product_id=<!--{$arrFlagProducts[cnt].product_id}-->"> <!--{if $arrFlagProducts[cnt].main_list_image != ""}--> <!--{assign var=image_path value="`$arrFlagProducts[cnt].main_list_image`"}--> <!--{else}--> <!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--> <!--{/if}--> <img src="<!--{$smarty.const.SITE_URL}-->resize_image.php?image=<!--{$arrFlagProducts[cnt].main_image|sfRmDupSlash}-->&width=65&height=65" alt="<!--{$arrFlagProducts[cnt].name|escape}-->" /> </a></p> <!--{assign var=price01 value=`$arrFlagProducts[cnt].price01_min`}--> <!--{assign var=price02 value=`$arrFlagProducts[cnt].price02_min`}--> <p><a href="<!--{$smarty.const.URL_DIR}-->products/detail.php?product_id=<!--{$arrFlagProducts[cnt].product_id}-->"><!--{$arrFlagProducts[cnt].name|escape}--></a><br /> 価格<span class="font-size-2minus">(税込)</span>: <!--{if $price02 == ""}--> <!--{$price01|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}--> <!--{else}--> <!--{$price02|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}--> <!--{/if}-->円<br /> <span class="coment"><!--{$arrFlagProducts[cnt].comment|escape|nl2br}--></span></p> </div> <!--{assign var=cnt2 value=`$smarty.section.cnt.iteration*$smarty.section.cnt.step-3` }--> <!--{if $arrFlagProducts[$cnt2]|count > 0}--> <div class="section"> <p><img src="images/index/rank02.png" alt="バルーンギフトランキング2位" width="155" height="18" /></p> <p class="item"><a href="<!--{$smarty.const.URL_DIR}-->products/detail.php?product_id=<!--{$arrFlagProducts[$cnt2].product_id}-->"> <!--{if $arrFlagProducts[$cnt2].main_list_image != ""}--> <!--{assign var=image_path value="`$arrFlagProducts[$cnt2].main_list_image`"}--> <!--{else}--> <!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--> <!--{/if}--> <img src="<!--{$smarty.const.SITE_URL}-->resize_image.php?image=<!--{$arrFlagProducts[$cnt2].main_image|sfRmDupSlash}-->&width=65&height=65" alt="<!--{$arrFlagProducts[$cnt2].name|escape}-->" /> </a></p> <!--{assign var=price01 value=`$arrFlagProducts[$cnt2].price01_min`}--> <!--{assign var=price02 value=`$arrFlagProducts[$cnt2].price02_min`}--> <p><a href="<!--{$smarty.const.URL_DIR}-->products/detail.php?product_id=<!--{$arrFlagProducts[$cnt2].product_id}-->"><!--{$arrFlagProducts[$cnt2].name|escape}--></a><br />価格<span class="font-size-2minus">(税込)</span>:<em class="font-color-red"> <!--{if $price02 == ""}--> <!--{$price01|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}--> <!--{else}--> <!--{$price02|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}--> <!--{/if}-->円</em><br /> <span class="coment"><!--{$arrFlagProducts[$cnt2].comment|escape|nl2br}--></span></p> </div> <!--{/if}--> <!--{assign var=cnt3 value=`$smarty.section.cnt.iteration*$smarty.section.cnt.step-2` }--> <!--{if $arrFlagProducts[$cnt3]|count > 0}--> <div class="section"> <p><img src="images/index/rank03.png" alt="バルーンギフトランキング3位" width="155" height="18" /></p> <p class="item"><a href="<!--{$smarty.const.URL_DIR}-->products/detail.php?product_id=<!--{$arrFlagProducts[$cnt3].product_id}-->"> <!--{if $arrFlagProducts[$cnt3].main_list_image != ""}--> <!--{assign var=image_path value="`$arrFlagProducts[$cnt3].main_list_image`"}--> <!--{else}--> <!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--> <!--{/if}--> <img src="<!--{$smarty.const.SITE_URL}-->resize_image.php?image=<!--{$arrFlagProducts[$cnt3].main_image|sfRmDupSlash}-->&width=65&height=65" alt="<!--{$arrFlagProducts[$cnt3].name|escape}-->" /> </a></p> <!--{assign var=price01 value=`$arrFlagProducts[$cnt3].price01_min`}--> <!--{assign var=price02 value=`$arrFlagProducts[$cnt3].price02_min`}--> <p><a href="<!--{$smarty.const.URL_DIR}-->products/detail.php?product_id=<!--{$arrFlagProducts[$cnt3].product_id}-->"><!--{$arrFlagProducts[$cnt3].name|escape}--></a><br />価格<span class="font-size-2minus">(税込)</span>:<em class="font-color-red"> <!--{if $price02 == ""}--> <!--{$price01|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}--> <!--{else}--> <!--{$price02|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}--> <!--{/if}-->円</em><br /> <span class="coment"><!--{$arrFlagProducts[$cnt3].comment|escape|nl2br}--></span></p> </div> <!--{/if}--> <!--{assign var=cnt4 value=`$smarty.section.cnt.iteration*$smarty.section.cnt.step-1` }--> <!--{if $arrFlagProducts[$cnt4]|count > 0}--> <div class="section lastchild"> <p><img src="images/index/rank04.png" alt="バルーンギフトランキング4位" width="155" height="18" /></p> <p class="item"><a href="<!--{$smarty.const.URL_DIR}-->products/detail.php?product_id=<!--{$arrFlagProducts[$cnt4].product_id}-->"> <!--{if $arrFlagProducts[$cnt4].main_list_image != ""}--> <!--{assign var=image_path value="`$arrFlagProducts[$cnt4].main_list_image`"}--> <!--{else}--> <!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--> <!--{/if}--> <img src="<!--{$smarty.const.SITE_URL}-->resize_image.php?image=<!--{$arrFlagProducts[$cnt4].main_image|sfRmDupSlash}-->&width=65&height=65" alt="<!--{$arrFlagProducts[$cnt4].name|escape}-->" /> </a></p> <!--{assign var=price01 value=`$arrFlagProducts[$cnt4].price01_min`}--> <!--{assign var=price02 value=`$arrFlagProducts[$cnt4].price02_min`}--> <p><a href="<!--{$smarty.const.URL_DIR}-->products/detail.php?product_id=<!--{$arrFlagProducts[$cnt4].product_id}-->"><!--{$arrFlagProducts[$cnt4].name|escape}--></a><br />価格<span class="font-size-2minus">(税込)</span>:<em class="font-color-red"> <!--{if $price02 == ""}--> <!--{$price01|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}--> <!--{else}--> <!--{$price02|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}--> <!--{/if}-->円</em><br /> <span class="coment"><!--{$arrFlagProducts[$cnt4].comment|escape|nl2br}--></span></p> </div> <!--{/if}--> <!--{/section}--> </div> <!--{/if}--> <!--▲新着商品情報ここまで--> |
55eccube |
投稿日時: 2010/8/22 10:35
対応状況: −−−
|
長老 ![]() ![]() 登録日: 2010/8/18 居住地: 東京 投稿: 222 |
Re: 自分で順位を指定して商品ランキングを表示したい 順位を指定するために、商品テーブルに順位を持たせているのでしょうか。
それとも、別テーブルで順位を指定していますか。 もしくは、productFlag.tpl内で商品の順位を直接指定したいのでしょうか。 |
enzine |
投稿日時: 2010/8/23 16:49
対応状況: −−−
|
新米 ![]() ![]() 登録日: 2010/8/20 居住地: 投稿: 4 |
Re: 自分で順位を指定して商品ランキングを表示したい ご返信ありがとうございます。
書き込み内容が情報不足で申し訳ありません。 私はプログラムに関して初心者なので、自分で商品ランキングの順位を指定するカスタマイズには着手しておりません。 もし簡単に実現できる方法があれば、どのような方法があるのかご教授頂きたく書き込みさせて頂きました。 私としましては、新着情報に商品説明を表示することが急務なのですが、合わせて上記の順位指定の方法もご教授頂ければ幸いです。 何卒よろしくお願いいたします。 |
AMUAMU |
投稿日時: 2010/8/23 18:47
対応状況: −−−
|
神 ![]() ![]() 登録日: 2009/5/2 居住地: 東京都 投稿: 2712 |
Re: 自分で順位を指定して商品ランキングを表示したい ランキングの順位を指定する形のカスタマイズであれば、オススメ商品ブロックの複製が良いのでは無いでしょうか?
オススメ商品ブロックの複製は、過去ログか外部サイトの情報があったと思います。 新着に商品説明を表示したい件はDBが何か分からないので、何とも言えない部分もありますが、基本的にはビューの vw_products_allclass にあるカラムを指定すればいいと思います。
|
ゲスト |
投稿日時: 2010/8/23 19:39
対応状況: −−−
|
Re: 自分で順位を指定して商品ランキングを表示したい
|
|
Masashige |
投稿日時: 2010/8/25 13:11
対応状況: −−−
|
長老 ![]() ![]() 登録日: 2009/4/1 居住地: 投稿: 200 |
Re: 自分で順位を指定して商品ランキングを表示したい ランキングの更新が頻繁でなければ、普通に
htmlでブロックを作ってもいいんじゃないかと 思います。 順位の指定をシステムでどうするか考えるより 早いかと。下手に作ると順位の入れ替え作業が 大変そうですし。 |
スレッド表示 | 新しいものから | 前のトピック | 次のトピック | トップ |