From 1568783e9fa135ab29b595c59e963e1973c2e5f9 Mon Sep 17 00:00:00 2001 From: gleemand Date: Thu, 9 Jun 2022 13:21:53 +0300 Subject: [PATCH] Added default country when creating order and fixed ICML generation --- retailcrm/lib/RetailcrmCatalog.php | 7 +++++-- retailcrm/lib/RetailcrmCustomerAddressBuilder.php | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/retailcrm/lib/RetailcrmCatalog.php b/retailcrm/lib/RetailcrmCatalog.php index d79b538..63f8820 100644 --- a/retailcrm/lib/RetailcrmCatalog.php +++ b/retailcrm/lib/RetailcrmCatalog.php @@ -236,8 +236,11 @@ class RetailcrmCatalog if (!$pictures) { $image = Image::getCover($product['id_product']); - $picture = $this->protocol . $this->link->getImageLink($product['link_rewrite'], $image['id_image'], 'large_default'); - $pictures[] = $picture; + + if (isset($image['id_image'])) { + $picture = $this->protocol . $this->link->getImageLink($product['link_rewrite'], $image['id_image'], 'large_default'); + $pictures[] = $picture; + } } if ('1.3' == $this->version) { diff --git a/retailcrm/lib/RetailcrmCustomerAddressBuilder.php b/retailcrm/lib/RetailcrmCustomerAddressBuilder.php index d2433da..39b5f91 100644 --- a/retailcrm/lib/RetailcrmCustomerAddressBuilder.php +++ b/retailcrm/lib/RetailcrmCustomerAddressBuilder.php @@ -180,6 +180,7 @@ class RetailcrmCustomerAddressBuilder extends RetailcrmAbstractBuilder implement { if (empty($this->customerAddress)) { $this->customerAddress = new Address(); + $this->setAddressField('id_country', Configuration::get('PS_COUNTRY_DEFAULT')); } $this->customerAddress->id_customer = $this->idCustomer; @@ -197,6 +198,7 @@ class RetailcrmCustomerAddressBuilder extends RetailcrmAbstractBuilder implement if (array_key_exists('countryIso', $this->dataCrm)) { $countryIso = null; + if (Validate::isLanguageIsoCode($this->dataCrm['countryIso'])) { $countryIso = Country::getByIso($this->dataCrm['countryIso']); }