diff --git a/CHANGELOG.md b/CHANGELOG.md index 49341cd..b316804 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -151,3 +151,6 @@ ## [3.2.16] - Improved performance - Added additional validation + +## [3.2.17] +- Label printing after changing shipment product bug fix diff --git a/dpdbaltics.php b/dpdbaltics.php index 0fe045a..cb11ea4 100644 --- a/dpdbaltics.php +++ b/dpdbaltics.php @@ -92,7 +92,7 @@ public function __construct() $this->author = 'Invertus'; $this->tab = 'shipping_logistics'; $this->description = 'DPD Baltics shipping integration'; - $this->version = '3.2.16'; + $this->version = '3.2.17'; $this->ps_versions_compliancy = ['min' => '1.7.1.0', 'max' => _PS_VERSION_]; $this->need_instance = 0; parent::__construct(); diff --git a/src/Factory/ShipmentDataFactory.php b/src/Factory/ShipmentDataFactory.php index 6855270..28b5934 100644 --- a/src/Factory/ShipmentDataFactory.php +++ b/src/Factory/ShipmentDataFactory.php @@ -120,6 +120,7 @@ public function getShipmentDataByIdOrder($orderId) $shipmentData->setDpdCountry($dpdPudo->country_code); $shipmentData->setSelectedPudoIsoCode($dpdPudo->country_code); $shipmentData->setDpdZipCode($address->postcode); + $shipmentData->setDpdStreet($dpdPudo->street); $shipmentData->setSelectedPudoId($dpdPudo->pudo_id); } diff --git a/src/Service/API/ShipmentApiService.php b/src/Service/API/ShipmentApiService.php index ef125a9..9c40edb 100644 --- a/src/Service/API/ShipmentApiService.php +++ b/src/Service/API/ShipmentApiService.php @@ -108,6 +108,7 @@ public function createShipment($addressId, ShipmentData $shipmentData, $orderId) $parcel = $this->parcelShopService->getParcelShopByShopId($shipmentData->getSelectedPudoId()); $selectedParcel = is_array($parcel) ? reset($parcel) : $parcel; $postCode = $selectedParcel->getPCode(); + $address->address1 = $selectedParcel->getStreet(); } // IF prestashop allows, we take selected parcel terminal address in case information is missing in checkout address in specific cases. diff --git a/src/Service/PudoService.php b/src/Service/PudoService.php index a3fb14e..6e59cd9 100644 --- a/src/Service/PudoService.php +++ b/src/Service/PudoService.php @@ -241,7 +241,7 @@ public function searchPudoServices($city, $carrierId, $cartId) ]; } - public function savePudoOrder($productId, $pudoId, $isoCode, $cartId, $city, $street) + public function savePudoOrder($productId, $pudoId, $isoCode, $cartId, $city, $street, $zipCode) { $pudoOrderId = $this->pudoRepository->getIdByCart($cartId); $product = new DPDProduct($productId); @@ -254,6 +254,7 @@ public function savePudoOrder($productId, $pudoId, $isoCode, $cartId, $city, $st $pudoOrder->id_cart = $cartId; $pudoOrder->city = $city; $pudoOrder->street = $street; + $pudoOrder->post_code = $zipCode; $pudoOrder->save(); } diff --git a/src/Service/ShipmentService.php b/src/Service/ShipmentService.php index b75d09b..ffe9dcc 100644 --- a/src/Service/ShipmentService.php +++ b/src/Service/ShipmentService.php @@ -415,9 +415,10 @@ public function saveShipment(Order $order, ShipmentData $shipmentData, $print = $isoCode = $shipmentData->getSelectedPudoIsoCode(); $city = $shipmentData->getCity(); $street = $shipmentData->getDpdStreet(); + $zipCode = $shipmentData->getDpdZipCode(); try { - $this->pudoService->savePudoOrder($productId, $pudoId, $isoCode, $cartId, $city, $street); + $this->pudoService->savePudoOrder($productId, $pudoId, $isoCode, $cartId, $city, $street, $zipCode); } catch (Exception $e) { $response['message'] = $this->module->l( sprintf('Failed to save pudo order to database Error: %s', $e->getMessage(). 'ID cart: '. $order->id_cart) diff --git a/views/templates/hook/admin/partials/pudo-info.tpl b/views/templates/hook/admin/partials/pudo-info.tpl index 3bce6f6..e8aa762 100644 --- a/views/templates/hook/admin/partials/pudo-info.tpl +++ b/views/templates/hook/admin/partials/pudo-info.tpl @@ -26,12 +26,14 @@
{$selectedPudo->getStreet()}
+
{$selectedPudo->getPCode()}
+