diff --git a/CHANGELOG.md b/CHANGELOG.md index e3174c6..0f89ff9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). ## Released +## [1.3.7](https://github.com/kabisa/wuunder-webshopplugin-prestashop/releases/tag/1.3.7) + +### Fixed +- Checkout JS ver 1.6 + + ## [1.3.6](https://github.com/kabisa/wuunder-webshopplugin-prestashop/releases/tag/1.3.6) ### Fixed diff --git a/wuunderconnector/config.xml b/wuunderconnector/config.xml index e8f56bf..edf637d 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 00d6726..18039eb 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.3.6", "plugin" => "1.0")); + $this->sourceObj = array("product" => "Prestashop extension", "version" => array("build" => "1.3.7", "plugin" => "1.0")); } private function setBookingToken($order_id, $booking_url, $booking_token) diff --git a/wuunderconnector/views/js/hook/checkoutjavascript1.6.js b/wuunderconnector/views/js/hook/checkoutjavascript1.6.js index 050192b..b06a0d2 100644 --- a/wuunderconnector/views/js/hook/checkoutjavascript1.6.js +++ b/wuunderconnector/views/js/hook/checkoutjavascript1.6.js @@ -16,15 +16,22 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - // Get the modal +// Get the modal $(window).on("load", function() { // Get the modal var selectParcelshopLink = ''; - var parcelshopShippingMethodElem = jQuery('[value="' + shippingCarrierId + ',"].delivery_option_radio'); + var parcelshopShippingMethodElemRadio = jQuery('[value="' + shippingCarrierId + ',"].delivery_option_radio'); + if (parcelshopShippingMethodElemRadio.length > 0){ + var parcelshopDescriptionElem = jQuery('[value="' + shippingCarrierId + ',"].delivery_option_radio').parents()[3].children[2]; + } var shippingMethodElems = jQuery('input.delivery_option_radio'); var shippingAddress; var getAddressUrl = "index.php?fc=module&module=wuunderconnector&controller=parcelshop&getAddress=1"; var setParcelshopId = "index.php?fc=module&module=wuunderconnector&controller=parcelshop&setParcelshopId=1"; + var container = document.createElement('div'); + container.className += "chooseParcelshop"; + container.innerHTML = selectParcelshopLink; + initParcelshopLocator(baseUrl, baseApiUrl, availableCarriers); @@ -34,32 +41,26 @@ $(window).on("load", function() { availableCarrierList = carrierList; parcelshopAddress = _markupParcelshopAddress(parcelshopAddress); - jQuery('.delivery_options').append('
'); - if (parcelshopShippingMethodElem) { - //parcelshopShippingMethodElem.onchange = _onShippingMethodChange; + if (parcelshopShippingMethodElemRadio) { + parcelshopShippingMethodElemRadio.onchange = _onShippingMethodChange; if (parcelshopAddress !== "") { parcelshopId = "{/literal}{$cookieParcelshopId}{literal}"; } - //jQuery(shippingMethodElems).change(_onShippingMethodChange); - jQuery(shippingMethodElems).on('change', _onShippingMethodChange); + jQuery(shippingMethodElems).change(_onShippingMethodChange); _onShippingMethodChange(); } } function _onShippingMethodChange() { - if (parcelshopShippingMethodElem.is(':checked')) { - var container = document.createElement('div'); - container.className += "chooseParcelshop"; - container.innerHTML = selectParcelshopLink; - // window.parent.document.getElementsByClassName('shipping')[0].appendChild(container); - jQuery(jQuery('[value="' + shippingCarrierId + ',"].delivery_option_radio')).parentsUntil('#form > div > div.delivery_options_address > div.delivery_options > div:nth-child(1)').last().append(container); + if ($("#parcelshopsSelectedContainer16").is(":hidden") && parcelshopShippingMethodElemRadio.is(':checked')) { + $("#parcelshopsSelectedContainer16").show(); + } else if (parcelshopShippingMethodElemRadio.is(':checked')) { + parcelshopLink = parcelshopShippingMethodElemRadio.parents()[4].append(container); + parcelshopDescriptionElem.append(container); jQuery("#selectParcelshop").on('click',_showParcelshopLocator); _printParcelshopAddress(); + } else { - var containerElems = window.parent.document.getElementsByClassName('chooseParcelshop'); - if (containerElems.length) { - containerElems[0].remove(); - } - } + $("#parcelshopsSelectedContainer16").hide(); } } // add selected parcelshop to page function _printParcelshopAddress() { diff --git a/wuunderconnector/wuunderconnector.php b/wuunderconnector/wuunderconnector.php index 1943ec3..dedfb03 100644 --- a/wuunderconnector/wuunderconnector.php +++ b/wuunderconnector/wuunderconnector.php @@ -52,7 +52,7 @@ public function __construct() $this->name = 'wuunderconnector'; $this->tab = 'shipping_logistics'; - $this->version = '1.3.6'; + $this->version = '1.3.7'; $this->author = 'Wuunder'; $this->need_instance = 0;