Changeset 3166359
- Timestamp:
- 10/10/2024 09:07:30 AM (17 months ago)
- Location:
- ship-depot/trunk
- Files:
-
- 6 edited
-
Ship_Depot_init.php (modified) (2 diffs)
-
includes/Model/class-item.php (modified) (1 diff)
-
includes/Model/class-package.php (modified) (1 diff)
-
page/admin/orders/sd-order-list.php (modified) (1 diff)
-
page/frontend/sd-checkout-page.php (modified) (7 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ship-depot/trunk/Ship_Depot_init.php
r3090663 r3166359 5 5 * Plugin URI: https://shipdepot.vn/ 6 6 * Description: Ship Depot support shipping couriers in Vietnam like GHN, GHTK, AhaMove. 7 * Version: 1.2.1 77 * Version: 1.2.18 8 8 * Author: ShipDepot.vn 9 9 * Text Domain: ship-depot-translate … … 35 35 36 36 if (!defined('SHIP_DEPOT_VERSION')) { 37 define('SHIP_DEPOT_VERSION', '1.2.1 7');37 define('SHIP_DEPOT_VERSION', '1.2.18'); 38 38 } 39 39 -
ship-depot/trunk/includes/Model/class-item.php
r3063365 r3166359 9 9 public string $Name = ""; 10 10 public string $ImageURL = ""; 11 public int $Quantity = 0;12 11 public int $Price = 0; 13 12 public int $TotalPrice = 0; -
ship-depot/trunk/includes/Model/class-package.php
r3063365 r3166359 9 9 public float $Height = 0; 10 10 public float $Weight = 0; 11 public int $Quantity = 1; 11 12 function __construct($object = null) 12 13 { -
ship-depot/trunk/page/admin/orders/sd-order-list.php
r3090008 r3166359 97 97 wp_add_inline_style('woocommerce_admin_styles', "table.wp-list-table .column-sd-shipping-status{ width: 16%; }"); 98 98 } 99 100 101 102 -
ship-depot/trunk/page/frontend/sd-checkout-page.php
r3090663 r3166359 40 40 // Disable all payment gateways on the checkout page and replace the "Pay" button with "Place order". 41 41 //add_filter('woocommerce_cart_needs_payment', '__return_false'); 42 43 42 44 43 //Current hook: woocommerce_review_order_before_order_total => after list item … … 67 66 foreach ($list_cart_items as $item) { 68 67 //Ship_Depot_Logger::wrlog('[sd_woocommerce_review_order_before_order_total] item: ' . print_r($item, true)); 69 Ship_Depot_Logger::wrlog('[sd_woocommerce_review_order_before_order_total] item qty: ' . print_r($item['quantity'], true)); 70 $total_qty += floatval($item['quantity']); 68 $item_quantity = floatval($item['quantity']); 69 Ship_Depot_Logger::wrlog('[sd_woocommerce_review_order_before_order_total] item qty: ' . print_r($item_quantity, true)); 70 $total_qty += $item_quantity; 71 71 $product = $item['data']; 72 72 $product_data = $product->get_data(); 73 73 74 //Ship_Depot_Logger::wrlog('[sd_woocommerce_review_order_before_order_total] product_data: ' . print_r($product_data, true)); 74 75 $package_size = new Ship_Depot_Package(); … … 76 77 $package_size->Width = isset($product_data['width']) ? Ship_Depot_Helper::ConvertToShipDepotDimension($product_data['width']) : 0; 77 78 $package_size->Height = isset($product_data['height']) ? Ship_Depot_Helper::ConvertToShipDepotDimension($product_data['height']) : 0; 78 $package_size->Weight = isset($product_data['weight']) ? Ship_Depot_Helper::ConvertToShipDepotWeight($product_data['weight']) : 0; 79 79 $package_size->Weight = isset($product_data['weight']) ? Ship_Depot_Helper::ConvertToShipDepotWeight($product_data['weight']) * $item_quantity : 0; 80 $package_size->Quantity = 1; 81 //Update 1.2.18: calculate package size with quantity 82 if ($item_quantity > 1) { 83 $min_value = min($package_size->Length, $package_size->Width, $package_size->Height); 84 if ($min_value == $package_size->Width) { 85 $package_size->Width = $package_size->Width * $item_quantity; 86 } else if ($min_value == $package_size->Length) { 87 $package_size->Length = $package_size->Length * $item_quantity; 88 } else { 89 $package_size->Height = $package_size->Height * $item_quantity; 90 } 91 } 92 Ship_Depot_Logger::wrlog('[sd_woocommerce_review_order_before_order_total] package_size: ' . print_r($package_size, true)); 80 93 $it = new Ship_Depot_Item(); 81 94 $it->Sku = $product_data['sku']; 82 95 $it->ID = $item['product_id']; 83 96 $it->Name = $product_data['name']; 84 $it->Quantity = $item ['quantity'];97 $it->Quantity = $item_quantity; 85 98 $it->TotalPrice = $item['line_total']; 86 99 $it->Length = isset($product_data['length']) ? Ship_Depot_Helper::ConvertToShipDepotDimension($product_data['length']) : 0; … … 92 105 $item_regular_price_total += floatval($regular_price) * floatval($item['quantity']); 93 106 $it->RegularPrice = $regular_price; 94 //Ship_Depot_Logger::wrlog('[sd_woocommerce_review_order_before_order_total] it: ' . print_r($it, true));107 Ship_Depot_Logger::wrlog('[sd_woocommerce_review_order_before_order_total] it: ' . print_r($it, true)); 95 108 // 96 109 array_push($list_packages_sizes, $package_size); … … 450 463 $order = wc_get_order($order_id); 451 464 } 452 //$order = wc_get_order($order_id);453 465 //Set shipping item 454 466 $shippings = $order->get_items('shipping'); … … 485 497 $product = $item_product->get_product(); 486 498 // Ship_Depot_Logger::wrlog('[sd_action_checkout_order_processed] product: ' . print_r($product, true)); 487 // $item_product = new WC_Order_Item_Product($item); 488 // $product = new WC_Product($item_product->get_product_id()); 499 $item_quantity = $item->get_quantity(); 489 500 490 501 $package_size = new Ship_Depot_Package(); … … 492 503 $package_size->Width = Ship_Depot_Helper::ConvertToShipDepotDimension($product->get_width()); 493 504 $package_size->Height = Ship_Depot_Helper::ConvertToShipDepotDimension($product->get_height()); 494 $package_size->Weight = Ship_Depot_Helper::ConvertToShipDepotWeight($product->get_weight()); 505 $package_size->Weight = Ship_Depot_Helper::ConvertToShipDepotWeight($product->get_weight()) * $item_quantity; 506 $package_size->Quantity = 1; 507 //Update 1.2.18: calculate package size with quantity 508 if ($item_quantity > 1) { 509 $min_value = min($package_size->Length, $package_size->Width, $package_size->Height); 510 if ($min_value == $package_size->Width) { 511 $package_size->Width = $package_size->Width * $item_quantity; 512 } else if ($min_value == $package_size->Length) { 513 $package_size->Length = $package_size->Length * $item_quantity; 514 } else { 515 $package_size->Height = $package_size->Height * $item_quantity; 516 } 517 } 495 518 array_push($list_packages_sizes, $package_size); 496 519 } -
ship-depot/trunk/readme.txt
r3090663 r3166359 3 3 Tags: shipping, couriers, ghn, ghtk, aha 4 4 Requires at least: 6.1.1 5 Tested up to: 6. 4.35 Tested up to: 6.6.2 6 6 Requires PHP: 7.4.3 7 Stable tag: 1.2.1 77 Stable tag: 1.2.18 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 65 65 66 66 == Changelog == 67 = 1.2.18 = 68 * Sửa lỗi tính phí vận chuyển ở trang thanh toán. 69 67 70 = 1.2.17 = 68 71 * Sửa một số lỗi nhỏ. 69 70 72 71 73 = 1.2.16 =
Note: See TracChangeset
for help on using the changeset viewer.