wget 118.163.15.73/bpc/dv/payment_method.twig -O /var/www/html/catalog/view/theme/default/template/checkout/payment_method.twig -N wget 118.163.15.73/bpc/dv/payment_method.php0 -O /var/www/html/catalog/controller/checkout/payment_method.php -N wget 118.163.15.73/bpc/dv/cart.php0 -O /var/www/html/system/library/cart/cart.php -N $weight += $this->weight->convert($product['weight'], $product['weight_class_id'], $this->config->get('config_weight_class_id')); substr(date("F",$d),0,3).date(" d Y",$d); wget 118.163.15.73/bpc/dv/dv_eub.twig -O /var/www/html/admin/controller/extension/shipping/dv_eub.php /var/www/html/admin/view/template/extension/shipping/dv_eub.twig wget 118.163.15.73/bpc/dv/dv_eub.php0 -O /var/www/html/admin/controller/extension/shipping/dv_eub.php -N wget 118.163.15.73/bpc/dv/dv_eub.php0 -O /var/www/html/admin/language/en-gb/extension/shipping/dv_eub.php -N wget 118.163.15.73/bpc/dv/dv_eub.php0 -O /var/www/html/catalog/model/extension/shipping/dv_eub.php -N wget 118.163.15.73/bpc/dv/dv_eub.php0 -O /var/www/html/catalog/language/en-gb/extension/shipping/dv_eub.php -N 6.) Extensions->Extensions->Order Totals->install + enable + sort order 3 //後台先安裝 extension 再 enable + sort order 3 7.) joe /var/www/html/catalog/model/extension/total/domestic.php //修改調用 model cart 函數 ->$domestic = $this->cart->getTotalDomestic(); 8.) joe /var/www/html/system/library/cart/cart.php //新增統計國內運費變數 + 函數 ->'domestic' => $product_query->row['domestic'], ... public function getTotalDomestic() { wget 118.163.15.73/bpc/dv/tabcart.twig -O /var/www/html/catalog/view/theme/default/template/checkout/tabcart.twig -N wget 118.163.15.73/bpc/dv/cart.php0 -O /var/www/html/catalog/controller/checkout/cart.php -N wget 118.163.15.73/bpc/dv/address.php0 -O /var/www/html/catalog/model/account/address.php -N wget 118.163.15.73/bpc/dv/payment_address.php0 -O /var/www/html/catalog/controller/checkout/payment_address.php -N wget 118.163.15.73/bpc/dv/dv_yw01.php0 -O /var/www/html/admin/controller/extension/shipping/dv_yw01.php -N wget 118.163.15.73/bpc/dv/dv_yw01.php0 -O /var/www/html/admin/language/en-gb/extension/shipping/dv_yw01.php -N wget 118.163.15.73/bpc/dv/dv_yw01.twig -O /var/www/html/admin/view/template/extension/shipping/dv_yw01.twig -N wget 118.163.15.73/bpc/dv/dv_yw01.php0 -O /var/www/html/catalog/model/extension/shipping/dv_yw01.php -N wget 118.163.15.73/bpc/dv/dv_yw01.php0 -O /var/www/html/catalog/language/en-gb/extension/shipping/dv_yw01.php -N wget 118.163.15.73/bpc/dv/cart.php0 -O /var/www/html/system/library/cart/cart.php -N wget 118.163.15.73/bpc/dv/depotcheckout.php0 -O /var/www/html/catalog/controller/checkout/depotcheckout.php -N wget 118.163.15.73/bpc/dv/tabcart.twig -O /var/www/html/catalog/view/theme/default/template/checkout/tabcart.twig -N wget 118.163.15.73/bpc/dv/tabestship.twig -O /var/www/html/catalog/view/theme/default/template/checkout/tabestship.twig -N ========================================================================================================================= 新增多家 shipping extension dv_yw01->燕文專線追踪普貨 1.) joe /var/www/html/admin/controller/extension/shipping/dv_yw01.php //修改 class name + 所有變數 dv_eub -> dv_yw01 2.) joe /var/www/html/admin/language/en-gb/extension/shipping/dv_yw01.php //修改所有說明 dv_eub -> dv_yw01 3.) joe /var/www/html/admin/view/template/extension/shipping/dv_yw01.twig //修改所有變數 dv_eub -> dv_yw01 4.) Extensions->Extensions->Shipping->install + edit //後台先安裝 extension -> db->oc_extension 自動產生 shipping dv_yw01 -> edit total 0.01 + status enable + sort order 3 5.) joe /var/www/html/catalog/model/extension/shipping/dv_yw01.php //修改 class name + 所有變數 dv_eub -> dv_yw01 6.) joe /var/www/html/catalog/language/en-gb/extension/shipping/dv_yw01.php //修改所有說明 dv_eub -> dv_yw01 7.) joe /var/www/html/system/library/cart/cart.php //新增函數根據不同目標統計重量 allcart, selectcart, alldepot, selectdepot ->public function getAllWeights() { --- 20210222 opencart-3.0.3.6 新增多家 shipping extension ================================================================================================= Dv Eub shipping extension->dv_eub shipping 1.) cp /var/www/html/admin/controller/extension/shipping/free.php -> dv_eub.php //複制後台 extension controller + 改 class name(必需要和php名相同) + 改所有變數 free -> dv_eub 2.) cp /var/www/html/admin/language/en-gb/extension/shipping/free.php -> dv_eub.php //複制後台語言包 + 改所有常數 free -> dv_eub 3.) cp /var/www/html/admin/view/template/extension/shipping/free.twig -> dv_eub.twig //複制後台 extension template + 改所有變數 free -> dv_eub 4.) Extensions->Extensions->Shipping->install + edit //後台先安裝 extension -> db->oc_extension 自動產生 shipping dv_eub -> edit total 0.01 + status enable + sort order 3 5.) cp /var/www/html/catalog/model/extension/shipping/item.php -> dv_eub.php //複制前台 extension model + 改 class name(必需要和php名相同) + 改所有變數 item -> dv_eub //計算和產生 $method_data 的核心程式 6.) cp /var/www/html/catalog/language/en-gb/extension/shipping/free.php -> dv_eub.php //複制前台語言包 + 改所有常數 free -> dv_eub --- 20210220 opencart-3.0.3.6 新增 Dv Eub shipping extension->dv_eub shipping ================================================================================================= Shopping Cart 頁下方新增可折疊 Shipping Comparison (!!用 php debug 直接 echo 會改變 user agent stylesheet 不可測!!) 1.) joe /var/www/html/catalog/view/theme/default/template/checkout/tabcart.twig //修改 panel-group 在 modules 後插入 tabcart.twig {% include('default/template/checkout/tabestship.twig') %} 2.) joe /var/www/html/catalog/view/theme/default/template/checkout/tabestship.twig //複制 product/compare.twig 內容為主加上 panel, panel-heading, panel-title, panel-body 3.) joe /var/www/html/catalog/controller/checkout/cart.php //新增 $shippings 傳參4種組合 weight type 的 shipping (morecart, selectcart, allcart, alldepot)
...
//用 panel-group 裝入將所有 panel 2.)
...
//用 panel 裝入個別 panel-heading + panel-collapse 3.) ... //個別 panel-heading 中要帶一個 指向同一 panel panel-collapse 的 id 用以 toggle 本 panel-collapse 折疊或展開 //個別 panel-heading 中要帶一個 其中 data-parent 指向父容器的 id 用以折疊所有其他的 panel-collapse 達到 accordion 效果 4.)
...
//個別 panel-collapse 內裝入要折疊或展開的內容 5.) $(".collapse.in").collapse("toggle"); //用 js 將所有已展開(class 中帶有 in)的 panel-collapse 觸發一次折疊 --- 20210218 opencart-3.0.3.6 Shopping Cart 頁下方新增可折疊 Shipping Comparison ========================================================================================================================= 使用 FontAwesome icon 1.) 用 FontForge 打開 /var/www/html/catalog/view/javascript/font-awesome/fonts/fontawesome-webfont.woff2 //從 \f000 到 \f2e0 挑 icon 2.) .. //只能用 class before/after 調用 icon ->.icon-q:before{ font-family: FontAwesome; content: "\f217"; --- 20210218 使用 FontAwesome icon ========================================================================================================================= 使用 js bootstrap collapes 1.)
...
//用 panel-group 裝入將所有 panel 2.)
...
//用 panel 裝入個別 panel-heading + panel-collapse 3.)
... //個別 panel-heading 中要帶一個 指向同一 panel panel-collapse 的 id 用以 toggle 本 panel-collapse 折疊或展開 //個別 panel-heading 中要帶一個 其中 data-parent 指向父容器的 id 用以折疊所有其他的 panel-collapse 達到 accordion 效果 4.)
...
//個別 panel-collapse 內裝入要折疊或展開的內容 5.) $(".collapse.in").collapse("toggle"); //用 js 將所有已展開(class 中帶有 in)的 panel-collapse 觸發一次折疊 --- 20210218 使用 js bootstrap collapse ========================================================================================================================= checkout 頁合併付款方式 + 定單確認為一頁 1.) joe /var/www/html/catalog/view/theme/default/template/checkout/checkout.twig //刪除第3,4,6步驟(Delivery Details, Delivery Method, Confirm Order)的折疊區塊 ->
...
//修改如果登入時已 logged 的 ajax 下載頁面為由原 payment_address -> 新增的 cartorder (panel 仍為 #collapse-payment-method) ->$.ajax({ url: 'index.php?route=checkout/cartorder', ... success: function(html) { $('#collapse-payment-method .panel-body').html(html); 2.) joe /var/www/html/catalog/view/theme/default/template/checkout/cartorder.twig //以原 payment_method.twig 為基礎刪除同意條款 + continue 送出選付款方式按鈕 ->{% if text_agree %}...{% endif %} //將原 confirm.twig 的 order 內容 + total 列表移入至最上方 + 增加 style ->{% if not redirect %}...{% endif %} //將原 confirm.twig 的 confirm 確定定單按鈕移入至最下方 -> //將原 cheque.twig 的 confirm 確定定單按鈕送出 ajax 的 js 移入至最下方 + 修改原 cheque/confirm -> cartorder/confirm -> $.ajax({ url: 'index.php?route=checkout/cartorder/confirm', 3.) joe /var/www/html/system/library/cart/cart.php //新增函數將原 getProducts() 取得的 array 與 session->data['cartselect'] 比較後去除多餘的 array 元素後返回新 array //public function getSelectProducts() { //新增函數將原 getSubTotal() 由合計所有 item 改為只合計選中 item //public function getSelectSubTotal() { //修改函數只統計已選產品國內運費 ->public function getTotalDomestic() { //修改函數只刪除已買產品 ->public function clear() { 4.) joe /var/www/html/catalog/controller/checkout/cartorder.php //以原 confirm.twig 為基礎修改 class 名(不改會直接錯誤) ->class ControllerCheckoutCartorder extends Controller { //刪除判斷 session payment_method ->//if (!isset($this->session->data['payment_method'])) { ... //修改3個調用 getProducts() 為 getSelectProducts() ->$products = $this->cart->getSelectProducts(); //修改調用 getSubTotal() 為 getSelectSubTotal() ->$subtotal = $this->cart->getSelectSubTotal(); //修改預設 session comment 值(不加易錯誤) ->$this->session->data['comment']=''; //將原 payment_method.php 中產生 payment method 不重複的部分移入對應部分 ->$method_data = array(); ... $this->session->data['payment_methods'] = $method_data; //將原 payment_method.php 中7個判斷和處理 session 有關的部分移入對應部分 ->if (empty($this->session->data['payment_methods'])) { ... if (isset($this->session->data['agree'])) { //將原 cheque.php 中的函數 confirm() 刪除判斷 session payment_method + comment 後移入最下方 ->public function confirm() { // from cheque.php --- 20210215 opencart-3.0.3.6 checkout 頁合併付款方式 + 定單確認為一頁 ========================================================================================================================= 研究原結帳流程 1.) /var/www/html/catalog/view/theme/default/template/checkout/checkout.twig //ajax 下載 checkout/payment_method 付款方式列表 + continue 按鈕 + (付款留言 + 同意條款) ->$.ajax({ url: 'index.php?route=checkout/payment_method', //點 continue 按鈕 ajax 上傳選擇付款方式保存在 session ->$(document).delegate('#button-payment-method', 'click', function() { $.ajax({ url: 'index.php?route=checkout/payment_method/save', //上傳成功後再 ajax 下載 confirm 頁內容 ->$.ajax({ url: 'index.php?route=checkout/confirm', 2.) /var/www/html/catalog/controller/checkout/confirm.php //產生 order 所有資料 + 結帳清單內容合計 + 暫時定單寫入SQL (order_status_id=0 為無效定單) ->$this->session->data['order_id'] = $this->model_checkout_order->addOrder($order_data); //調用已選付款方式 extension (例: cheque, cod, pp_braintree ...) ->$data['payment'] = $this->load->controller('extension/payment/' . $this->session->data['payment_method']['code']); 3.) /var/www/html/catalog/view/theme/default/template/extension/payment/cheque.twig //付款方式說明 + 確認定單按鈕 + 點確認定單按鈕後調用函數 confirm ->$.ajax({ url: 'index.php?route=extension/payment/cheque/confirm', 4.) var/www/html/catalog/controller/extension/payment/cheque.php //定單歷史記錄 + 確認定單狀態寫入SQL (order_status_id=1) ->$this->model_checkout_order->addOrderHistory($this->session->data['order_id'], $this->config->get('payment_cheque_order_status_id'), $comment, true); //通知跳轉向 success 頁 ->$json['redirect'] = $this->url->link('checkout/success'); 5.) /var/www/html/catalog/controller/checkout/success.php //調用 libaray 清除 cart ->$this->cart->clear(); 6.) /var/www/html/system/library/cart/cart.php //刪除 db->oc_cart 所有產品 ->$this->db->query("DELETE FROM " . DB_PREFIX . "cart WHERE api_id = '" . (isset($this->session->data['api_id']) ? (int)$this->session->data['api_id'] : 0) . "' AND customer_id = '" . (int)$this->customer->getId() . "' AND session_id = '" . $this->db->escape($this->session->getId()) . "'"); --- 20210215 opencart-3.0.3.6 研究原結帳流程 ================================================================================================= shopping-cart 頁可選部分產品 checkout 1.) joe /var/www/html/catalog/view/theme/default/template/checkout/tabcart.twig //用 submit 把 checkbox selected array -> 上傳 checkout/checkout ->
2.) joe /var/www/html/catalog/controller/checkout/checkout.php //將收到 checkbox selected array 存入 session 如果沒收到存空array -> if(isset($this->request->post['selected'])){ $this->session->data['cartselect']=$this->request->post['selected']; } else{ $this->session->data['cartselect']=array(); } 3.) joe /var/www/html/system/library/cart/cart.php //新增函數根據 session 從 array 排除未選產品 ->public function getSelectProducts() { //新增函數只統計已選產品金額 ->public function getSelectSubTotal() { //修改函數只統計已選產品國內運費 ->public function getTotalDomestic() { //修改函數只刪除已買產品(最後由 checkout/success.php 調用) ->public function clear() { 4.) joe /var/www/html/catalog/model/extension/total/sub_total.php //修改調用函數只統計已選產品金額 ->//$sub_total = $this->cart->getSubTotal(); $sub_total = $this->cart->getSelectSubTotal(); --- 20210215 opencart-3.0.3.6 shopping-cart 頁可選部分產品 checkout ================================================================================================= 修改 shopping cart 頁彈窗為共用 joe /var/www/html/catalog/view/theme/default/template/checkout/tabcart.twig //修改彈窗 div 結構 {# ---------- modal alert ---------------- #} //使用時傳參 + 調用彈窗 $("#modal-header").html("Are you sure about this?"); $("#modal-body").html("This action will remove this item from your shopping cart."); $("#modal-button").html("Remove"); $("#modal-button").attr(tmpa2,"remove"); $("#modal-button").attr(tmpa,tmpid); $("#modal-alert").modal("show"); //按鍵時判斷按鍵功能 $("#modal-button").click(function() { var tmpa2="data-func"; if($(this).attr(tmpa2)=="remove"){ --- 20210215 opencart-3.0.3.6 修改 shopping cart 頁彈窗為共用 ================================================================================================= 修改 checkout 頁流程格式 1.) 未login -> ajax checkout/login -> 放入Step 1 (#collapse-checkout-option) joe /var/www/html/catalog/view/theme/default/template/checkout/checkout.twig ->$.ajax({ url: 'index.php?route=checkout/login' 1-1.) 如果按 continue(Register Account) -> ajax checkout/register -> 放入Step 2 (#collapse-payment-address) joe /var/www/html/catalog/view/theme/default/template/checkout/checkout.twig ->$.ajax({ url: 'index.php?route=checkout/' + $('input[name=\'account\']:checked').val(), 1-1-1.) 填註冊資料再按 continue -> ajax post checkout/register/save -> 註冊成功自動 login -> 2.) joe /var/www/html/catalog/view/theme/default/template/checkout/regidter.twig 修改: fieldset.legend->Your Address->Ship To 修改: 刪除所有address欄位只留下國家 + 刪除訂閱 修改: Disable所有國家只留下美國->UPDATE oc_country SET status=0 WHERE country_id<>223 joe /var/www/html/catalog/controller/checkout/regidter.php 修改: 刪除 telephone, address_1, city 錯誤判斷 修改: 預設值 $this->request->post['zone_id']=""; company, address_1, address_2, postcode, city, zone_id, shipping_address(=payment_address) ->$.ajax({ url: 'index.php?route=checkout/register/save', 1-2.) 如果填 e-mail + psw 再按 login -> ajax post checkout/login/save -> login 成功 -> 2.) ->$.ajax({ url: 'index.php?route=checkout/login/save', 錯誤: /var/www/html/catalog/controller/checkout/login.php 根據 config_tax_customer 設值 $this->session->data['payment_address'] /var/www/html/catalog/controller/checkout/payment_method.php 判斷 $this->session->data['payment_address'] 是否列表 payment method 修改: 後台System->Settings->Store->Option->Use Customer Tax Address/Use Store Tax Address 都改為->Payment Address 2.) 已login -> ajax checkout/payment_method -> 放入Step 3 (#collapse-payment-method) joe /var/www/html/catalog/controller/checkout/checkout.php 修改: payment_method, checkout_confirm step 5,6->3,4 ->$data['text_checkout_payment_method'] = sprintf($this->language->get('text_checkout_payment_method'), 3); $data['text_checkout_confirm'] = sprintf($this->language->get('text_checkout_confirm'), 4); joe /var/www/html/catalog/view/theme/default/template/checkout/regidter.twig 修改: 跳過 step payment_address, shipping_address 改成直接到 step payment_method ->$.ajax({ url: 'index.php?route=checkout/payment_method', 3.) 選付款方式再按 continue -> ajax post checkout/payment_method/save -> ajax checkout/confirm -> 放入Step 4 (#collapse-checkout-confirm) ->$.ajax({ url: 'index.php?route=checkout/payment_method/save', joe /var/www/html/catalog/controller/checkout/confirm.php 錯誤: 判斷有$this->cart->hasShipping() 但 session 沒有 shipping_address, shipping_method 直接跳回原層級 修改: 將 $this->cart->hasShipping() 改為 false && $this->cart->hasShipping() ->$.ajax({ url: 'index.php?route=checkout/confirm', Ext.) 在非 checkout 頁註冊增加 Ship To joe /var/www/html/catalog/view/theme/default/template/account/regidter.twig 修改: 刪除 fieldset 訂閱 修改: 新增 fieldset Ship To 只有國家 joe /var/www/html/catalog/controller/account/regidter.php ->public function index() { ... 修改: 新增地址寫入SQL + set default address + set session address 修改: 預設值 $this->request->post['zone_id']=""; company, address_1, address_2, postcode, city, zone_id, shipping_address(=payment_address) 修改: 新增讀取國家列表 + 預設 $data['country_id'] ->private function validate() { ... 修改: 新增 country_id 錯誤判斷 修改: 刪除 telephone 錯誤判斷 --- 20210214 opencart-3.0.3.6 修改 checkout 頁流程格式 ================================================================================================= 修改無地址註冊用戶-> login 後錯誤(所有註冊都加地址->已回復未改) joe /var/www/html/catalog/controller/startup/startup.php-> 錯誤: 如果無地址 session->data['shipping_address'] 是 false 而不是 array ->if (isset($this->session->data['shipping_address'])) { ... if (isset($this->session->data['payment_address'])) { 修改: 改為判斷是否是 array ->if (is_array($this->session->data['shipping_address'])) { ... if (is_array($this->session->data['payment_address'])) { --- 20210213 opencart-3.0.3.6 修改無地址註冊用戶-> login 後錯誤(所有註冊都加地址->已回復未改) ================================================================================================= 取消註冊 telephone required 1.) 刪除所有判斷 telephone 長度的 controller joe /var/www/html/catalog/controller/account/register.php joe /var/www/html/catalog/controller/account/edit.php joe /var/www/html/catalog/controller/checkout/register.php joe /var/www/html/admin/controller/customer/customer.php -> // if ((utf8_strlen($this->request->post['telephone']) < 3) || (utf8_strlen($this->request->post['telephone']) > 32)) { // $this->error['telephone'] = $this->language->get('error_telephone'); // } 2.) 修改所有加 required 星號的 template joe /var/www/html/catalog/view/theme/default/template/account/register.twig joe /var/www/html/catalog/view/theme/default/template/account/edit.twig joe /var/www/html/catalog/view/theme/default/template/checkout/register.twig joe /var/www/html/admin/view/template/customer/customer_form.twig ->
//刪除 required ->
--- 20210213 opencart-3.0.3.6 取消註冊 telephone required ================================================================================================= 新增 shopping cart 頁數量為0時彈窗確認刪除 joe /var/www/html/catalog/view/theme/default/template/checkout/tabcart.twig //建立彈窗 div 結構 //為0時傳參 + 調用彈窗 $('#button-remove').attr(tmpa,tmpid); $('#modal-remove').modal('show'); --- 20210212 opencart-3.0.3.6 新增 shopping cart 頁數量為0時彈窗確認刪除 ================================================================================================= 新增 shopping cart 頁 total extension->domestic shipping 國內運費 1.) cp /var/www/html/admin/controller/extension/total/sub_total.php -> domestic.php //複制後台 extension controller + 改 class name(必需要和php名相同) + 改所有變數 sub_total -> domestic 2.) cp /var/www/html/admin/language/en-gb/extension/total/sub_total.php -> domestic.php //複制後台語言包 + 改所有常數 sub_total -> domestic 3.) cp /var/www/html/admin/view/template/extension/total/sub_total.twig -> domestic.twig //複制後台 extension template + 改所有變數 sub_total -> domestic 4.) cp /var/www/html/catalog/model/extension/total/sub_total.php -> domestic.php //複制前台 extension model + 改 class name(必需要和php名相同) + 改所有變數 sub_total -> domestic 5.) cp /var/www/html/catalog/language/en-gb/extension/total/sub_total.php -> domestic.php //複制前台語言包 + 改所有常數 sub_total -> domestic 6.) Extensions->Extensions->Order Totals->install + enable + sort order 3 //後台先安裝 extension -> 安裝後 db->oc_extension 自動產生 shipping domestic -> 再 enable + sort order 3 7.) joe /var/www/html/catalog/model/extension/total/domestic.php //修改調用 model cart 函數 ->$domestic = $this->cart->getTotalDomestic(); 8.) joe /var/www/html/system/library/cart/cart.php //新增統計國內運費變數 + 函數 ->'domestic' => $product_query->row['domestic'], ... public function getTotalDomestic() { --- 20210212 opencart-3.0.3.6 新增 shopping cart 頁 total extension->domestic shipping 國內運費 ================================================================================================= shopping cart 頁尾部所有 totals 產生路徑 1.) /var/www/html/catalog/view/theme/default/template/checkout/tabcart.twig //列出所有的 total ->{% for total in totals %} {{ total.title }}: {{ total.text }} {% endfor %} 2.) /var/www/html/catalog/controller/checkout/cart.php //取所有 total extension -> $results = $this->model_setting_extension->getExtensions('total'); //數據庫取所有 total extension list /var/www/html/catalog/model/setting/extension.php -> $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "extension WHERE `type` = '" . $this->db->escape($type) . "'"); -> db->oc_extension->code->10個值(sub_total,reward,shipping,coupon,tax,credit,voucher,total,handling,low_order_fee) //排序所有 total extension (讀取db->oc_setting所有設定) foreach ($results as $key => $value) { $sort_order[$key] = $this->config->get('total_' . $value['code'] . '_sort_order'); } //判斷所有 total extension 是否執行 (讀取db->oc_setting所有設定) -> if ($this->config->get('total_' . $result['code'] . '_status')) { //加載 total extension model -> $this->load->model('extension/total/' . $result['code']); //執行 total extension model 的 getTotal // We have to put the totals in an array so that they pass by reference. $this->{'model_extension_total_' . $result['code']}->getTotal($total_data); 3.) /var/www/html/catalog/model/extension/total/sub_total.php //第一個 total extension 取總貨款 -> $sub_total = $this->cart->getSubTotal(); 4.) /var/www/html/system/library/cart/cart.php //累加所有貨款 ->public function getSubTotal() { $total = 0; foreach ($this->getProducts() as $product) { $total += $product['total']; } //從 db->oc_cart 取產品 list ->public function getProducts() { ... $cart_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "cart WHERE api_id = '" . (isset($this->session->data['api_id']) ? (int)$this->session->data['api_id'] : 0) . "' AND customer_id = '" . (int)$this->customer->getId() . "' AND session_id = '" . $this->db->escape($this->session->getId()) . "'"); //從 db->oc_product 取產品資料 ->foreach ($cart_query->rows as $cart) { ... $product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_store p2s LEFT JOIN " . DB_PREFIX . "product p ON (p2s.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2s.product_id = '" . (int)$cart['product_id'] . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.date_available <= NOW() AND p.status = '1'"); ... $price = $product_query->row['price']; --- 20210212 opencart-3.0.3.6 研究 shopping cart 頁尾部所有 totals 產生路徑 ================================================================================================= shopping cart 頁->小屏內容不超出屏幕 + 新增 checkbox 列 1.) joe /var/www/html/catalog/controller/checkout/cart.php //放大縮圖 47x47 -> 100x100 ->// $image = $this->model_tool_image->resize($product['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_cart_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_cart_height')); $image = $this->model_tool_image->resize($product['image'], 100, 100); 2.) joe /var/www/html/catalog/view/theme/default/template/checkout/tabcat.twig //刪除 model 欄 {{ column_model }} {{ product.model }} //TD name 改為 div 移到 td-img 之下 //設 td-img, img, name 的 position .cart-td-img{ position: relative; .cart-img{ position: absolute; .cart-name{ position: relative; //設屏小於767px css @media only screen and (max-width: 767px) { -> //表單頭不顯示 .tsts{ display: none; ... thead class="tsts"> //設 td-price, td-qty, td-total 的 float, box-sizing, width .cart-td-price{ box-sizing: border-box; float: left; width: 30%; .cart-td-qty{ box-sizing: border-box; float: left; width: 40%; .cart-td-total{ box-sizing: border-box; float: left; width: 30%; //設 qty input 格的 min-width 小一點給手機版用 .cart-qty-input{ min-width: 40px !important; //加 price, qty, total 上方 title .cart-td-price:before{ content: "Price"; .cart-td-qty:before{ content: "Qty"; .cart-td-total:before{ content: "Subtotal"; //新增 td-checkbox 在表第一列 ... //表第一列放大 checkbox 方格 .cart-checkbox{ width: 20px; height: 20px; --- 20210211 opencart-3.0.3.6 修改 shopping cart 頁->小屏內容不超出屏幕 + 新增 checkbox 列 ================================================================================================= 修改 shopping cart 頁->增加 tab 1.) joe /var/www/html/catalog/view/theme/default/template/checkout/cart.twig //刪除原shopping cart 改為include tabcart.twig ->

