Plugin Directory

Changeset 3131402


Ignore:
Timestamp:
08/06/2024 07:40:51 AM (20 months ago)
Author:
Ecwid
Message:

Update to version 6.12.17 from GitHub

Location:
ecwid-shopping-cart
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • ecwid-shopping-cart/tags/6.12.17/ecwid-shopping-cart.php

    r3118980 r3131402  
    66Text Domain: ecwid-shopping-cart
    77Author: Ecwid Ecommerce
    8 Version: 6.12.16
     8Version: 6.12.17
    99Author URI: https://ecwid.to/ecwid-site
    1010License: GPLv2 or later
  • ecwid-shopping-cart/tags/6.12.17/js/static-page.js

    r2853599 r3131402  
    1010    var mainCategoryId = 0;
    1111    var initialCategoryOffset = 0;
     12    var pageAlreadyLoaded = false;
    1213
    1314    function find(selector) {
     
    229230                        return;
    230231                    }
    231                     var storeClosed = window.ecwid_initial_data.data.storeClosed;
     232                    var storeClosed = window.ecwid_initial_data !== undefined
     233                        ? window.ecwid_initial_data.data.storeClosed // Storefront v2
     234                        : false; // Storefront v3
    232235                    var storeClosedWrapper = document.querySelectorAll('.ecwid-maintenance-wrapper');
    233236                    var storeNotClosedAndWrapperExists = !storeClosed && storeClosedWrapper.length > 0;
     
    270273                    }
    271274
    272                     if (!ecwidPageOpened
     275                    if (!hasEcwidMessages()
     276                        && !ecwidPageOpened
    273277                        && openedPage.type === "CATEGORY"
    274278                        && openedPage.categoryId === mainCategoryId
     
    360364        }
    361365
    362         addClickHandlers('#' + staticId + ' .ec-breadcrumbs a', function (element) {
    363             var categoryId = element.getAttribute('categoryId');
     366        addClickHandlers('#' + staticId + ' .breadcrumbs__link', function (element) {
     367            var categoryId = element.getAttribute('data-category-id');
    364368            if (categoryId !== mainCategoryId) {
    365369                addStaticClickEvent(element, openEcwidPage('category', { 'id': categoryId }));
     
    409413        })
    410414
    411         addClickHandlers('#' + staticId + ' .grid-product__buy-now', function (element) {
    412             var productId = element.getAttribute('data-product-id');
    413             addStaticClickEvent(element, openEcwidPage('product', { 'id': productId }));
     415        addClickHandlers('#' + staticId + ' .grid-product__buy-now .form-control', function (element) {
     416            const productId = element.getAttribute('data-product-id');
     417            const isGermanStore = element.getAttribute('data-country-code') === 'DE';
     418            const updatedBuyButtonsFeature = element.getAttribute('data-updated-buy-buttons') != null;
     419            const params = { 'id': productId };
     420            if (updatedBuyButtonsFeature && !isGermanStore) {
     421                params['buyNow'] = '';
     422            }
     423            addStaticClickEvent(element, openEcwidPage('product', params, true));
    414424        });
    415425
     
    501511    }
    502512
    503     function openEcwidPage(page, params) {
     513    function openEcwidPage(page, params, stopPropagation = false) {
    504514        return function (e) {
     515            if (stopPropagation) {
     516                e.stopPropagation();
     517            }
    505518            if (isCtrlClickOnProductEvent(page, e)) {
    506519                // In case product element in grid was clicked with ctrl/meta key, do not invoke e.preventDefault()
     
    538551
    539552    function addOnPageLoadedCallback(callback, attempt) {
     553        const isModernStorefront = window.Ecwid && window.Ecwid.isStorefrontV3 && window.Ecwid.isStorefrontV3();
     554        if (isModernStorefront && pageAlreadyLoaded) {
     555            callback();
     556            return;
     557        }
     558
    540559        // let's wait for the Ecwid environment to be loaded for up to 2000 milliseconds
    541560        if (attempt >= 40) {
     
    547566
    548567        if (typeof (Ecwid) == 'object' && typeof (Ecwid.OnPageLoaded) == 'object') {
    549             Ecwid.OnPageLoaded.add(callback);
     568            Ecwid.OnPageLoaded.add(function (page) {
     569                pageAlreadyLoaded = true;
     570                callback(page);
     571            });
    550572        } else {
    551573            setTimeout(function () {
  • ecwid-shopping-cart/tags/6.12.17/lib/ecwid_api_v3.php

    r3116030 r3131402  
    189189
    190190        if ( ! $result ) {
     191            if ( empty( $options ) ) {
     192                return false;
     193            }
     194
    191195            $result = EcwidPlatform::fetch_url( $url, $options );
    192196
     
    263267
    264268        if ( ! $result ) {
     269            if ( empty( $options ) ) {
     270                return false;
     271            }
     272
    265273            $result = EcwidPlatform::fetch_url( $url, $options );
    266274
     
    317325
    318326        if ( ! $result ) {
     327            if ( empty( $options ) ) {
     328                return false;
     329            }
     330
    319331            $result = EcwidPlatform::fetch_url( $url, $options );
    320332
     
    365377
    366378        if ( ! $result ) {
     379            if ( empty( $options ) ) {
     380                return false;
     381            }
     382
    367383            $result = EcwidPlatform::fetch_url( $url, $options );
     384
    368385            if ( $result['code'] != '200' ) {
    369386                return false;
     
    411428        );
    412429
     430        if ( empty( $options ) ) {
     431            return false;
     432        }
     433
    413434        $result = EcwidPlatform::fetch_url( $url, $options );
    414435
     
    444465            $params
    445466        );
     467
     468        if ( empty( $options ) ) {
     469            return false;
     470        }
    446471
    447472        $result = EcwidPlatform::fetch_url( $url, $options );
     
    569594        $url     = $this->build_request_url( $url, $params );
    570595
     596        if ( empty( $options ) ) {
     597            return false;
     598        }
     599
    571600        $result = EcwidPlatform::fetch_url( $url, $options );
    572601
     
    607636        $options = $this->build_request_headers();
    608637        $url     = $this->build_request_url( $this->_profile_api_url, $params );
     638
     639        if ( empty( $options ) ) {
     640            return false;
     641        }
    609642
    610643        $result = EcwidPlatform::fetch_url( $url, $options );
     
    822855
    823856    protected function build_request_headers() {
    824         $headers = array(
    825             'headers' => array(
    826                 'Authorization' => 'Bearer ' . self::get_token(),
    827             ),
    828         );
     857        $headers = array();
     858        $token   = self::get_token();
     859
     860        if ( ! empty( $token ) ) {
     861            $headers['headers'] = array(
     862                'Authorization' => 'Bearer ' . $token,
     863            );
     864        }
    829865
    830866        return $headers;
     
    9881024        $options = $this->build_request_headers();
    9891025        $url     = $this->build_request_url( $this->_starter_site_api_url, $request_params );
     1026
     1027        if ( empty( $options ) ) {
     1028            return false;
     1029        }
    9901030
    9911031        $result = EcwidPlatform::fetch_url( $url, $options );
     
    11031143        $url     = $this->build_request_url( $this->_batch_requests_api_url, $params );
    11041144
     1145        if ( empty( $options ) ) {
     1146            return false;
     1147        }
     1148
    11051149        $result = EcwidPlatform::fetch_url( $url, $options );
    11061150
  • ecwid-shopping-cart/tags/6.12.17/readme.txt

    r3118980 r3131402  
    66Requires at least: 4.4
    77Tested up to: 6.6
    8 Stable tag: 6.12.16
     8Stable tag: 6.12.17
    99
    1010Powerful, easy to use ecommerce shopping cart for WordPress. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.
     
    154154
    155155== Changelog ==
     156= 6.12.17 - Aug 5, 2024 =
     157- Internal improvements and optimizations.
     158
    156159= 6.12.16 - Jul 16, 2024 =
    157160- Resolved an issue with the store sometimes failing to connect to a plugin.
  • ecwid-shopping-cart/trunk/ecwid-shopping-cart.php

    r3118980 r3131402  
    66Text Domain: ecwid-shopping-cart
    77Author: Ecwid Ecommerce
    8 Version: 6.12.16
     8Version: 6.12.17
    99Author URI: https://ecwid.to/ecwid-site
    1010License: GPLv2 or later
  • ecwid-shopping-cart/trunk/js/static-page.js

    r2853599 r3131402  
    1010    var mainCategoryId = 0;
    1111    var initialCategoryOffset = 0;
     12    var pageAlreadyLoaded = false;
    1213
    1314    function find(selector) {
     
    229230                        return;
    230231                    }
    231                     var storeClosed = window.ecwid_initial_data.data.storeClosed;
     232                    var storeClosed = window.ecwid_initial_data !== undefined
     233                        ? window.ecwid_initial_data.data.storeClosed // Storefront v2
     234                        : false; // Storefront v3
    232235                    var storeClosedWrapper = document.querySelectorAll('.ecwid-maintenance-wrapper');
    233236                    var storeNotClosedAndWrapperExists = !storeClosed && storeClosedWrapper.length > 0;
     
    270273                    }
    271274
    272                     if (!ecwidPageOpened
     275                    if (!hasEcwidMessages()
     276                        && !ecwidPageOpened
    273277                        && openedPage.type === "CATEGORY"
    274278                        && openedPage.categoryId === mainCategoryId
     
    360364        }
    361365
    362         addClickHandlers('#' + staticId + ' .ec-breadcrumbs a', function (element) {
    363             var categoryId = element.getAttribute('categoryId');
     366        addClickHandlers('#' + staticId + ' .breadcrumbs__link', function (element) {
     367            var categoryId = element.getAttribute('data-category-id');
    364368            if (categoryId !== mainCategoryId) {
    365369                addStaticClickEvent(element, openEcwidPage('category', { 'id': categoryId }));
     
    409413        })
    410414
    411         addClickHandlers('#' + staticId + ' .grid-product__buy-now', function (element) {
    412             var productId = element.getAttribute('data-product-id');
    413             addStaticClickEvent(element, openEcwidPage('product', { 'id': productId }));
     415        addClickHandlers('#' + staticId + ' .grid-product__buy-now .form-control', function (element) {
     416            const productId = element.getAttribute('data-product-id');
     417            const isGermanStore = element.getAttribute('data-country-code') === 'DE';
     418            const updatedBuyButtonsFeature = element.getAttribute('data-updated-buy-buttons') != null;
     419            const params = { 'id': productId };
     420            if (updatedBuyButtonsFeature && !isGermanStore) {
     421                params['buyNow'] = '';
     422            }
     423            addStaticClickEvent(element, openEcwidPage('product', params, true));
    414424        });
    415425
     
    501511    }
    502512
    503     function openEcwidPage(page, params) {
     513    function openEcwidPage(page, params, stopPropagation = false) {
    504514        return function (e) {
     515            if (stopPropagation) {
     516                e.stopPropagation();
     517            }
    505518            if (isCtrlClickOnProductEvent(page, e)) {
    506519                // In case product element in grid was clicked with ctrl/meta key, do not invoke e.preventDefault()
     
    538551
    539552    function addOnPageLoadedCallback(callback, attempt) {
     553        const isModernStorefront = window.Ecwid && window.Ecwid.isStorefrontV3 && window.Ecwid.isStorefrontV3();
     554        if (isModernStorefront && pageAlreadyLoaded) {
     555            callback();
     556            return;
     557        }
     558
    540559        // let's wait for the Ecwid environment to be loaded for up to 2000 milliseconds
    541560        if (attempt >= 40) {
     
    547566
    548567        if (typeof (Ecwid) == 'object' && typeof (Ecwid.OnPageLoaded) == 'object') {
    549             Ecwid.OnPageLoaded.add(callback);
     568            Ecwid.OnPageLoaded.add(function (page) {
     569                pageAlreadyLoaded = true;
     570                callback(page);
     571            });
    550572        } else {
    551573            setTimeout(function () {
  • ecwid-shopping-cart/trunk/lib/ecwid_api_v3.php

    r3116030 r3131402  
    189189
    190190        if ( ! $result ) {
     191            if ( empty( $options ) ) {
     192                return false;
     193            }
     194
    191195            $result = EcwidPlatform::fetch_url( $url, $options );
    192196
     
    263267
    264268        if ( ! $result ) {
     269            if ( empty( $options ) ) {
     270                return false;
     271            }
     272
    265273            $result = EcwidPlatform::fetch_url( $url, $options );
    266274
     
    317325
    318326        if ( ! $result ) {
     327            if ( empty( $options ) ) {
     328                return false;
     329            }
     330
    319331            $result = EcwidPlatform::fetch_url( $url, $options );
    320332
     
    365377
    366378        if ( ! $result ) {
     379            if ( empty( $options ) ) {
     380                return false;
     381            }
     382
    367383            $result = EcwidPlatform::fetch_url( $url, $options );
     384
    368385            if ( $result['code'] != '200' ) {
    369386                return false;
     
    411428        );
    412429
     430        if ( empty( $options ) ) {
     431            return false;
     432        }
     433
    413434        $result = EcwidPlatform::fetch_url( $url, $options );
    414435
     
    444465            $params
    445466        );
     467
     468        if ( empty( $options ) ) {
     469            return false;
     470        }
    446471
    447472        $result = EcwidPlatform::fetch_url( $url, $options );
     
    569594        $url     = $this->build_request_url( $url, $params );
    570595
     596        if ( empty( $options ) ) {
     597            return false;
     598        }
     599
    571600        $result = EcwidPlatform::fetch_url( $url, $options );
    572601
     
    607636        $options = $this->build_request_headers();
    608637        $url     = $this->build_request_url( $this->_profile_api_url, $params );
     638
     639        if ( empty( $options ) ) {
     640            return false;
     641        }
    609642
    610643        $result = EcwidPlatform::fetch_url( $url, $options );
     
    822855
    823856    protected function build_request_headers() {
    824         $headers = array(
    825             'headers' => array(
    826                 'Authorization' => 'Bearer ' . self::get_token(),
    827             ),
    828         );
     857        $headers = array();
     858        $token   = self::get_token();
     859
     860        if ( ! empty( $token ) ) {
     861            $headers['headers'] = array(
     862                'Authorization' => 'Bearer ' . $token,
     863            );
     864        }
    829865
    830866        return $headers;
     
    9881024        $options = $this->build_request_headers();
    9891025        $url     = $this->build_request_url( $this->_starter_site_api_url, $request_params );
     1026
     1027        if ( empty( $options ) ) {
     1028            return false;
     1029        }
    9901030
    9911031        $result = EcwidPlatform::fetch_url( $url, $options );
     
    11031143        $url     = $this->build_request_url( $this->_batch_requests_api_url, $params );
    11041144
     1145        if ( empty( $options ) ) {
     1146            return false;
     1147        }
     1148
    11051149        $result = EcwidPlatform::fetch_url( $url, $options );
    11061150
  • ecwid-shopping-cart/trunk/readme.txt

    r3118980 r3131402  
    66Requires at least: 4.4
    77Tested up to: 6.6
    8 Stable tag: 6.12.16
     8Stable tag: 6.12.17
    99
    1010Powerful, easy to use ecommerce shopping cart for WordPress. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.
     
    154154
    155155== Changelog ==
     156= 6.12.17 - Aug 5, 2024 =
     157- Internal improvements and optimizations.
     158
    156159= 6.12.16 - Jul 16, 2024 =
    157160- Resolved an issue with the store sometimes failing to connect to a plugin.
Note: See TracChangeset for help on using the changeset viewer.