アットウィキロゴ

パンくずリスト

EC-CUBE

/data/class_extends/helper_extends/SC_Helper_DB_Ex.php
37行目に以下を追加

   function sfGetTopicPath($category_id){
       // 商品が属するカテゴリIDを縦に取得
       $objQuery = new SC_Query();
       $arrCatID = $this->sfGetParents($objQuery, "dtb_category", "parent_category_id", "category_id", $category_id);
       $TopicPath = " > ";

       // カテゴリー名称を取得する
       foreach($arrCatID as $key => $val){
           $sql = "SELECT category_name FROM dtb_category WHERE category_id = ?";
           $arrVal = array($val);
           $CatName = $objQuery->getOne($sql,$arrVal);
           if( $val != $category_id){
             $TopicPath .= '<a href="./list.php?category_id=' .$val . '">' . $CatName . '</a> > ';
           }else{
             $TopicPath .= $CatName;
           }
       }

       return $TopicPath;
   }
   function sfGetTopicPath2($category_id){
       // 商品が属するカテゴリIDを縦に取得
       $objQuery = new SC_Query();
       $arrCatID = $this->sfGetParents($objQuery, "dtb_category", "parent_category_id", "category_id", $category_id);
       $TopicPath = " > ";

       // カテゴリー名称を取得する
       foreach($arrCatID as $key => $val){
           $sql = "SELECT category_name FROM dtb_category WHERE category_id = ?";
           $arrVal = array($val);
           $CatName = $objQuery->getOne($sql,$arrVal);
             $TopicPath .= '<a href="./list.php?category_id=' .$val . '">' . $CatName . '</a> > ';
           }
       return $TopicPath;
   }

/data/class/pages/products/LC_Page_Products_List.php
107行目に以下を追加

           $TopicPath = $objDb->sfGetTopicPath($arrCategory_id[0]);
           $this->tpl_topicpath = $TopicPath;

/data/class/pages/products/LC_Page_Products_Detail.php
211行目に以下を追加

       $arrTopicPath = $objDb->sfGetTopicPath2($arrCategory_id[0]);
       $this->tpl_topicpath = $arrTopicPath;

/data/Smarty/templates/default/site_main.tpl
37行目に以下を追加

<!--{if $tpl_topicpath != ""}-->
<a href="<!--{$smarty.const.SITE_URL}-->index.php">TopPage</a>
<!--{$tpl_topicpath}-->
<!--{$arrProduct.name|escape}-->
<!--{/if}-->

改造
静的ページにもパンくずリストを表示

<a href="<!--{$smarty.const.SITE_URL}-->index.php">TopPage</a>
<!--{$tpl_topicpath}-->
<!--{$arrProduct.name|escape}-->
<!--{if $tpl_topicpath ==""}-->
 > <!--{$tpl_title|escape}-->
<!--{/if}-->

カテゴリも表示する

<!--{if $tpl_topicpath != ""}-->
<a href="<!--{$smarty.const.SITE_URL}-->index.php">TopPage</a>
<!--{$tpl_topicpath}-->
<!--<a href="<!--{assign var=id value=$arrProducts[cnt].product_id}-->" class="over">-->
<!--{$tpl_subtitle|escape}-->
<!--</a>-->
<!--{$tpl_topicpath}-->
<!--{$arrProduct.name|escape}-->
<!--{/if}-->
最終更新:2009年07月06日 00:22
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。