diff --git a/dpdbaltics.php b/dpdbaltics.php index 2c13039f..12f757b1 100644 --- a/dpdbaltics.php +++ b/dpdbaltics.php @@ -214,6 +214,12 @@ public function hookActionFrontControllerSetMedia() 'priority' => 130 ] ); + + Media::addJsDef([ + 'dpdbaltics' => [ + 'isOnePageCheckout' => $opcModuleCompatibilityValidator->isOpcModuleInUse() + ] + ]); } /** @var \Invertus\dpdBaltics\Provider\CurrentCountryProvider $currentCountryProvider */ @@ -272,7 +278,7 @@ public function hookActionFrontControllerSetMedia() 'dpdLockerMarkerPath' => $this->getPathUri() . 'views/img/locker.png', 'dpdHookAjaxUrl' => $this->context->link->getModuleLink($this->name, 'Ajax'), 'pudoSelectSuccess' => $this->l('Pick-up point selected'), - 'dpd_carrier_ids' => $carrierIds + 'dpd_carrier_ids' => $carrierIds, ]); $this->context->controller->registerStylesheet( diff --git a/src/Validate/Compatibility/index.php b/src/Validate/Compatibility/index.php index 15aba820..74851d77 100644 --- a/src/Validate/Compatibility/index.php +++ b/src/Validate/Compatibility/index.php @@ -1,4 +1,23 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ + header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); diff --git a/views/css/front/onepagecheckout.css b/views/css/front/onepagecheckout.css index 8e61beba..5de29d0c 100644 --- a/views/css/front/onepagecheckout.css +++ b/views/css/front/onepagecheckout.css @@ -37,4 +37,33 @@ .dpd-services-block .list-inline-item { min-width: 370px; +} + +.carrier-extra-content { + display: flex; + flex-direction: column; + padding: 10px 5px; +} + +.dpd-phone-block { + padding-bottom: 0; +} + +.chosen-container { + width: 100% !important; + max-width: 290px; +} + +.carrier-extra-content .chosen-select { + min-height: 49px; + height: 100%; +} + +.dpd-checkout-delivery-time--container { + width: 100%; +} + +.search-block-container { + padding-left: 15px; + padding-right: 15px; } \ No newline at end of file diff --git a/views/css/front/order-input.css b/views/css/front/order-input.css index 9cc1ef45..3e4d9902 100644 --- a/views/css/front/order-input.css +++ b/views/css/front/order-input.css @@ -19,7 +19,7 @@ This file is generated by `grunt build`, do not edit it by hand. -moz-user-select: none; -ms-user-select: none; user-select: none; - width: 100% !important; + width: 100%; max-width: 100%; } @@ -84,7 +84,7 @@ This file is generated by `grunt build`, do not edit it by hand. margin: 1px 0; padding: 4px 20px 4px 5px; width: 100%; - height: auto; + height: 49px; outline: 0; border: 1px solid #aaa; background: url("../../img/dpd-chosen-front.png") no-repeat 100% -20px; @@ -178,11 +178,12 @@ This file is generated by `grunt build`, do not edit it by hand. margin-right: 20px; text-overflow: ellipsis; white-space: nowrap; - padding: 13px 0; + padding: 16px 0; } .chosen-container-single a.chosen-single { - height: auto; + min-height: 49px; + height: 100%; } .chosen-container-single .chosen-single div { @@ -203,7 +204,7 @@ div.form-control-chosen:focus-within { .css-dpd-phone-prefix .chosen-single:before { content: '+'; position: absolute; - transform: translate(-12px, 12px); + transform: translate(-12px, 16px); } .dpd-input-wrapper .form-control, diff --git a/views/css/front/pudo-shipment.css b/views/css/front/pudo-shipment.css index 30d25df0..be2c6e7e 100644 --- a/views/css/front/pudo-shipment.css +++ b/views/css/front/pudo-shipment.css @@ -123,7 +123,7 @@ .phone-block-hr, .delivery-time-hr { - padding-bottom: 2rem; + padding-bottom: 0; } @@ -244,3 +244,7 @@ a.chosen-single:hover { width: 100%; } +.dpd-delivery-time-block { + margin-top: 1rem; +} + diff --git a/views/js/front/order-opc.js b/views/js/front/order-opc.js index fe3065d3..5589e21c 100644 --- a/views/js/front/order-opc.js +++ b/views/js/front/order-opc.js @@ -17,6 +17,12 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ var isPudoPointSelected = false; +var phoneQuerySelectors = [ + '#checkout #delivery-address [name="phone"]', + '.address-fields input[name="phone"]', + '#checkout [name="delivery_phone_mobile"]' +]; + $(document).ready(function (){ $(document).on('change', '.dpd-phone-block', function() { @@ -51,9 +57,19 @@ function handlePhoneNumber(selector) if (!$('.dpd-phone-block')) { return true; } + var phone = selector.find('input[name="dpd-phone"]').val(); var phoneArea = selector.find('select[name="dpd-phone-area"] option:selected').val(); + // if empty then take it from opc phone field + if (phone === '') { + phoneQuerySelectors.forEach(function (phoneSelector) { + if ($(phoneSelector).val()) { + phone = $(phoneSelector).val(); + } + }); + } + if (currentController === 'supercheckout') { saveSelectedPhoneNumberSuperCheckout(phone, phoneArea) } else { @@ -95,8 +111,10 @@ function DPDdisplayMessageOpc(parent, template) { // Module "onepagecheckoutps" compatibility $(document).on('opc-load-review:completed', function() { - $('.delivery-option.selected .carrier-extra-content').show(); handlePhoneNumber($('.dpd-phone-block')); }); - +// Then address is being modified +$(document).on('thecheckout_Address_Modified', function () { + handlePhoneNumber($('.dpd-phone-block')); +}); diff --git a/views/js/front/pudo.js b/views/js/front/pudo.js index e1137f44..b7d0debf 100644 --- a/views/js/front/pudo.js +++ b/views/js/front/pudo.js @@ -108,7 +108,7 @@ $(document).ready(function () { } //Js to open extra content failed from theme, doing it manually. - if (params.deliveryOption.length > 0 && !$(params.deliveryOption).next('.carrier-extra-content').is(':visible')) { + if (params.deliveryOption.length > 0 && !$(params.deliveryOption).next('.carrier-extra-content').is(':visible') && !dpdbaltics.isOnePageCheckout) { $('.carrier-extra-content').hide(); $(params.deliveryOption).next('.carrier-extra-content').slideDown(); } diff --git a/views/templates/hook/front/carrier-delivery-time.tpl b/views/templates/hook/front/carrier-delivery-time.tpl index f166f8dd..ed02d79a 100644 --- a/views/templates/hook/front/carrier-delivery-time.tpl +++ b/views/templates/hook/front/carrier-delivery-time.tpl @@ -18,9 +18,9 @@ *}
{l s='Desirable delivery time' mod='dpdbaltics'}