From 7dda2527fab8f0c316fadf2c449d1c38004f50bd Mon Sep 17 00:00:00 2001 From: Marvin-Magmodules Date: Tue, 14 Sep 2021 15:43:40 +0200 Subject: [PATCH 1/4] Fixes import of customers on order import --- Model/Order.php | 2 +- Service/Order/AddressData.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Model/Order.php b/Model/Order.php index c5a614a..1894025 100644 --- a/Model/Order.php +++ b/Model/Order.php @@ -388,7 +388,7 @@ private function setCustomerCart($cart, $store, $data) $customerId = $customer->getId(); } $customer = $this->customerRepository->getById($customerId); - $cart->assignCustomer($customer); + $cart->setCustomerIsGuest(false)->assignCustomer($customer); } else { $customerId = 0; $cart->setCustomerId($customerId) diff --git a/Service/Order/AddressData.php b/Service/Order/AddressData.php index fdb0dac..e929cd3 100644 --- a/Service/Order/AddressData.php +++ b/Service/Order/AddressData.php @@ -161,7 +161,7 @@ private function saveAddress($addressData, $customerId, $type) ->setFirstname($addressData['firstname']) ->setMiddlename($addressData['middlename']) ->setLastname($addressData['lastname']) - ->setStreet($addressData['street']) + ->setStreet(explode("\n", $addressData['street'])) ->setCity($addressData['city']) ->setCountryId($addressData['country_id']) ->setRegionId($addressData['region']) From 75940b063a0861b627f03fe57715fce03e68e25b Mon Sep 17 00:00:00 2001 From: Marvin-Magmodules Date: Tue, 14 Sep 2021 15:45:35 +0200 Subject: [PATCH 2/4] Fixes missing currency code in feed --- Helper/Product.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Helper/Product.php b/Helper/Product.php index 77c3c19..d7b7fd9 100644 --- a/Helper/Product.php +++ b/Helper/Product.php @@ -897,9 +897,9 @@ public function getPriceCollection($config, $product) break; default: if (floatval($product->getFinalPrice()) !== 0) { - $price = $this->processPrice($product, $product->getPrice(), $config); - $finalPrice = $this->processPrice($product, $product->getFinalPrice(), $config); - $specialPrice = $this->processPrice($product, $product->getSpecialPrice(), $config); + $price = $product->getPrice(); + $finalPrice = $product->getFinalPrice(); + $specialPrice = $product->getSpecialPrice(); } else { $finalPrice = $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue(); $price = $product->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue(); @@ -920,7 +920,6 @@ public function getPriceCollection($config, $product) break; } - $prices = []; $config = $config['price_config']; $prices[$config['price']] = $this->processPrice($product, $price, $config); @@ -1022,12 +1021,11 @@ public function getGroupedPrices($product, $config) */ public function processPrice($product, $price, $config) { - if (!empty($config['price_config']['exchange_rate'])) { - $price = $price * $config['price_config']['exchange_rate']; + if (!empty($config['exchange_rate'])) { + $price = $price * $config['exchange_rate']; } - - if (isset($config['price_config']['incl_vat'])) { - $price = $this->catalogHelper->getTaxPrice($product, $price, $config['price_config']['incl_vat']); + if (isset($config['incl_vat'])) { + $price = $this->catalogHelper->getTaxPrice($product, $price, ['incl_vat']); } return $this->formatPrice($price, $config); @@ -1041,10 +1039,10 @@ public function processPrice($product, $price, $config) */ public function formatPrice($price, $config) { - $decimal = isset($config['price_config']['decimal_point']) ? $config['price_config']['decimal_point'] : '.'; + $decimal = isset($config['decimal_point']) ? $config['decimal_point'] : '.'; $price = number_format(floatval(str_replace(',', '.', $price)), 2, $decimal, ''); - if (!empty($config['price_config']['use_currency']) && ($price >= 0)) { - $price .= ' ' . $config['price_config']['currency']; + if (!empty($config['use_currency']) && ($price >= 0)) { + $price .= ' ' . $config['currency']; } return $price; } From a608b7b0be7451ead139d14a9120d424063598e3 Mon Sep 17 00:00:00 2001 From: Marvin-Magmodules Date: Tue, 14 Sep 2021 15:46:41 +0200 Subject: [PATCH 3/4] Always save/show commission on order import --- Model/Order.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Model/Order.php b/Model/Order.php index 1894025..9ea104c 100644 --- a/Model/Order.php +++ b/Model/Order.php @@ -522,6 +522,8 @@ private function getShippingDescription($order, $data) /** * @param OrderModel $order * @param array $data + * + * @throws \Magento\Framework\Exception\LocalizedException */ private function addPaymentData($order, $data) { @@ -536,10 +538,9 @@ private function addPaymentData($order, $data) $order->setChannelId($data['channel_id']); } - if (!empty($data['price']['commission'])) { - $commission = $data['price']['currency'] . ' ' . $data['price']['commission']; - $payment->setAdditionalInformation('commission', $commission); - } + $commissionValue = isset($data['price']['commission']) ? $data['price']['commission'] : 0; + $commission = $data['price']['currency'] . ' ' . $commissionValue; + $payment->setAdditionalInformation('commission', $commission); if (!empty($data['channel_name'])) { if ($this->lvb) { From 45988ef9429bcb290f78e14a14632b601dae8a7d Mon Sep 17 00:00:00 2001 From: Marvin-Magmodules Date: Tue, 14 Sep 2021 15:47:06 +0200 Subject: [PATCH 4/4] 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 bc5023a..7791ff8 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "magmodules/magento2-channable", "description": "Channable integration for Magento 2", "type": "magento2-module", - "version": "1.5.3", + "version": "1.5.4", "license": "BSD-2-Clause", "homepage": "https://github.com/magmodules/magento2-channable", "require": { diff --git a/etc/config.xml b/etc/config.xml index 98d077d..2cd45c8 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -12,7 +12,7 @@ 0 250 - v1.5.3 + v1.5.4 name