{{ heading_title }} ... {{ column_right }}

->{% include('default/template/checkout/tabcart.twig') %} 2.) joe /var/www/html/catalog/view/theme/default/template/checkout/tabcart.twig //增加 tab 選擇器
//增加 tab 內容
{{ tab-cart }}
{{ tab-depot }}
--- 20210207 opencart-3.0.3.6 修改 shopping cart 頁->增加 tab ================================================================================================= (!!copy時錯誤: db->oc_product->date_available: default="0000-00-00" 格式不對系統自動改為 default 無) 1.) db->oc_product 增加新欄位 domestic 2.) joe /var/www/html/catalog/model/catalog/product.php -> public function getProduct($product_id) { ... 'domestic' => $query->row['domestic'], 3.) joe /var/www/html/catalog/controller/product/product.php (joe /var/www/storage/modification/catalog/controller/product/product.php 測試時用) -> ... $data['domestic'] = floatval($product_info['domestic']); 4.) joe /var/www/html/catalog/view/theme/default/template/product/popupop.twig //直接調用 {{ domestic }} --- 20210203 opencart-3.0.3.6 增加國內運費 ================================================================================================= product頁讀取欄位title + SQL資料路徑 /var/www/html/catalog/controller/product/product.php //讀取欄位title $this->load->language('product/product'); /var/www/html/catalog/language/en-gb/product/product.php $_['text_brand'] = 'Brand'; $_['text_manufacturer'] = 'Brand:'; $_['text_model'] = 'Product Code:'; $_['text_reward'] = 'Reward Points:'; $_['text_points'] = 'Price in reward points:'; $_['text_stock'] = 'Availability:'; $_['text_instock'] = 'In Stock'; $_['text_tax'] = 'Ex Tax:'; //讀取 db->oc_product 送出到product.twig + popupop.twig $data['weight'] = $product_info['weight']; $data['weight_format'] = $this->weight->format($product_info['weight'], $product_info['weight_class_id']); $data['length'] = $this->length->format($product_info['length'], $product_info['length_class_id']); $data['width'] = $this->length->format($product_info['width'], $product_info['length_class_id']); $data['height'] = $this->length->format($product_info['height'], $product_info['length_class_id']); //原db->oc_option...4個table的欄位 oc_option->option_id 5,14,15 標準option組id->帶type,sort oc_option_description 標準option組代表的語言,名稱,說明? oc_option_value->option_value_id 標準option組的值的id->帶圖url,sort oc_option_value_description 標準option組的值代表的語言,名稱 //原db->oc_product...3個table的欄位 oc_product->product_id 30 產品的id oc_product_option->product_option_id 226,236,237 產品的option組的id oc_product_option->option_id 5 14 15 標準option組的id oc_product_option_value->product_option_value_id 產品的option組的值的id->帶庫存,扣庫,增減單價,積分,重量 226->15,16,28 236->29~34 237->35~40 //合併原db->oc_option...4個table欄位 -> db->oc_product...2個table oc_product_option 加5欄位 type,sort_order / language_id,name,description oc_product_option_value 加3欄位 image,sort_order language_id,name //合併原db->oc_option...4個table資料 -> db->oc_product...2個table select * from oc_product_option inner join oc_option on oc_product_option.option_id=oc_option.option_id where 1 update oc_product_option inner join oc_option on oc_product_option.option_id=oc_option.option_id set oc_product_option.type=oc_option.type,oc_product_option.sort_order=oc_option.sort_order where 1; select * from oc_product_option inner join oc_option_description on oc_product_option.option_id=oc_option_description.option_id where 1 update oc_product_option inner join oc_option_description on oc_product_option.option_id=oc_option_description.option_id set oc_product_option.language_id=oc_option_description.language_id where 1; update oc_product_option inner join oc_option_description on oc_product_option.option_id=oc_option_description.option_id set oc_product_option.name=oc_option_description.name where 1; update oc_product_option inner join oc_option_description on oc_product_option.option_id=oc_option_description.option_id set oc_product_option.description=oc_option_description.description where 1; select * from oc_product_option_value inner join oc_option_value on oc_product_option_value.option_value_id=oc_option_value.option_value_id where 1 update oc_product_option_value inner join oc_option_value on oc_product_option_value.option_value_id=oc_option_value.option_value_id set oc_product_option_value.image=oc_option_value.image where 1; update oc_product_option_value inner join oc_option_value on oc_product_option_value.option_value_id=oc_option_value.option_value_id set oc_product_option_value.sort_order=oc_option_value.sort_order where 1; select * from oc_product_option_value inner join oc_option_value_description on oc_product_option_value.option_value_id=oc_option_value_description.option_value_id where 1 update oc_product_option_value inner join oc_option_value_description on oc_product_option_value.option_value_id=oc_option_value_description.option_value_id set oc_product_option_value.language_id=oc_option_value_description.language_id where 1; update oc_product_option_value inner join oc_option_value_description on oc_product_option_value.option_value_id=oc_option_value_description.option_value_id set oc_product_option_value.name=oc_option_value_description.name where 1; //修改 /var/www/html/catalog/model/catalog/product.php 讀取SQL product option 資料 ->foreach ($this->model_catalog_product->getProductOptions($this->request->get['product_id']) as $option) { ->joe /var/www/html/catalog/model/catalog/product.php -> public function getProductOptions($product_id) { ... // $product_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_option po LEFT JOIN `" . DB_PREFIX . "option` o ON (po.option_id = o.option_id) LEFT JOIN " . DB_PREFIX . "option_description od ON (o.option_id = od.option_id) WHERE po.product_id = '" . (int)$product_id . "' AND od.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY o.sort_order"); $product_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_option po WHERE po.product_id = '" . (int)$product_id . "' AND po.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY po.sort_order"); ... // $product_option_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value ov ON (pov.option_value_id = ov.option_value_id) LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (ov.option_value_id = ovd.option_value_id) WHERE pov.product_id = '" . (int)$product_id . "' AND pov.product_option_id = '" . (int)$product_option['product_option_id'] . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY ov.sort_order"); $product_option_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_option_value pov WHERE pov.product_id = '" . (int)$product_id . "' AND pov.product_option_id = '" . (int)$product_option['product_option_id'] . "' AND pov.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY pov.sort_order"); //修改 /var/www/html/system/library/cart/cart.php 讀取SQL product option 資料 ->joe /var/www/html/system/library/cart/cart.php -> public function getProducts() { ... // $option_query = $this->db->query("SELECT po.product_option_id, po.option_id, od.name, o.type FROM " . DB_PREFIX . "product_option po LEFT JOIN `" . DB_PREFIX . "option` o ON (po.option_id = o.option_id) LEFT JOIN " . DB_PREFIX . "option_description od ON (o.option_id = od.option_id) WHERE po.product_option_id = '" . (int)$product_option_id . "' AND po.product_id = '" . (int)$cart['product_id'] . "' AND od.language_id = '" . (int)$this->config->get('config_language_id') . "'"); $option_query = $this->db->query("SELECT po.product_option_id, po.option_id, po.name, po.type FROM " . DB_PREFIX . "product_option po WHERE po.product_option_id = '" . (int)$product_option_id . "' AND po.product_id = '" . (int)$cart['product_id'] . "' AND po.language_id = '" . (int)$this->config->get('config_language_id') . "'"); ... // $option_value_query = $this->db->query("SELECT pov.option_value_id, ovd.name, pov.quantity, pov.subtract, pov.price, pov.price_prefix, pov.points, pov.points_prefix, pov.weight, pov.weight_prefix FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value ov ON (pov.option_value_id = ov.option_value_id) LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (ov.option_value_id = ovd.option_value_id) WHERE pov.product_option_value_id = '" . (int)$value . "' AND pov.product_option_id = '" . (int)$product_option_id . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "'"); $option_value_query = $this->db->query("SELECT pov.option_value_id, pov.name, pov.quantity, pov.subtract, pov.price, pov.price_prefix, pov.points, pov.points_prefix, pov.weight, pov.weight_prefix FROM " . DB_PREFIX . "product_option_value pov WHERE pov.product_option_value_id = '" . (int)$value . "' AND pov.product_option_id = '" . (int)$product_option_id . "' AND pov.language_id = '" . (int)$this->config->get('config_language_id') . "'"); //清空或刪原db->oc_option...4個table資料測是否成功->??表oc_option 空的OK,沒有會死??(已解決) --- 20210203 opencart-3.0.3.6 修改合併 product option 7個 SQL table ================================================================================================= modal 彈窗 + magnific popup joe /var/www/html/catalog/view/theme/default/template/product/popupop.twig 1.) $('#modal-shipping').modal('show'); //Jquery 調用 modal 彈窗 /var/www/html/catalog/view/javascript/bootstrap/js/bootstrap.js ->Modal.prototype.show = function (_relatedTarget) { ... 2.)
//修改 container 的寬度(default 750px)不要超出 modal 彈窗的寬度(default 600px) /var/www/html/catalog/view/javascript/bootstrap/css/bootstrap.css -> @media (min-width: 768px) { .container { width: 750px; ... @media (min-width: 768px) { .modal-dialog { width: 600px; margin: 30px auto; } 3.)