ITOBEN STYLE > EC-CUBE2.12:商品一覧,商品詳細にパンくずリストを表示 2012年10月5日カテゴリー:未分類 EC-CUBE2.12:商品一覧,商品詳細にパンくずリストを表示 (1)商品一覧 ■Smarty/templates/default/products/list.tpl の上に追記 [php] [/php] ■class/pages/products/LC_Page_Products_List.php function action()内の末尾に追記 [php] // 商品一覧パンくずリストを取得 $objDb = new SC_Helper_DB_Ex(); if($this->arrForm[‘category_id’]){ $arrCatId = $objDb->sfGetParents(“dtb_category”, “parent_category_id”, “category_id”, $this->arrForm[‘category_id’]); $TopicPath = ‘‘ . TopPage . ‘ > ‘; foreach($arrCatId as $key => $val){ $arrCatName = $objDb->sfGetCat($val); if($val != $this->arrForm[‘category_id’]){ $TopicPath .= ‘‘. $arrCatName[‘name’] . ‘ > ‘; } else { $TopicPath .= $arrCatName[‘name’]; } } } else { $TopicPath = ‘‘ . TopPage . ‘ > ‘ . $this->arrForm[‘name’] . ” の検索結果”; } $this->TopicPath = $TopicPath; // パンくずリスト取得終わり [/php] (2)商品詳細 ■Smarty/templates/default/products/detail.tpl の下に追記 [php] [/php] ■class/pages/products/LC_Page_Products_Detail.php function action()内の末尾に追記 [php] // 商品詳細パンくずリストを取得 $objDb = new SC_Helper_DB_Ex(); $arrCategory_id = $objDb->sfGetCategoryId($product_id); $arrCatId = $objDb->sfGetParents(“dtb_category”, “parent_category_id”, “category_id”, $arrCategory_id[0]); $TopicPath = ‘‘ . TopPage . ‘ > ‘; foreach($arrCatId as $key => $val){ $arrCatName = $objDb->sfGetCat($val); $TopicPath .= ‘‘. $arrCatName[‘name’] . ‘‘; if($val != $arrCategory_id[0]){ $TopicPath .= ‘ > ‘; } } $this->TopicPath = $TopicPath; // パンくずリスト取得終わり [/php]
(1)商品一覧
■Smarty/templates/default/products/list.tpl
の上に追記
[php]
[/php]
■class/pages/products/LC_Page_Products_List.php
function action()内の末尾に追記
[php]
// 商品一覧パンくずリストを取得
$objDb = new SC_Helper_DB_Ex();
if($this->arrForm[‘category_id’]){
$arrCatId = $objDb->sfGetParents(“dtb_category”, “parent_category_id”, “category_id”, $this->arrForm[‘category_id’]);
$TopicPath = ‘‘ . TopPage . ‘ > ‘;
foreach($arrCatId as $key => $val){
$arrCatName = $objDb->sfGetCat($val);
if($val != $this->arrForm[‘category_id’]){
$TopicPath .= ‘‘. $arrCatName[‘name’] . ‘ > ‘;
} else {
$TopicPath .= $arrCatName[‘name’];
}
}
} else {
$TopicPath = ‘‘ . TopPage . ‘ > ‘ . $this->arrForm[‘name’] . ” の検索結果”;
}
$this->TopicPath = $TopicPath;
// パンくずリスト取得終わり
[/php]
(2)商品詳細
■Smarty/templates/default/products/detail.tpl
[php]
[/php]
■class/pages/products/LC_Page_Products_Detail.php
function action()内の末尾に追記
[php]
// 商品詳細パンくずリストを取得
$objDb = new SC_Helper_DB_Ex();
$arrCategory_id = $objDb->sfGetCategoryId($product_id);
$arrCatId = $objDb->sfGetParents(“dtb_category”, “parent_category_id”, “category_id”, $arrCategory_id[0]);
$TopicPath = ‘‘ . TopPage . ‘ > ‘;
foreach($arrCatId as $key => $val){
$arrCatName = $objDb->sfGetCat($val);
$TopicPath .= ‘‘. $arrCatName[‘name’] . ‘‘;
if($val != $arrCategory_id[0]){
$TopicPath .= ‘ > ‘;
}
}
$this->TopicPath = $TopicPath;
// パンくずリスト取得終わり
[/php]