0
_scopeConfig->getValue( 'contact/checkout/status', \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); $states = $this->_scopeConfig->getValue( 'contact/checkout/states', \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); $states = explode(',', $states); $config['active'] = $isActive; // echo $config['active'];die; $config['states'] = $states; $config['email'] = $this->_scopeConfig->getValue( 'contact/checkout/fb_email', \Magento\Store\Model\ScopeInterface::SCOPE_STORE );
    return $config;
}
} window.checkoutConfig.shippingOptions = getContactStateConfigurations())?>

js define([ 'jquery', 'mage/utils/wrapper', 'Magento_Ui/js/modal/modal' ], function ($, wrapper, modal) { 'use strict'; $(document).ready(function () { $(document).on('change', '[name="region_id"]', function() { var $this = $(this); if(!window.checkoutConfig.shippingOptions.active) { return true; } var selectedValue = $(this).val(); var contactStates = window.checkoutConfig.shippingOptions.states;

        if(!!contactStates) {
            if(contactStates.indexOf(selectedValue) > -1) {
                var contactEmail = window.checkoutConfig.shippingOptions.email;
                var options = {
                    type: 'popup',
                    responsive: true,
                    innerScroll: true,
                    title: '',
                    buttons: [{
                        text: $.mage.__('Contact Us'),
                        class: 'button-contact',
                        click: function () {
                            window.location.replace('mailto:'+contactEmail);
                            this.closeModal();
                        }
                    }]
                };

                var content = 'Si eres de las Islas Canarias, Ceuta o Melilla procesaremos tu pedido personalmente. Escríbenos a ' +
                    contactEmail +
                    ' y alguien de nuestro equipo de soporte te ayudará a finalizar tu pedido';
                var modalContainer = $("#contact-state-popup");
                if (modalContainer.length) {
                    modal(options, modalContainer);
                    var $button = modalContainer.parent().next().find('button');
                    $button.css({'background':'#dc2227','border-color':'#dc2227'});
                    $button.hover(function () {
                        $(this).css('color','#fff');
                    });
                    modalContainer.modal('openModal');
                    return false;
                }

                modalContainer = $('<div>',{id:'contact-state-popup'});
                modal(options, modalContainer);
                modalContainer.html(content);
                var $button = modalContainer.parent().next().find('button');
                $button.css({'background':'#dc2227','border-color':'#dc2227'});
                $button.hover(function () {
                    $(this).css('color','#fff');
                });
                modalContainer.modal('openModal');
            }
        }
    });
});

return function (setShippingInformationAction) {
    return wrapper.wrap(setShippingInformationAction, function (originalAction) {
        return originalAction();
    });
}

});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.