在ec-cube中調用商品番號

LINEで送る
[`evernote` not found]

再公司的網站中這是第二次調用了(上次用在商品list)
不過上次不曉得在忙啥就忘了筆記一下
結果這次要再用就又要從頭找過
所以這次還是做完就記一下吧!!

這次是要在各商品deital的オススメ商品也要出現商品番號
於是先改了\data\class\pages\productsLC_Page_Products_Detail.php
把product_code_min, product_code_max兩個參數也從data裡調出來:

711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
    /* 登録済みオススメ商品の読み込み */
    function lfPreGetRecommendProducts($product_id) {
        $arrRecommend = array();
        $objQuery = new SC_Query();
        $objQuery->setorder("rank DESC");
        $arrRet = $objQuery->select("recommend_product_id, comment", "dtb_recommend_products", "product_id = ?", array($product_id));
        $max = count($arrRet);
        $no = 0;
        $from = "vw_products_allclass AS T1 "
                . " JOIN ("
                . " SELECT max(T2.rank) AS product_rank, "
                . "        T2.product_id"
                . "   FROM dtb_product_categories T2  "
                . " GROUP BY product_id) AS T3 USING (product_id)";
        $objQuery->setorder("product_rank DESC");
        for($i = 0; $i < $max; $i++) {
            $where = "del_flg = 0 AND T3.product_id = ? AND status = 1";
            $arrProductInfo = $objQuery->select("DISTINCT main_list_image, price02_min, price02_max, price01_min, price01_max, name, point_rate, product_rank, product_code_min, product_code_max", $from, $where, array($arrRet[$i]['recommend_product_id']));
 
            if(count($arrProductInfo) > 0) {
                $arrRecommend[$no] = $arrProductInfo[0];
                $arrRecommend[$no]['product_id'] = $arrRet[$i]['recommend_product_id'];
                $arrRecommend[$no]['comment'] = $arrRet[$i]['comment'];
                $no++;
            }
        }
        return $arrRecommend;
    }

然後改\html\user_data\packages\mystyledetail.tpl
在想加的地方放上去ok了(當然還要修一下css囉)

334
335
336
337
338
339
340
<div id="pro_code">製品型番:<sapn id="pro_codes">
        <!--{if $arrRecommend[cnt].product_code_min != $arrRecommend[cnt].product_code_max}-->
          <!--{$arrRecommend[cnt].product_code_min}--><!--{$arrRecommend[cnt].product_code_max}-->
        <!--{else}-->
          <!--{$arrRecommend[cnt].product_code_min}-->
        <!--{/if}-->
      </sapn></div>