質問 > フロント機能 > 「その他のオススメ商品」を管理画面から登録なしで自動表示 |
フロント機能
フラット表示 | 前のトピック | 次のトピック |
投稿者 | スレッド |
---|---|
ma2ma2 |
投稿日時: 2013/7/26 13:18
対応状況: −−−
|
新米 登録日: 2013/7/26 居住地: 投稿: 3 |
「その他のオススメ商品」を管理画面から登録なしで自動表示 商品詳細ページの「その他のオススメ商品」を管理画面から登録なしで同カテゴリの商品をランダムで自動表示したいと考えております。
下記のサイト ・http://blog.tubo.jp.net/ec-cube%E3%81%AE%E3%80%8C%E3%81%9D%E3%81%AE%E4%BB%96%E3%81%AE%E3%82%AA%E3%82%B9%E3%82%B9%E3%83%A1%E5%95%86%E5%93%81%E3%80%8D%E3%82%92%E7%99%BB%E9%8C%B2%E7%84%A1%E3%81%97%E3%81%A7%E3%83%A9%E3%83%B3/ ・http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=12320&forum=10&post_id=56794 ・ http://ec-cube.nakweb.com/blog/1869.html を参考に作ってみたのですが、どうしてもうまくいきません。 状況としては何も起こりませんでした。 エラーも出ないし、カスタマイズ前と同じように登録した関連商品が表示されます。 どなたか作成方法を教えていただけないでしょうか。 自分は、HTML・CSSの知識はありますがPHP、EC-CUBEは素人です。 何卒、よろしくお願いいたします。 以下作成した部分です。 LC_Page_Products_Detai.phpファイル --------------------------------------------------------------------------------------------------------------------------- /* 登録済み関連商品の読み込み */ function lfPreGetRecommendProducts($category_id) { $objProduct = new SC_Product_Ex(); $objQuery =& SC_Query_Ex::getSingletonInstance(); $objQuery->setOrder('RAND()'); $objQuery->setLimitOffset(8); $arrRecommendData = $objQuery->select('recommend_product_id, comment', 'dtb_recommend_products as t1 left join dtb_products as t2 on t1.recommend_product_id = t2.product_id', 't1.product_id = ? and t2.del_flg = 0 and t2.status = 1', array($category_id)); $arrRecommendProductId = array(); foreach ($arrRecommendData as $recommend) { $arrRecommendProductId[] = $recommend['recommend_product_id']; $this->arrRecommendCat[$recommend['recommend_product_id']] = SC_Helper_DB_Ex::sfGetMultiCatTree($recommend['recommend_product_id']); } $objQuery =& SC_Query_Ex::getSingletonInstance(); $arrProducts = $objProduct->getListByProductIds($objQuery, $arrRecommendProductId); $arrRecommend = array(); foreach ($arrRecommendData as $key => &$arrRow) { $arrRecommendData[$key] = array_merge($arrRow, $arrProducts[$arrRow['recommend_product_id']]); } return $arrRecommendData; } --------------------------------------------------------------------------------------------------------------------------- .tplファイル(今回は画像のみ表示出来ればいいので不要な部分は削除しています。) --------------------------------------------------------------------------------------------------------------------------- <!--▼関連商品--> <!--{if $arrRecommend}--> <div id="kanrenWrap"> <div id="kanren_area"> <a id="next2" class="next" href="#"><img src="<!--{$TPL_URLPATH}-->img/mk/carouselup_u.gif" alt=""></a> <ul> <!--{foreach from=$arrRecommend item=arrItem name="arrRecommend"}--> <li> <a href="<!--{$smarty.const.P_DETAIL_URLPATH}--><!--{$arrItem.product_id|u}-->"> <img src="<!--{$smarty.const.ROOT_URLPATH}-->resize_image.php?image=<!--{$arrItem.main_list_image|sfNoImageMainList|h}-->&width=148" alt="<!--{$arrItem.name|h}-->" /></a> </li><!--{* /.item *}--> <!--{if $smarty.foreach.arrRecommend.iteration % 2 === 0}--> <div class="clear"></div> <!--{/if}--> <!--{/foreach}--> </ul> <a id="prev2" class="prev" href="#"><img src="<!--{$TPL_URLPATH}-->img/mk/carouseldown_u.gif" alt=""></a> </div> </div> <!--{/if}--> <!--▲関連商品--> --------------------------------------------------------------------------------------------------------------------------- EC-CUBEバージョン 2.12.4 PHPバージョン PHP 5.3.3 DBバージョン MySQL 5.0.95 |
フラット表示 | 前のトピック | 次のトピック |
題名 | 投稿者 | 日時 |
---|---|---|
» 「その他のオススメ商品」を管理画面から登録なしで自動表示 | ma2ma2 | 2013/7/26 13:18 |
Re: 「その他のオススメ商品」を管理画面から登録なしで自動表示 | fukaq | 2013/7/26 13:51 |
Re: 「その他のオススメ商品」を管理画面から登録なしで自動表示 | ma2ma2 | 2013/7/26 14:22 |
Re: 「その他のオススメ商品」を管理画面から登録なしで自動表示 | casa | 2013/7/26 14:56 |
Re: 「その他のオススメ商品」を管理画面から登録なしで自動表示 | ma2ma2 | 2013/7/29 12:04 |