From dc38a3b4e1245ae7783fb72f715dad8096300d67 Mon Sep 17 00:00:00 2001 From: DPD Development Date: Fri, 31 May 2024 09:04:48 +0200 Subject: [PATCH] 1.3.3 --- Controller/Adminhtml/Order/Shipment/Save.php | 2 +- Helper/Services/OrderConvertService.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Controller/Adminhtml/Order/Shipment/Save.php b/Controller/Adminhtml/Order/Shipment/Save.php index d6ec9dc..13a6e35 100644 --- a/Controller/Adminhtml/Order/Shipment/Save.php +++ b/Controller/Adminhtml/Order/Shipment/Save.php @@ -172,7 +172,7 @@ public function execute() } $order->setData(Constants::ORDER_EXTRA_SHIPPING_DATA, $rows); - $this->dataHelper->generateShippingLabel($order); + $this->dataHelper->generateShippingLabel($order, null, $packages); $order->setCustomerNoteNotify(!empty($data['send_email'])); diff --git a/Helper/Services/OrderConvertService.php b/Helper/Services/OrderConvertService.php index dc179d5..faefb4b 100644 --- a/Helper/Services/OrderConvertService.php +++ b/Helper/Services/OrderConvertService.php @@ -198,13 +198,13 @@ public function addParcelsFromPackages(Order $order, ?Order\Shipment $shipment = $parcels = []; foreach ($packages as $package) { - $weight = floatval($package['weight'] ?? $package['params']['weight'] ?? 0); - $unit = $package['weight_units'] ?? $package['params']['weight_units'] ?? \Zend_Measure_Weight::KILOGRAM; + $unit = $package['weight_units'] ?? $package['params']['weight_units'] ?? 'KILOGRAM'; + + if ($unit === 'POUND') { + $weight = $weight * 0.45359237; + } - $unit = new \Zend_Measure_Weight($weight, $unit); - $unit->convertTo(\Zend_Measure_Weight::KILOGRAM, 2); - $weight = round(floatval($unit->getValue(2)) * 100, 0); $parcel = [ 'customerReferences' => [ $order->getIncrementId() ?? '',