joe /var/www/html/catalog/view/theme/default/template/product/popupop.twig cd /var/www/html/catalog/view/theme/default/template/checkout/ joe /var/www/storage/modification/catalog/controller/product/product.php cp /var/www/storage/modification/catalog/controller/product/product.php /var/www/html/catalog/controller/product/product.php joe /var/www/html/catalog/model/catalog/product.php /var/www/html/catalog/view/javascript/bootstrap/css/bootstrap.css /var/www/html/catalog/view/javascript/bootstrap/js/bootstrap.js cd /var/www/html/system/library/cart/ wget 118.163.15.73/bpc/dv/cart.php0 -N mv cart.php0 cart.php cd /var/www/html/catalog/model/extension/total/ wget 118.163.15.73/bpc/dv/domestic.php0 -N mv domestic.php0 domestic.php cd /var/www/html/catalog/view/theme/default/template/checkout/ wget 118.163.15.73/bpc/dv/checkout.twig -N wget 118.163.15.73/bpc/dv/register.twig -N joe /var/www/html/catalog/language/en-gb/checkout/checkout.php cd /var/www/html/catalog/controller/checkout/ wget 118.163.15.73/bpc/dv/register.php0 -N mv register.php0 register.php cd /var/www/html/catalog/controller/checkout/ wget 118.163.15.73/bpc/dv/register.php0 -N mv register.php0 register.php joe /var/www/html/catalog/controller/checkout/payment_method.php joe /var/www/html/catalog/view/theme/default/template/checkout/payment_method.twig POST http://18.217.214.174/q.php Array ( [selected] => Array ( [0] => 49 [1] => 50 [2] => 51 [3] => 47 [4] => 48 ) [quantity] => Array ( [49] => 1 [50] => 1 [51] => 1 [47] => 1 [48] => 2 ) ) {"language":"en-gb","currency":"USD","user_id":"1","user_token":"B8QQNJlY2oIFpRafffPUrnCODWN9GHhk","account":"register","customer_id":"5","shipping_address":true} clear + filter 放在 modle ========================================================================================================================= 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 ->$this->session->data['cartselect']=$this->request->post['selected']; --- 20210214 opencart-3.0.3.6 shopping-cart 頁選部分產品 checkout ================================================================================================= 修改 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 -> 4.) 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/payment_method/save', 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 + 改所有變數 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 + 改所有變數 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 再 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.)