機能要望 > フロント機能 > 新入荷商品ブロックを追加し、商品説明も載せたい |
フロント機能
フラット表示 | 前のトピック | 次のトピック |
投稿者 | スレッド |
---|---|
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/20 18:59 |
![]() |
AMUAMU | 2010/8/21 15:20 |
» ![]() |
enzine | 2010/8/21 16:49 |
![]() |
enzine | 2010/8/21 20:19 |
![]() |
55eccube | 2010/8/22 10:35 |
![]() |
enzine | 2010/8/23 16:49 |
![]() |
AMUAMU | 2010/8/23 18:47 |
![]() |
ゲスト | 2010/8/23 19:39 |
![]() |
Masashige | 2010/8/25 13:11 |
