diff --git a/.env-dist b/.env-dist new file mode 100644 index 0000000..1e22668 --- /dev/null +++ b/.env-dist @@ -0,0 +1,15 @@ +# OpenCart Database connection values +OC_DB_HOSTNAME=host +OC_DB_USERNAME=user +OC_DB_PASSWORD=pass +OC_DB_DATABASE=database +OC_DB_DRIVER=mysqli + +# OpenCart Administration user +OC_USERNAME=admin +OC_PASSWORD=admin +OC_EMAIL=you@example.com + +# Server Specification +SERVER_PORT=8000 +SERVER_URL=http://localhost diff --git a/CHANGELOG.md b/CHANGELOG.md index 99656b5..95eea3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## v.3.1.4 +* Исправлена некорректная склейка типов доставки + ## v.3.1.3 * Добавлена активация модуля в маркетплейсе retailCRM diff --git a/VERSION b/VERSION index ff365e0..0aec50e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.1.3 +3.1.4 diff --git a/src/upload/catalog/controller/api/retailcrm.php b/src/upload/catalog/controller/api/retailcrm.php index 6512dd5..cf2716c 100644 --- a/src/upload/catalog/controller/api/retailcrm.php +++ b/src/upload/catalog/controller/api/retailcrm.php @@ -1,6 +1,6 @@ load->library('retailcrm/retailcrm'); $moduleTitle = $this->retailcrm->getModuleTitle(); $setting = $this->model_setting_setting->getSetting($moduleTitle); - $response = array(); if (isset($setting[$moduleTitle . '_country']) && $setting[$moduleTitle . '_country']) { foreach ($setting[$moduleTitle . '_country'] as $country) { - $response = array_merge($response, $this->getDeliveryTypesByZones($country)); + $response = $this->mergeDeliveryTypes($country); } } } @@ -60,7 +59,7 @@ class ControllerApiRetailcrm extends Controller } protected function getDeliveryTypesByZones($country_id) - { + { $this->loadModels(); $this->load->model('localisation/zone'); $this->load->model('localisation/country'); @@ -80,7 +79,7 @@ class ControllerApiRetailcrm extends Controller 'postcode' => '', 'city' => '' ); - + foreach ($shippingModules as $shippingModule) { $this->load->model('extension/shipping/' . $shippingModule['code']); @@ -98,7 +97,7 @@ class ControllerApiRetailcrm extends Controller $this->config->set('free_total', 0); } } - + if ($this->{'model_extension_shipping_' . $shippingModule['code']}->getQuote($address)) { $quote_data[] = $this->{'model_extension_shipping_' . $shippingModule['code']}->getQuote($address); } else { @@ -131,6 +130,21 @@ class ControllerApiRetailcrm extends Controller return $deliveryTypes; } + private function mergeDeliveryTypes($country) { + $result = array(); + $delivery_types = $this->getDeliveryTypesByZones($country); + + foreach ($delivery_types as $shipping_module => $shipping_type) { + if (isset($result[$shipping_module])) { + $result[$shipping_module] = array_merge($result[$shipping_module], $shipping_type); + } else { + $result[$shipping_module] = $shipping_type; + } + } + + return $result; + } + private function auth() { if (!isset($this->request->get['key'])