EC-CUBE2.12:商品一覧,商品詳細にパンくずリストを表示

(1)商品一覧
■Smarty/templates/default/products/list.tpl
の上に追記

<!--★パンくずリスト★-->
<div id="pankuzu"><!--{$TopicPath}--></div>

■class/pages/products/LC_Page_Products_List.php
function action()内の末尾に追記

// 商品一覧パンくずリストを取得
$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 = '<a href="../index.php">' . TopPage . '</a> > ';
foreach($arrCatId as $key => $val){
$arrCatName = $objDb->sfGetCat($val);
if($val != $this->arrForm['category_id']){
$TopicPath .= '<a href="./list.php?category_id=' .$val. '">'. $arrCatName['name'] . '</a> > ';
} else {
$TopicPath .= $arrCatName['name'];
}
}
} else {
$TopicPath = '<a href="../index.php">' . TopPage . '</a> > ' . $this->arrForm['name'] . " の検索結果";
}
$this->TopicPath = $TopicPath;
// パンくずリスト取得終わり

(2)商品詳細
■Smarty/templates/default/products/detail.tpl

の下に追記

<!--★パンくずリスト★-->
<div id="pankuzu"><!--{$TopicPath}--></div>

■class/pages/products/LC_Page_Products_Detail.php
function action()内の末尾に追記

// 商品詳細パンくずリストを取得
$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 = '<a href="../index.php">' . TopPage . '</a> > ';
foreach($arrCatId as $key => $val){
$arrCatName = $objDb->sfGetCat($val);
$TopicPath .= '<a href="./list.php?category_id=' .$val. '">'. $arrCatName['name'] . '</a>';
if($val != $arrCategory_id[0]){
$TopicPath .= ' > ';
}
}
$this->TopicPath = $TopicPath;
// パンくずリスト取得終わり