From cb8f749077553b703c6f7f8398037516fcabea62 Mon Sep 17 00:00:00 2001 From: Timo Janssen Date: Fri, 14 Feb 2020 15:29:21 +0100 Subject: [PATCH 1/3] convert kgs to grams --- wuunderconnector/controllers/admin/AdminWuunderConnector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wuunderconnector/controllers/admin/AdminWuunderConnector.php b/wuunderconnector/controllers/admin/AdminWuunderConnector.php index 4366be8..7064302 100644 --- a/wuunderconnector/controllers/admin/AdminWuunderConnector.php +++ b/wuunderconnector/controllers/admin/AdminWuunderConnector.php @@ -272,7 +272,7 @@ private function buildWuunderData($order_info) $bookingConfig->setLength($product_length); $bookingConfig->setWidth($product_width); $bookingConfig->setHeight($product_height); - $bookingConfig->setWeight((int)$order_info['weight']); + $bookingConfig->setWeight((int)$order_info['weight'] * 1000); $bookingConfig->setCustomerReference($order_info['id_order']); $bookingConfig->setPreferredServiceLevel($preferredServiceLevel); $bookingConfig->setSource($this->sourceObj); From f8468dbf278a63f2a29e50539fa63160a2909745 Mon Sep 17 00:00:00 2001 From: Timo Janssen Date: Mon, 17 Feb 2020 14:54:48 +0100 Subject: [PATCH 2/3] correct coversion float/int for weight --- wuunderconnector/controllers/admin/AdminWuunderConnector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wuunderconnector/controllers/admin/AdminWuunderConnector.php b/wuunderconnector/controllers/admin/AdminWuunderConnector.php index 7064302..c791c55 100644 --- a/wuunderconnector/controllers/admin/AdminWuunderConnector.php +++ b/wuunderconnector/controllers/admin/AdminWuunderConnector.php @@ -272,7 +272,7 @@ private function buildWuunderData($order_info) $bookingConfig->setLength($product_length); $bookingConfig->setWidth($product_width); $bookingConfig->setHeight($product_height); - $bookingConfig->setWeight((int)$order_info['weight'] * 1000); + $bookingConfig->setWeight((int)($order_info['weight'] * 1000)); $bookingConfig->setCustomerReference($order_info['id_order']); $bookingConfig->setPreferredServiceLevel($preferredServiceLevel); $bookingConfig->setSource($this->sourceObj); From 90084444430caf8bae9391f2bfaac6e5b4279bc9 Mon Sep 17 00:00:00 2001 From: Timo Janssen Date: Fri, 21 Feb 2020 13:54:35 +0100 Subject: [PATCH 3/3] Added checkout validation parcelshop --- CHANGELOG.md | 5 +++++ wuunderconnector/config.xml | 2 +- .../controllers/admin/AdminWuunderConnector.php | 2 +- wuunderconnector/wuunderconnector.php | 15 +++++++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9e5464..c3c8a4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). ## Released +## [1.3.3](https://github.com/kabisa/wuunder-webshopplugin-prestashop/releases/tag/1.3.3) + +### Added +- Validation check if a parcelshop is selected whenever the wuunder parcelshop method is used. + ## [1.3.2](https://github.com/kabisa/wuunder-webshopplugin-prestashop/releases/tag/1.3.2) ### Fixed diff --git a/wuunderconnector/config.xml b/wuunderconnector/config.xml index d31ac4c..dca0480 100644 --- a/wuunderconnector/config.xml +++ b/wuunderconnector/config.xml @@ -2,7 +2,7 @@ wuunderconnector - + diff --git a/wuunderconnector/controllers/admin/AdminWuunderConnector.php b/wuunderconnector/controllers/admin/AdminWuunderConnector.php index c791c55..63ca360 100644 --- a/wuunderconnector/controllers/admin/AdminWuunderConnector.php +++ b/wuunderconnector/controllers/admin/AdminWuunderConnector.php @@ -42,7 +42,7 @@ public function __construct() $this->logger->setFilename(_PS_ROOT_DIR_ . ((_PS_VERSION_ < '1.7') ? "/log/wuunder.log" : "/app/logs/wuunder.log")); $this->bootstrap = true; $this->override_folder = ""; - $this->sourceObj = array("product" => "Prestashop extension", "version" => array("build" => "1.2.6", "plugin" => "1.0")); + $this->sourceObj = array("product" => "Prestashop extension", "version" => array("build" => "1.3.4", "plugin" => "1.0")); } private function setBookingToken($order_id, $booking_url, $booking_token) diff --git a/wuunderconnector/wuunderconnector.php b/wuunderconnector/wuunderconnector.php index 543bb05..2735750 100644 --- a/wuunderconnector/wuunderconnector.php +++ b/wuunderconnector/wuunderconnector.php @@ -40,6 +40,7 @@ class WuunderConnector extends Module private $parcelshopcarrier; private $hooks = array( + 'actionValidateStepComplete', 'actionValidateOrder', 'displayHeader', 'displayFooter', @@ -343,6 +344,20 @@ public function hookActionValidateOrder($params) $this->context->smarty->clearAssign('cookieParcelshopId'); } + public function hookActionValidateStepComplete($params) { + if ($params['step_name'] === 'delivery') { + $carrier_id = $params['cart']->id_carrier; + if (Configuration::get('MYCARRIER1_CARRIER_ID') == $carrier_id) { + if(empty($this->context->cookie->parcelId)){ + $controller = $this->context->controller; + $controller->errors[] = $this->l('Please select a parcelshop'); + $params['completed'] = false; + } + } + } + return; + } + public function parcelshop_urls() { $tmpEnvironment = new \Wuunder\Api\Environment((int) Configuration::get('testmode') === 1 ? 'staging' : 'production');