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 4366be8..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) @@ -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); 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');