From fabb31ff7bfe412930c2c4495267f3718f1e2e75 Mon Sep 17 00:00:00 2001 From: Marvin Besselsen Date: Thu, 13 Jun 2024 14:54:24 +0200 Subject: [PATCH 1/5] Fixed PUDO address saved as default shipping address --- Plugin/Checkout/ShippingInformationManagementPlugin.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugin/Checkout/ShippingInformationManagementPlugin.php b/Plugin/Checkout/ShippingInformationManagementPlugin.php index 45df435..5ff812e 100755 --- a/Plugin/Checkout/ShippingInformationManagementPlugin.php +++ b/Plugin/Checkout/ShippingInformationManagementPlugin.php @@ -136,7 +136,8 @@ public function beforeSaveAddressInformation( ->setStreet($this->arrayManager->get('street', $pickupLocationAddress)) ->setCity($this->arrayManager->get('city', $pickupLocationAddress)) ->setCountryId($this->arrayManager->get('country', $pickupLocationAddress)) - ->setCompany($this->arrayManager->get('name', $pickupLocation)); + ->setCompany($this->arrayManager->get('name', $pickupLocation)) + ->setSaveInAddressBook(0); // ... also set to quote shipping address if exists if (($quoteShippingAddress = $quote->getShippingAddress()) From d9ea97b02d0e037473f1d94d7b18d0ae8db96e72 Mon Sep 17 00:00:00 2001 From: Marvin Besselsen Date: Thu, 13 Jun 2024 14:57:01 +0200 Subject: [PATCH 2/5] Fixed dimensions multiplying on strings --- Model/Api/Builder/Order.php | 21 +++++++++++++++++---- Model/Checkout/WidgetConfigProvider.php | 21 ++++++++++++++++++--- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/Model/Api/Builder/Order.php b/Model/Api/Builder/Order.php index 4d0ef45..a898f14 100755 --- a/Model/Api/Builder/Order.php +++ b/Model/Api/Builder/Order.php @@ -403,25 +403,38 @@ private function getProductDimemension(Item $item) } if ($widthAttribute = $this->config->getProductAttributeWidth()) { - if ($width = $product->getData($widthAttribute) * $k) { + if ($width = $this->reformatVolumeData($product->getData($widthAttribute)) * $k) { $dimensionArray['width'] = (int)$width; } } if ($heightAttribute = $this->config->getProductAttributeHeight()) { - if ($height = $product->getData($heightAttribute) * $k) { + if ($height = $this->reformatVolumeData($product->getData($heightAttribute)) * $k) { $dimensionArray['height'] = (int)$height; } } - if ($lengthAttribute = $this->config->getProductAttributeLength() * $k) { - if ($length = $product->getData($lengthAttribute)) { + if ($lengthAttribute = $this->config->getProductAttributeLength()) { + if ($length = $this->reformatVolumeData($product->getData($lengthAttribute)) * $k) { $dimensionArray['length'] = (int)$length; } } return $dimensionArray; } + + /** + * @param $value + * @return float + */ + private function reformatVolumeData($value): float + { + if ($value == null) { + return 0.00; + } + + return (float)str_replace(',', '.', $value); + } /** * Check if parent item is bundle diff --git a/Model/Checkout/WidgetConfigProvider.php b/Model/Checkout/WidgetConfigProvider.php index c46fbe9..5385602 100755 --- a/Model/Checkout/WidgetConfigProvider.php +++ b/Model/Checkout/WidgetConfigProvider.php @@ -570,12 +570,27 @@ private function calculateVolumeByDimensions($product): float default: $k = 0.000001; } + $widthAttribute = $this->scopeConfig->getProductAttributeWidth(); $heightAttribute = $this->scopeConfig->getProductAttributeHeight(); $lengthAttribute = $this->scopeConfig->getProductAttributeLength(); - return (float)str_replace(',', '.', $product->getData($widthAttribute)) * - (float)str_replace(',', '.', $product->getData($heightAttribute)) * - (float)str_replace(',', '.', $product->getData($lengthAttribute)) * + + return $this->reformatVolumeData($product->getData($widthAttribute)) * + $this->reformatVolumeData($product->getData($heightAttribute)) * + $this->reformatVolumeData($product->getData($lengthAttribute)) * $k; } + + /** + * @param $value + * @return float + */ + private function reformatVolumeData($value): float + { + if ($value == null) { + return 0.00; + } + + return (float)str_replace(',', '.', $value); + } } From 4f9e60714d4904f519d43045fc650d65e525d72b Mon Sep 17 00:00:00 2001 From: Marvin Besselsen Date: Thu, 13 Jun 2024 14:57:56 +0200 Subject: [PATCH 3/5] Added carrier description to order info --- .../Api/Converter/Checkout/ToShippingInfo.php | 1 + Model/ShippingInfo.php | 18 ++++++++++++++++++ ViewModel/Pickup/Info.php | 12 ++++++++++++ .../templates/order/view/pickup/info.phtml | 6 ++++++ 4 files changed, 37 insertions(+) diff --git a/Model/Api/Converter/Checkout/ToShippingInfo.php b/Model/Api/Converter/Checkout/ToShippingInfo.php index f3796b2..610249e 100644 --- a/Model/Api/Converter/Checkout/ToShippingInfo.php +++ b/Model/Api/Converter/Checkout/ToShippingInfo.php @@ -73,6 +73,7 @@ public function convert($response) $info->setIdenfifier($this->arrayManager->get('shippingOption/identifier', $result)); $info->setPrice(floatval($this->arrayManager->get('shippingOption/rate', $result))); $info->setOptionTitle($this->arrayManager->get('shippingOption/name', $result)); + $info->setCarrierDescription($this->arrayManager->get('shippingOption/carrier/description', $result)); if (!$prefferedDeliveryDate = $this->arrayManager->get('preferredDeliveryDate', $result)) { $prefferedDeliveryDate = $this->arrayManager->get('shippingOption/deliveryDates/0/deliveryDate', $result); diff --git a/Model/ShippingInfo.php b/Model/ShippingInfo.php index dd97e06..dcda2ac 100644 --- a/Model/ShippingInfo.php +++ b/Model/ShippingInfo.php @@ -33,6 +33,7 @@ class ShippingInfo extends DataObject public const PREFERRED_DELIVERY_DATE = 'preferred_delivery_date'; public const ESTIMATED_DELIVERY_RANGE = 'estimated_delivery_range'; public const CARRIER_PICKUP_DATE = 'carrier_pickup_date'; + public const CARRIER_DESCRIPTION = 'carrier_description'; /**#@- */ /** @@ -274,4 +275,21 @@ public function getCarrierPickupDate() { return $this->getData(self::CARRIER_PICKUP_DATE); } + + /** + * @param string $value + * @return $this + */ + public function setCarrierDescription($value) + { + return $this->setData(self::CARRIER_DESCRIPTION, $value); + } + + /** + * @return string|null + */ + public function getCarrierDescription() + { + return $this->getData(self::CARRIER_DESCRIPTION); + } } diff --git a/ViewModel/Pickup/Info.php b/ViewModel/Pickup/Info.php index 7479723..3876e04 100755 --- a/ViewModel/Pickup/Info.php +++ b/ViewModel/Pickup/Info.php @@ -224,4 +224,16 @@ public function getLocationCode() return ''; } } + + /** + * @return string + */ + public function getCarrierDescription() + { + try { + return (string)$this->getOrderInfo()->getCarrierDescription(); + } catch (NoSuchEntityException $e) { + return ''; + } + } } diff --git a/view/adminhtml/templates/order/view/pickup/info.phtml b/view/adminhtml/templates/order/view/pickup/info.phtml index d999429..8e1a40b 100755 --- a/view/adminhtml/templates/order/view/pickup/info.phtml +++ b/view/adminhtml/templates/order/view/pickup/info.phtml @@ -23,6 +23,12 @@ $viewModel = $block->getData('pickupViewModel'); escapeHtml($viewModel->getLocationCode())?> + getCarrierDescription()): ?> +
+ :
+ escapeHtml($description)?> +
+ From a85f41007ac27fecb4e8ce8eae91c5d88fe9205a Mon Sep 17 00:00:00 2001 From: Marvin Besselsen Date: Thu, 20 Jun 2024 16:09:47 +0200 Subject: [PATCH 4/5] Backend issue PHP 8.3 on retry #109 --- Model/Api/Builder/Order.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Model/Api/Builder/Order.php b/Model/Api/Builder/Order.php index a898f14..718f733 100755 --- a/Model/Api/Builder/Order.php +++ b/Model/Api/Builder/Order.php @@ -185,9 +185,9 @@ public function parseAddress(Address $shippingAddress) $street = $shippingAddress->getStreet(); if ($this->config->housenumberExtensionOnThirdStreet()) { return [ - 'street' => trim($street[0] ?? null), - 'houseNumber' => trim(isset($street[1]) ? $street[1] : null), - 'houseNumberExtension' => trim(isset($street[2]) ? $street[2] : null), + 'street' => trim($street[0] ?? ''), + 'houseNumber' => trim($street[1] ?? ''), + 'houseNumberExtension' => trim($street[2] ?? ''), ]; } $street = implode(' ', $street); @@ -422,7 +422,7 @@ private function getProductDimemension(Item $item) return $dimensionArray; } - + /** * @param $value * @return float From 039c662d5dd2cf4c2bd5e05978da160a9b51c9bc Mon Sep 17 00:00:00 2001 From: Marvin Besselsen Date: Thu, 20 Jun 2024 16:09:52 +0200 Subject: [PATCH 5/5] Version bump --- composer.json | 2 +- etc/config.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 77cd732..d18618c 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "paazl/magento2-checkout-widget", "description": "Paazl checkoutWidget for Magento 2", "type": "magento2-module", - "version": "1.16.1", + "version": "1.17.0", "keywords": [ "Paazl", "Magento 2", diff --git a/etc/config.xml b/etc/config.xml index 0ac17d8..1da38ad 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -8,7 +8,7 @@ - v1.16.1 + v1.17.0 0 0 0