diff --git a/.github/workflows/codesniffer.yml b/.github/workflows/codesniffer.yml index 675d9de..ca5aea8 100755 --- a/.github/workflows/codesniffer.yml +++ b/.github/workflows/codesniffer.yml @@ -13,3 +13,4 @@ jobs: --volume $(pwd)/:/app/workdir michielgerritsen/magento-coding-standard:latest --severity=6 + -s diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index fcfafed..4d7e17f 100755 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -2,27 +2,6 @@ name: Lint PHP files on: [push, pull_request] jobs: - php-71: - runs-on: ubuntu-latest - steps: - - uses: StephaneBour/actions-php-lint@7.1 - with: - dir: './' - - php-72: - runs-on: ubuntu-latest - steps: - - uses: StephaneBour/actions-php-lint@7.2 - with: - dir: './' - - php-73: - runs-on: ubuntu-latest - steps: - - uses: StephaneBour/actions-php-lint@7.3 - with: - dir: './' - php-74: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/setup-di-compile.yml b/.github/workflows/setup-di-compile.yml index b80b3dd..fd21355 100644 --- a/.github/workflows/setup-di-compile.yml +++ b/.github/workflows/setup-di-compile.yml @@ -6,14 +6,12 @@ jobs: strategy: matrix: include: - - PHP_VERSION: php71-fpm - MAGENTO_VERSION: 2.3.3 - - PHP_VERSION: php73-fpm - MAGENTO_VERSION: 2.3.7 - PHP_VERSION: php74-fpm - MAGENTO_VERSION: 2.4.0 + MAGENTO_VERSION: 2.3.7 - PHP_VERSION: php81-fpm MAGENTO_VERSION: 2.4.4 + - PHP_VERSION: php82-fpm + MAGENTO_VERSION: 2.4.6 runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index c9bd749..6c204a1 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -6,9 +6,7 @@ jobs: strategy: matrix: include: - - PHP_VERSION: php71-fpm - MAGENTO_VERSION: 2.3.3 - - PHP_VERSION: php73-fpm + - PHP_VERSION: php74-fpm MAGENTO_VERSION: 2.3.7 - PHP_VERSION: php74-fpm MAGENTO_VERSION: 2.4.0 diff --git a/composer.json b/composer.json index aab7f72..4570913 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "paazl/magento2-checkout-widget", "description": "Paazl checkoutWidget for Magento 2", "type": "magento2-module", - "version": "1.17.2", + "version": "1.17.3", "keywords": [ "Paazl", "Magento 2", diff --git a/etc/config.xml b/etc/config.xml index f42d708..39b6a9d 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -8,7 +8,7 @@ - v1.17.2 + v1.17.3 0 0 0 diff --git a/view/adminhtml/templates/order/view/shipping-and-handling-info/paazl-status.phtml b/view/adminhtml/templates/order/view/shipping-and-handling-info/paazl-status.phtml index 51bff15..fd2641a 100644 --- a/view/adminhtml/templates/order/view/shipping-and-handling-info/paazl-status.phtml +++ b/view/adminhtml/templates/order/view/shipping-and-handling-info/paazl-status.phtml @@ -44,14 +44,18 @@ use Paazl\CheckoutWidget\Ui\Component\Order\Listing\Column\Status\Options; getEstimatedDeliveryRange()) : ?> - - : - - + - : - - + : + + + + + + : + + + getCarrierPickupDate()) : ?> diff --git a/view/frontend/web/js/view/shipping-information-ext.js b/view/frontend/web/js/view/shipping-information-ext.js index bd03175..af3dd1f 100755 --- a/view/frontend/web/js/view/shipping-information-ext.js +++ b/view/frontend/web/js/view/shipping-information-ext.js @@ -4,8 +4,9 @@ */ define([ + 'jquery', 'Magento_Checkout/js/model/quote' -], function (quote) { +], function ($, quote) { 'use strict'; var storePickupShippingInformation = { @@ -14,7 +15,26 @@ define([ shippingMethodTitle: '', }, - initObservable: function () { + initialize: function () { + this._super(); + + $(document).ajaxComplete((e, xhr, settings) => { + if (settings.url.includes('shipping-information')) { + if (xhr.status === 200) { + let response = JSON.parse(xhr.responseText); + + window.checkoutConfig.totalsData.extension_attributes[0] = { + 'carrier_title': response.totals.extension_attributes.shipping_methods[0].carrier_title, + 'method_title': response.totals.extension_attributes.shipping_methods[0].method_title + } + + this.setShippingMethodTitle(); + } + } + }); + }, + + initObservable() { this._super().observe(['shippingMethodTitle']); return this; }, @@ -24,50 +44,39 @@ define([ * * @return {String} */ - getShippingMethodTitle: function () { + getShippingMethodTitle() { this.shippingMethodTitle(''); - quote.totals.subscribe(() => { - var shippingMethod = quote.shippingMethod(), - shippingMethodTitle = '', - locationName = '', - title; - - if (window.checkoutConfig.totalsData.extension_attributes[0]) { - const carrier_title = shippingMethod['carrier_title'] ? `${shippingMethod['carrier_title']}` : ''; - const method_title = shippingMethod['method_title'] ? shippingMethod['method_title'] : ''; - - if (typeof shippingMethod['method_title'] !== 'undefined') { - shippingMethodTitle = carrier_title + ' - ' + method_title; - } - - shippingMethod = window.checkoutConfig.totalsData.extension_attributes[0]; - this.shippingMethodTitle(shippingMethodTitle); - } else { - shippingMethod = quote.shippingMethod(); + // Trigger setting shipping method title if quote total subscribe doesn't trigger + this.setShippingMethodTitle(); - if (!this.isStorePickup()) { - if (!shippingMethod) return ''; + quote.totals.subscribe(() => { + this.setShippingMethodTitle(); + }); + }, - shippingMethodTitle = shippingMethod['carrier_title']; + setShippingMethodTitle() { + if (window.checkoutConfig.totalsData.extension_attributes[0] && window.checkoutConfig.paazlshipping) { + const shippingMethod = window.checkoutConfig.totalsData.extension_attributes[0]; + const carrier_title = shippingMethod['carrier_title']; + const method_title = shippingMethod['method_title']; - if (typeof shippingMethod['method_title'] !== 'undefined') { - shippingMethodTitle += ' - ' + shippingMethod['method_title']; - } - - return shippingMethodTitle; - } - - title = shippingMethod['carrier_title'] + ' - ' + shippingMethod['method_title']; + if (carrier_title && method_title) { + this.shippingMethodTitle(carrier_title + ' - ' + method_title); + } + } else { + this.getDefaultShippingMethodTitle(); + } + }, - if (quote.shippingAddress().firstname !== undefined) { - locationName = quote.shippingAddress().firstname + ' ' + quote.shippingAddress().lastname; - title += ' "' + locationName + '"'; - } + getDefaultShippingMethodTitle() { + const shippingMethod = quote.shippingMethod(); + const carrier_title = shippingMethod ? shippingMethod['carrier_title'] : ''; + const method_title = shippingMethod ? shippingMethod['method_title'] : ''; - return title; - } - }); + if (carrier_title && method_title) { + this.shippingMethodTitle(carrier_title + ' - ' + method_title); + } }, /** @@ -75,7 +84,7 @@ define([ * * @returns {Boolean} */ - isStorePickup: function () { + isStorePickup() { var shippingMethod = quote.shippingMethod(), isStorePickup = false;