最新 New
- 取得連結
- X
- 以電子郵件傳送
- 其他應用程式
草監網路已從Blogger搬離至獨立網站https://gratch.tw/ ,將於3秒後自動跳轉
最近朋友開了一間店,因為預算有限又想用最快速度完成購物網站,所以就用Opencart來製作,本來打算裝2.0,但是朋友買版型只適用1.5.6,所以只好裝1.5.6版本,在上稿的過程中,編輯分類的時候發現在列表裡面的排序數字一直都不對,所以就回去查了一下程式,原來是原本的程式筆誤,導致 opencart 最終發佈的1.5.6.1版本裡面有bug,修改方式如下:1. 找到admin/model/catalog/category.php,並用編輯器打開。
2. 尋找208行
$sql = "SELECT cp.category_id AS category_id, GROUP_CONCAT(cd1.name ORDER BY cp.level SEPARATOR ' > ') AS name, c.parent_id, c.sort_order FROM " . DB_PREFIX . "category_path cp LEFT JOIN " . DB_PREFIX . "category c ON (cp.path_id = c.category_id) LEFT JOIN " . DB_PREFIX . "category_description cd1 ON (c.category_id = cd1.category_id) LEFT JOIN " . DB_PREFIX . "category_description cd2 ON (cp.category_id = cd2.category_id) WHERE cd1.language_id = '" . (int)$this->config->get('config_language_id') . "' AND cd2.language_id = '" . (int)$this->config->get('config_language_id') . "'";
3. 將上方紅色文字改成“cp.category_id” 變成
+ $sql = "SELECT cp.category_id AS category_id, GROUP_CONCAT(cd1.name ORDER BY cp.level SEPARATOR ' > ') AS name, c.parent_id, c.sort_order FROM " . DB_PREFIX . "category_path cp LEFT JOIN " . DB_PREFIX . "category c ON (cp.category_id = c.category_id) LEFT JOIN " . DB_PREFIX . "category_description cd1 ON (cp.path_id = cd1.category_id) LEFT JOIN " . DB_PREFIX . "category_description cd2 ON (cp.category_id = cd2.category_id) WHERE cd1.language_id = '" . (int)$this->config->get('config_language_id') . "' AND cd2.language_id = '" . (int)$this->config->get('config_language_id') . "'";
4. 修改完成後上傳覆蓋admin/model/catalog/category.php,即可修復Sort Order 排序數字問題
留言
張貼留言