ec-cube中商品カテゴリー的靜態網址

昨天只做了detail的靜態網址
今天無意間發現這篇
參考了一下把カテゴリー的靜態網址也弄出來了

RewriteEngine On
RewriteRule detail¥/([0-9]+)¥/? /onlineshop/products/detail.php?product_id=$1 [L]
RewriteRule list¥/([0-9]+)¥/? /onlineshop/products/list.php?category_id=$1 [L]

\data\Smarty\templates\mystyle\bloc\category.tpl

  • class="onlink">()
  • 他只有說要改這個
    但我改了\html\user_data\packages\mystyle\bloc\category.tpl後才有作用

  • class="onlink">()
  • \data\class\pages\LC_Page_Sitemap.php
    把昨天書上沒提到的stiemap也補一下

        /**
         * すべての商品一覧ページを取得する.
         *
         * @param boolean $isMobile モバイルページを取得する場合 true
         * @return array 検索エンジンからアクセス可能な商品一覧ページの情報
         */
        function getAllProducts($isMobile = false) {
            $conn = new SC_DBConn();
            $sql = "SELECT category_id FROM dtb_category WHERE del_flg = 0";
            $result = $conn->getAll($sql);
    
            $mobile = "";
            if ($isMobile) {
                $mobile = "mobile/";
            }
    
            $arrRet = array();
            for ($i = 0; $i < count($result); $i++) {
                // :TODO: カテゴリの最終更新日を取得できるようにする
                $page = array("url" => SITE_URL . sprintf("%sproducts/list/%d", $mobile, $result[$i]['category_id']));
                $arrRet[$i] = $page;
            }
            return $arrRet;
        }
    
        /**
         * すべての商品詳細ページを取得する.
         *
         * @param boolean $isMobile モバイルページを取得する場合 true
         * @return array 検索エンジンからアクセス可能な商品詳細ページの情報
         */
        function getAllDetail($isMobile = false) {
            $conn = new SC_DBConn();
            $sql = "SELECT product_id, update_date FROM dtb_products WHERE del_flg = 0 AND status = 1";
            $result = $conn->getAll($sql);
    
            $mobile = "";
            if ($isMobile) {
                $mobile = "mobile/";
            }
    
            $arrRet = array();
            for ($i = 0; $i < count($result); $i++) {
                $page = array("url" => SITE_URL. sprintf("%sproducts/detail/%d", $mobile, $result[$i]['product_id']),
                              "update_date" => $result[$i]['update_date']);
                $arrRet[$i] = $page;
            }
            return $arrRet;
        }
    

    之後他有說要改一堆跟detail有關的地方
    我是覺得不改也沒出錯阿
    不過…我還是有照改拉
    不嫌麻煩就看看囉^^”