2012年10月2日

EC-CUBE タイトル名にカテゴリ名を表示

タイトル<title>に、2階層以下のカテゴリ名を表示したい
/data/Smarty/templates/default/site_frame.tpl
<title>に<!–{$tpl_subtitle}–>を追加。

商品一覧ページのタイトルに表示
 data/class/pages/products/LC_Page_Products_List.phpの
[修正ファイル EC-CUBE2系]
 data/class/pages/products/LC_Page_Products_List.php

[修正前]
 $arrFirstCat = $objDb->sfGetFirstCat($arrCategory_id[0]);
 $tpl_subtitle = $arrFirstCat['name'];

[修正後]
 →$tpl_subtitle = $objDb->sfGetCatCombName($arrCategory_id[0]);
 とすることで、親カテゴリー+子カテゴリーも表示する事が可能。


商品詳細ページのタイトルに表示
[修正ファイル EC-CUBE2系]
 data/class/pages/products/LC_Page_Products_Detail.php

[修正前]
 // サブタイトルを取得
 $arrCategory_id = $objDb->sfGetCategoryId($arrRet[0]['product_id'], $status);
 $arrFirstCat = $objDb->sfGetFirstCat($arrCategory_id[0]);
 $this->tpl_subtitle = $arrFirstCat['name'];

[修正後]
 // サブタイトルを取得
 $arrCategory_id = $objDb->sfGetCategoryId($arrRet[0]['product_id'], $status);
 $arrFirstCat = $objDb->sfGetFirstCat($arrCategory_id[0]);
 $this->tpl_subtitle = $objDb->sfGetCatCombName($arrCategory_id[0]);
 とすることで、親カテゴリー+子カテゴリーも表示する事が可能。

ドメインって、早い者勝ちですよ!