diff --git a/README.md b/README.md index 2fd9cfbe..3a7e73e0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [Návod v češtině](#modul-pro-prestashop-17) -# Module for PrestaShop 1.7 +# Module for PrestaShop 1.7, PrestaShop 8 ### Download link [Download the latest version](https://github.com/Zasilkovna/prestashop/releases/latest) @@ -75,7 +75,7 @@ In the **Orders** tab you will find a list of all orders for which the Packeta s - english ### Supported versions -- PrestaShop version 1.7.x. +- PrestaShop 1.7.x., PrestaShop 8 - If you have problems using the module, please contact us at [e-commerce.support@packeta.com](mailto:e-commerce.support@packeta.com). ### Provided functions @@ -102,12 +102,12 @@ Packeta module may not work with another OPC module. | Module version | Branch | PHP version | |----------------|----------|-------------| | `>= 2.1.18` | `master` | 5.6 - 8.2 | -| `>= 3.0` | `v3.0.0` | 5.6 - 8.2 | +| `>= 3.0` | `v3` | 5.6 - 8.2 | ### Further module limitations - Module does not currently support multistore. -# Modul pro PrestaShop 1.7 +# Modul pro PrestaShop 1.7, PrestaShop 8 ### Stažení modulu [Aktuální verze (Stáhnout »)](https://github.com/Zasilkovna/prestashop/releases/latest) @@ -185,7 +185,7 @@ V záložce **objednávky** naleznete seznam všech objednávek u kterých byla - angličtina ### Podporovaná verze -- PrestaShop verze 1.7.x. +- PrestaShop 1.7.x., PrestaShop 8 - Při problému s použitím modulu nás kontaktujte na adrese [e-commerce.support@packeta.com](mailto:e-commerce.support@packeta.com). ### Poskytované funkce @@ -211,7 +211,7 @@ Modul Zásilkovny nemusí být s jiným OPC modulem funkční. | Verze modulu | Větev | PHP verze | |--------------|----------|-----------| | `>= 2.1.18` | `master` | 5.6 - 8.2 | -| `>= 3.0` | `v3.0.0` | 5.6 - 8.2 | +| `>= 3.0` | `v3` | 5.6 - 8.2 | ### Další omezení modulu - Modul v současné době nepodporuje multistore. diff --git a/packetery/CHANGE_LOG.txt b/packetery/CHANGE_LOG.txt index 32de4d1f..fab6c5f9 100755 --- a/packetery/CHANGE_LOG.txt +++ b/packetery/CHANGE_LOG.txt @@ -1,3 +1,4 @@ +2.1.19 - Fixed: displaying the widget button and cart validation 2.1.18 - Updated: compatibility with PrestaShop 8 ensured 2.1.17 - Updated: sk "Is COD" translation update - Updated: improvements to the display of widget button in the cart diff --git a/packetery/libs/Module/Helper.php b/packetery/libs/Module/Helper.php new file mode 100644 index 00000000..14727841 --- /dev/null +++ b/packetery/libs/Module/Helper.php @@ -0,0 +1,48 @@ += -PHP_INT_MAX) { + return (int)$value == $value; + } + + return false; + } + + return false; + } + + /** + * @param array $array + * + * @return array + */ + public static function typeCastableArrayItemsAsInts(array $array) + { + foreach ($array as $key => $value) { + if (self::isCastableToInt($value)) { + $array[$key] = (int)$value; + } + } + + return $array; + } + +} diff --git a/packetery/packetery.php b/packetery/packetery.php index 20cc9596..dd5fc3fa 100755 --- a/packetery/packetery.php +++ b/packetery/packetery.php @@ -64,7 +64,7 @@ public function __construct() { $this->name = 'packetery'; $this->tab = 'shipping_logistics'; - $this->version = '2.1.18'; + $this->version = '2.1.19'; $this->author = 'Packeta s.r.o.'; $this->need_instance = 0; $this->is_configurable = 1; @@ -568,8 +568,11 @@ public function hookDisplayCarrierExtraContent($params) ); if (!$zPointCarriers) { $zPointCarriers = []; + } else { + $zPointCarriers = array_column($zPointCarriers, 'id_carrier'); + $zPointCarriers = Packetery\Module\Helper::typeCastableArrayItemsAsInts($zPointCarriers); } - $zPointCarriersIdsJSON = json_encode(array_column($zPointCarriers, 'id_carrier')); + $zPointCarriersIdsJSON = json_encode($zPointCarriers); $this->context->smarty->assign('zpoint_carriers', $zPointCarriersIdsJSON); $name_branch = ''; $currency_branch = ''; diff --git a/packetery/views/js/front.js b/packetery/views/js/front.js index a1b06af8..6234ef0f 100755 --- a/packetery/views/js/front.js +++ b/packetery/views/js/front.js @@ -266,10 +266,10 @@ tools = { } if ($extra.find('#open-packeta-widget').length) { - var carrierId = String($extra.find('#carrier_id').val()); + var carrierId = parseInt($extra.find('#carrier_id').val()); var zpointCarriers = $extra.find('#zpoint_carriers').val(); zpointCarriers = JSON.parse(zpointCarriers); - if (!zpointCarriers.includes(parseInt(carrierId))) { + if (!zpointCarriers.includes(carrierId)) { $extra.find('#open-packeta-widget').hide(); $extra.find('#selected-branch').hide(); }