From 5cb7afaaaefd1817aa414ab3012ec1129ada5abc Mon Sep 17 00:00:00 2001 From: Fabrice Creuzot Date: Mon, 8 Aug 2022 20:00:00 +0000 Subject: [PATCH] Version 2.4.1 --- README.md | 6 +-- .../Kyrena/Shippingmax/Model/Carrier.php | 5 +- .../Model/Carrier/Colisprivpts.php | 4 +- .../Model/Carrier/Mondialrelay.php | 8 +-- .../Kyrena/Shippingmax/Model/Rewrite/Rate.php | 12 ++--- .../Kyrena/Shippingmax/etc/config.xml | 4 +- .../css/kyrena/shippingmax/map.min.css | 2 +- .../css/kyrena/shippingmax/map.min.css.map | 2 +- .../default/css/kyrena/shippingmax/map.scss | 52 ++++++++----------- .../base/default/js/kyrena/shippingmax/map.js | 26 +++++----- .../default/js/kyrena/shippingmax/map.min.js | 2 +- .../js/kyrena/shippingmax/map.min.js.map | 2 +- 12 files changed, 59 insertions(+), 66 deletions(-) diff --git a/README.md b/README.md index b3a222d..b4917fe 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ Demo links may not work, don't panic, it's not a bug. | **Store delivery** | | [online demo](https://cellu.blue/OmRX8p): 07200, Aubenas, FR
source of data: a TSV file | | **Store locator** | | [online demo](https://cellu.blue/h9dhKJ)
source of data: a TSV file | -Do you want more? Contact us, perhaps we can work together to add new methods! +Do you want more? Contact us, perhaps we can work together to add new methods! For example: Colissimo, Relais Colis, Swiss Post... ## Customization @@ -95,7 +95,7 @@ To display delivery times, you must edit your template with: ## Copyright and Credits -- Current version: 2.4.0 (07/07/2022) +- Current version: 2.4.1 (08/08/2022) - Compatibility: OpenMage 19.x / 20.x / 21.x, PHP 7.2 / 7.3 / 7.4 / 8.0 / 8.1 - Client compatibility: Firefox 36+, Chrome 32+, Opera 19+, Edge 16+, Safari 9+ - Translations: English (en), French (fr-FR/fr-CA), German (de), Italian (it), Portuguese (pt-PT/pt-BR), Spanish (es) / Chinese (zh), Czech (cs), Dutch (nl), Greek (el), Hungarian (hu), Japanese (ja), Polish (pl), Romanian (ro), Russian (ru), Slovak (sk), Turkish (tr), Ukrainian (uk) @@ -107,7 +107,7 @@ If you like, take some of your time to improve the translations, go to https://b Warning: there are two packages, one that contains a lite and modified version (without jquery/editor/phpparser/doc) of owebia/shipping ([kyrena/openmage-shippingmax](https://github.com/kyrena/openmage-shippingmax)), and another one without owebia/shipping ([kyrena/openmage-shippingmax-alone](https://github.com/kyrena/openmage-shippingmax-alone)). -#### For kyrena/openmage-shippingmax) +#### For kyrena/openmage-shippingmax With composer: - `composer remove owebia/magento1-module-advanced-shipping` diff --git a/src/app/code/community/Kyrena/Shippingmax/Model/Carrier.php b/src/app/code/community/Kyrena/Shippingmax/Model/Carrier.php index 2f51cc9..772b8ee 100644 --- a/src/app/code/community/Kyrena/Shippingmax/Model/Carrier.php +++ b/src/app/code/community/Kyrena/Shippingmax/Model/Carrier.php @@ -1,7 +1,7 @@ * Copyright 2019-2022 | Jérôme Siau @@ -235,7 +235,8 @@ public function loadItemsFromCache(object $address, bool $dataOnly = false) { // filtre les points relais if (!empty($items) && !$this->_postcodesOnly) { foreach ($items as $key => &$item) { - if (empty($item['id']) || !$this->checkItem($address, $item)) + // conserve uniquement les relais du même pays que l'adresse + if (empty($item['id']) || (($this->_code != 'shippingmax_storelocator') && ($item['country_id'] != $address->getData('country_id'))) || !$this->checkItem($address, $item)) unset($items[$key]); } unset($item); diff --git a/src/app/code/community/Kyrena/Shippingmax/Model/Carrier/Colisprivpts.php b/src/app/code/community/Kyrena/Shippingmax/Model/Carrier/Colisprivpts.php index 1f49ca0..326dba1 100644 --- a/src/app/code/community/Kyrena/Shippingmax/Model/Carrier/Colisprivpts.php +++ b/src/app/code/community/Kyrena/Shippingmax/Model/Carrier/Colisprivpts.php @@ -1,7 +1,7 @@ * Copyright 2019-2022 | Jérôme Siau @@ -89,7 +89,7 @@ public function loadItemsFromApi(object $address) { 'postcode' => $data['CODE_POSTAL'], 'city' => $data['VILLE'], 'country_id' => $data['PAYS'], - 'description' => $this->createDescCurl($data) + 'description' => $this->createDescCurl($data), ]; } } diff --git a/src/app/code/community/Kyrena/Shippingmax/Model/Carrier/Mondialrelay.php b/src/app/code/community/Kyrena/Shippingmax/Model/Carrier/Mondialrelay.php index 1983941..33f38e0 100644 --- a/src/app/code/community/Kyrena/Shippingmax/Model/Carrier/Mondialrelay.php +++ b/src/app/code/community/Kyrena/Shippingmax/Model/Carrier/Mondialrelay.php @@ -1,7 +1,7 @@ * Copyright 2019-2022 | Jérôme Siau @@ -31,7 +31,7 @@ public function loadItemsFromApi(object $address, bool $ignoreLatLng = false) { try { // https://www.mondialrelay.fr/solutionspro/documentation-technique/cahier-des-charges-informatiques/ - // https://www.mondialrelay.fr/media/108937/Solution-Web-Service-V5.6.pdf + // https://www.mondialrelay.fr/media/123560/solution-web-service-v58.pdf $client = new SoapClient($this->getConfigData('api_url'), ['trace' => 1]); $params = [ 'Enseigne' => $this->getConfigData('api_username'), @@ -39,7 +39,7 @@ public function loadItemsFromApi(object $address, bool $ignoreLatLng = false) { 'CP' => trim(is_numeric($address->getData('city')) ? $address->getData('city') : $address->getData('postcode')), 'Latitude' => number_format(round($address->getData('lat'), 11), 6), 'Longitude' => number_format(round($address->getData('lng'), 11), 6), - 'RayonRecherche' => $this->getConfigData('dst_search') + 'RayonRecherche' => $this->getConfigData('dst_search'), ]; // géolocalisation navigateur ou coordonnées nominatim @@ -87,7 +87,7 @@ public function loadItemsFromApi(object $address, bool $ignoreLatLng = false) { 'city' => $result->Ville, 'country_id' => $result->Pays, 'description' => $this->createDesc($result), - 'dst' => round($result->Distance / 1000, 1) + 'dst' => round($result->Distance / 1000, 1), ]; } } diff --git a/src/app/code/community/Kyrena/Shippingmax/Model/Rewrite/Rate.php b/src/app/code/community/Kyrena/Shippingmax/Model/Rewrite/Rate.php index 8e61567..9349184 100644 --- a/src/app/code/community/Kyrena/Shippingmax/Model/Rewrite/Rate.php +++ b/src/app/code/community/Kyrena/Shippingmax/Model/Rewrite/Rate.php @@ -1,7 +1,7 @@ * Copyright 2019-2022 | Jérôme Siau @@ -35,12 +35,6 @@ public function getIterator() { foreach ($this->_items as $item) { - if (!empty($group)) { - $keys = array_filter(explode(',', Mage::getStoreConfig('carriers/'.$item->getData('carrier').'/show_for_customer_group'))); - if (!empty($keys) && !in_array($group, $keys)) - $item->isDeleted(true); - } - $keys = array_filter(explode(',', Mage::getStoreConfig('carriers/'.$item->getData('carrier').'/hide_when'))); if (!empty($keys)) { foreach ($keys as $key) { @@ -48,6 +42,10 @@ public function getIterator() { $item->isDeleted(true); } } + + $keys = array_filter(explode(',', Mage::getStoreConfig('carriers/'.$item->getData('carrier').'/show_for_customer_group'))); + if (!empty($keys) && (empty($group) || !in_array($group, $keys))) + $item->isDeleted(true); } return new ArrayIterator($this->_items); diff --git a/src/app/code/community/Kyrena/Shippingmax/etc/config.xml b/src/app/code/community/Kyrena/Shippingmax/etc/config.xml index 3cd7eb8..f721545 100644 --- a/src/app/code/community/Kyrena/Shippingmax/etc/config.xml +++ b/src/app/code/community/Kyrena/Shippingmax/etc/config.xml @@ -1,7 +1,7 @@