▼ここでのカスタマイズファイルをすべてダウンロードできます。
必要な箇所だけコピーしてご利用ください。
他のカスタマイズも含まれている場合がありますので、ファイルの上書きは絶対におやめください。
こちらから(facebookユーザーのみ)
(1)おすすめ商品一覧用のページを作成する。
① 下記のファイル(フォルダ)を新規作成
■html/recommend_mbl/index.php
<?php // {{{ requires require_once '../require.php'; require_once CLASS_EX_REALDIR . 'page_extends/recommend_mbl/LC_Page_Recommend_mbl_Ex.php'; // }}} // {{{ generate page $objPage = new LC_Page_Recommend_mbl_Ex(); register_shutdown_function(array($objPage, "destroy")); $objPage->init(); $objPage->process(); ?>
■data/class_extends/page_extends/recommend_mbl/LC_Page_Recommend_mbl_Ex.php
<?php // {{{ requires require_once CLASS_REALDIR . 'pages/recommend_mbl/LC_Page_Recommend_mbl.php'; class LC_Page_Recommend_mbl_Ex extends LC_Page_Recommend_mbl { // }}} // {{{ functions /** * Page を初期化する. * * @return void */ function init() { parent::init(); } /** * Page のプロセス. * * @return void */ function process() { parent::process(); } /** * デストラクタ. * * @return void */ function destroy() { parent::destroy(); } } ?>
■data/class/pages/recommend_mbl/LC_Page_Recommend_mbl.php
<?php // {{{ requires require_once CLASS_EX_REALDIR . 'page_extends/LC_Page_Ex.php'; class LC_Page_Recommend_mbl extends LC_Page_Ex { // }}} // {{{ functions /** * Page を初期化する. * * @return void */ function init() { parent::init(); } /** * Page のプロセス. * * @return void */ function process() { parent::process(); $this->action(); $this->sendResponse(); } /** * Page のアクション. * * @return void */ function action() { // 基本情報を渡す $objSiteInfo = SC_Helper_DB_Ex::sfGetBasisData(); $this->arrInfo = $objSiteInfo->data; //データ取得 $objQuery =SC_Query_Ex::getSingletonInstance(); $this->arrRet = array(); //おすすめ商品を取得 $arrRet = $objQuery->select("*", "dtb_products inner join dtb_best_products on dtb_products.product_id=dtb_best_products.product_id", "dtb_products.del_flg = 0"); //データベースからデータの取得ができたか if(isset($arrRet)){ $this->arrRet = $arrRet; } } /** * デストラクタ. * * @return void */ function destroy() { parent::destroy(); } } ?>
■data/Smarty/templates/mobile/recommend_mbl/index.tpl
<!--{if count($arrRet) > 0}--> <!-- ▼おすすめ商品一覧ページ --> <br> <!--{section name=cnt loop=$arrRet}--> <center><a href="<!--{$smarty.const.P_DETAIL_URLPATH}--><!--{$arrRet[cnt].product_id|u}-->.html"><img src="<!--{$smarty.const.IMAGE_SAVE_URLPATH}--><!--{$arrRet[cnt].main_list_image|h}-->"></a></center><br> <center><a href="<!--{$smarty.const.P_DETAIL_URLPATH}--><!--{$arrRet[cnt].product_id|u}-->.html"><!--{$arrRet[cnt].name|h}--></a></center><br> <!--{$arrRet[cnt].main_list_comment|h|nl2br}--><br><br> <center><img src="<!--{$TPL_URLPATH}-->img/line.jpg" alt=""></center><br> <!--{/section}--> <!-- ▲おすすめ商品一覧ページ --> <!--{/if}-->
② データベースにおすすめ商品一覧ページを登録
dtb_pagelayoutテーブルに追加
INSERT INTO dtb_pagelayout (device_type_id, page_id, page_name, url, filename, header_chk, footer_chk, edit_flg, author, description, keyword, update_url, create_date, update_date) VALUES (1, 38, 'おすすめ商品一覧ページ', 'recommend_mbl/index.php', 'recommend_mbl/index', 1, 1, 2, NULL, NULL, NULL, NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
(2)管理画面「デザイン管理>モバイル>レイアウト設定」の「おすすめ商品一覧ページ」に「サイトロゴ」ブロック、「カテゴリ」ブロック等を配置。
(3)「おすすめ商品一覧ページ」へのリンクを「おすすめ商品」ブロックに追加する。
ここでは、このサイトのカスタマイズで作成した「おすすめ商品ランダム」ブロックに追加する。
■data/Smarty/templates/mobile/frontparts/bloc/recommend_random.tplに。
<center><a href="<!--{$smarty.const.MOBILE_TOP_URLPATH}-->recommend_mbl/index.php">★おすすめ一覧へ</a></center><br>