|
|
|
|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
│<< 前へ │次へ >> │一覧 │コメントを書く |
EC-CUBEで商品一覧ページにサブカテゴリーを表示します。
(1)/httpdocs/data/class/helper/SC_Helper_DB.php class SC_Helper_DB内に、子カテゴリー取得関数を作成する。 //子カテゴリーを取得する function sfGetChildCat($category_id) { $objQuery = new SC_Query(); $col = "category_id, category_name"; $from = "dtb_category"; $where = "parent_category_id = ".$category_id; $objQuery->setoption("ORDER BY rank DESC"); $arrRet = $objQuery->select($col, $from, $where); return $arrRet; } (2)/httpdocs/data/class/pages/products/LC_Page_Products_List.php function lfDispProductsList内で子カテゴリーを取得して表示できるようにする。 //検索ではないときに子カテゴリーを取得 if($_GET['mode'] != 'search'){ $arrChildCat_t = $objDb->sfGetChildCat_t($category_id); $this->arrChildCat = $arrChildCat_t; } (3)管理画面の「デザイン管理」-「ページ詳細設定」-「商品一覧ページ」で表示のソースを入れる <!--サブカテゴリここから--> <!--{section name=cnt loop=$arrChildCat}--> <a href="<!--{$smarty.const.URL_DIR}-->category/<!--{$arrChildCat[cnt].category_id}-->"><!--{$arrChildCat[cnt].category_name}--></a> <!--{/section}--> <!--サブカテゴリここまで--> 以上です。 [EC-CUBE]カテゴリの最新記事
│<< 前へ │次へ >> │一覧 │コメントを書く │ 一番上に戻る │ |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||