Created
April 4, 2024 12:04
-
-
Save danielborzov/8802e30bc48a271c8a4f4f0ee525e6bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/addons/rus_sdek/Tygh/Shippings/Services/Sdek.php b/app/addons/rus_sdek/Tygh/Shippings/Services/Sdek.php | |
index 6a4668e60d..abe101f7e5 100644 | |
--- a/app/addons/rus_sdek/Tygh/Shippings/Services/Sdek.php | |
+++ b/app/addons/rus_sdek/Tygh/Shippings/Services/Sdek.php | |
@@ -207,15 +207,11 @@ class Sdek implements IService, IPickupService | |
$weight_data = fn_convert_weight_to_imperial_units($this->shipping_info['package_info']['W']); | |
$shipping_settings = $this->shipping_info['service_params']; | |
- $weight_kg = $weight_data['plain'] * $symbol_grams / 1000; | |
+ $weight = $weight_data['plain'] * $symbol_grams; | |
$length = !empty($shipping_settings['length']) ? $shipping_settings['length'] : SDEK_DEFAULT_DIMENSIONS; | |
$width = !empty($shipping_settings['width']) ? $shipping_settings['width'] : SDEK_DEFAULT_DIMENSIONS; | |
$height = !empty($shipping_settings['height']) ? $shipping_settings['height'] : SDEK_DEFAULT_DIMENSIONS; | |
- if ($weight_kg < 0.1) { | |
- $weight_kg = 0.1; | |
- } | |
- | |
$params_product = []; | |
if (!empty($this->shipping_info['package_info']['packages'])) { | |
$packages = $this->shipping_info['package_info']['packages']; | |
@@ -226,7 +222,7 @@ class Sdek implements IService, IPickupService | |
$weight_ar = fn_convert_weight_to_imperial_units($package['weight']); | |
if (!empty($_REQUEST['order_id'])) { | |
- $weight_kg = 0; | |
+ $weight = 0; | |
foreach ($package['products'] as $cart_id => $amount) { | |
$product_weight = 0; | |
@@ -247,39 +243,39 @@ class Sdek implements IService, IPickupService | |
$product_weight = fn_sdek_check_weight($product_weight, $symbol_grams); | |
- $product_weight_kg = $product_weight * $symbol_grams / 1000; | |
+ $product_weight_g = $product_weight * $symbol_grams; | |
- $weight_kg += $product_weight_kg * $amount; | |
+ $weight += $product_weight_g * $amount; | |
} | |
- if (empty($weight_kg) && !empty($weight_ar['plain'])) { | |
- $weight_kg = $weight_ar['plain'] * $symbol_grams / 1000; | |
+ if (empty($weight) && !empty($weight_ar['plain'])) { | |
+ $weight = $weight_ar['plain'] * $symbol_grams; | |
- } elseif (empty($weight_kg)) { | |
- $weight_kg = 0.1; | |
+ } elseif (empty($weight)) { | |
+ $weight = 100; | |
} | |
} else { | |
- $weight_kg = $weight_ar['plain'] * $symbol_grams / 1000; | |
+ $weight = $weight_ar['plain'] * $symbol_grams; | |
} | |
$package_length = empty($package['shipping_params']['box_length']) ? $length : $package['shipping_params']['box_length']; | |
$package_width = empty($package['shipping_params']['box_width']) ? $width : $package['shipping_params']['box_width']; | |
$package_height = empty($package['shipping_params']['box_height']) ? $height : $package['shipping_params']['box_height']; | |
- $params_product[$id]['weight'] = round($weight_kg, 3); | |
+ $params_product[$id]['weight'] = $weight; | |
$params_product[$id]['length'] = $package_length; | |
$params_product[$id]['width'] = $package_width; | |
$params_product[$id]['height'] = $package_height; | |
} | |
} else { | |
- $params_product['weight'] = round($weight_kg, 3); | |
+ $params_product['weight'] = $weight; | |
$params_product['length'] = $length; | |
$params_product['width'] = $width; | |
$params_product['height'] = $height; | |
$params_product = array ($params_product); | |
} | |
} else { | |
- $params_product['weight'] = round($weight_kg, 3); | |
+ $params_product['weight'] = $weight; | |
$params_product['length'] = $length; | |
$params_product['width'] = $width; | |
$params_product['height'] = $height; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment