Changeset 3131402
- Timestamp:
- 08/06/2024 07:40:51 AM (20 months ago)
- Location:
- ecwid-shopping-cart
- Files:
-
- 8 edited
- 1 copied
-
tags/6.12.17 (copied) (copied from ecwid-shopping-cart/trunk)
-
tags/6.12.17/ecwid-shopping-cart.php (modified) (1 diff)
-
tags/6.12.17/js/static-page.js (modified) (8 diffs)
-
tags/6.12.17/lib/ecwid_api_v3.php (modified) (11 diffs)
-
tags/6.12.17/readme.txt (modified) (2 diffs)
-
trunk/ecwid-shopping-cart.php (modified) (1 diff)
-
trunk/js/static-page.js (modified) (8 diffs)
-
trunk/lib/ecwid_api_v3.php (modified) (11 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ecwid-shopping-cart/tags/6.12.17/ecwid-shopping-cart.php
r3118980 r3131402 6 6 Text Domain: ecwid-shopping-cart 7 7 Author: Ecwid Ecommerce 8 Version: 6.12.1 68 Version: 6.12.17 9 9 Author URI: https://ecwid.to/ecwid-site 10 10 License: GPLv2 or later -
ecwid-shopping-cart/tags/6.12.17/js/static-page.js
r2853599 r3131402 10 10 var mainCategoryId = 0; 11 11 var initialCategoryOffset = 0; 12 var pageAlreadyLoaded = false; 12 13 13 14 function find(selector) { … … 229 230 return; 230 231 } 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 232 235 var storeClosedWrapper = document.querySelectorAll('.ecwid-maintenance-wrapper'); 233 236 var storeNotClosedAndWrapperExists = !storeClosed && storeClosedWrapper.length > 0; … … 270 273 } 271 274 272 if (!ecwidPageOpened 275 if (!hasEcwidMessages() 276 && !ecwidPageOpened 273 277 && openedPage.type === "CATEGORY" 274 278 && openedPage.categoryId === mainCategoryId … … 360 364 } 361 365 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'); 364 368 if (categoryId !== mainCategoryId) { 365 369 addStaticClickEvent(element, openEcwidPage('category', { 'id': categoryId })); … … 409 413 }) 410 414 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)); 414 424 }); 415 425 … … 501 511 } 502 512 503 function openEcwidPage(page, params ) {513 function openEcwidPage(page, params, stopPropagation = false) { 504 514 return function (e) { 515 if (stopPropagation) { 516 e.stopPropagation(); 517 } 505 518 if (isCtrlClickOnProductEvent(page, e)) { 506 519 // In case product element in grid was clicked with ctrl/meta key, do not invoke e.preventDefault() … … 538 551 539 552 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 540 559 // let's wait for the Ecwid environment to be loaded for up to 2000 milliseconds 541 560 if (attempt >= 40) { … … 547 566 548 567 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 }); 550 572 } else { 551 573 setTimeout(function () { -
ecwid-shopping-cart/tags/6.12.17/lib/ecwid_api_v3.php
r3116030 r3131402 189 189 190 190 if ( ! $result ) { 191 if ( empty( $options ) ) { 192 return false; 193 } 194 191 195 $result = EcwidPlatform::fetch_url( $url, $options ); 192 196 … … 263 267 264 268 if ( ! $result ) { 269 if ( empty( $options ) ) { 270 return false; 271 } 272 265 273 $result = EcwidPlatform::fetch_url( $url, $options ); 266 274 … … 317 325 318 326 if ( ! $result ) { 327 if ( empty( $options ) ) { 328 return false; 329 } 330 319 331 $result = EcwidPlatform::fetch_url( $url, $options ); 320 332 … … 365 377 366 378 if ( ! $result ) { 379 if ( empty( $options ) ) { 380 return false; 381 } 382 367 383 $result = EcwidPlatform::fetch_url( $url, $options ); 384 368 385 if ( $result['code'] != '200' ) { 369 386 return false; … … 411 428 ); 412 429 430 if ( empty( $options ) ) { 431 return false; 432 } 433 413 434 $result = EcwidPlatform::fetch_url( $url, $options ); 414 435 … … 444 465 $params 445 466 ); 467 468 if ( empty( $options ) ) { 469 return false; 470 } 446 471 447 472 $result = EcwidPlatform::fetch_url( $url, $options ); … … 569 594 $url = $this->build_request_url( $url, $params ); 570 595 596 if ( empty( $options ) ) { 597 return false; 598 } 599 571 600 $result = EcwidPlatform::fetch_url( $url, $options ); 572 601 … … 607 636 $options = $this->build_request_headers(); 608 637 $url = $this->build_request_url( $this->_profile_api_url, $params ); 638 639 if ( empty( $options ) ) { 640 return false; 641 } 609 642 610 643 $result = EcwidPlatform::fetch_url( $url, $options ); … … 822 855 823 856 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 } 829 865 830 866 return $headers; … … 988 1024 $options = $this->build_request_headers(); 989 1025 $url = $this->build_request_url( $this->_starter_site_api_url, $request_params ); 1026 1027 if ( empty( $options ) ) { 1028 return false; 1029 } 990 1030 991 1031 $result = EcwidPlatform::fetch_url( $url, $options ); … … 1103 1143 $url = $this->build_request_url( $this->_batch_requests_api_url, $params ); 1104 1144 1145 if ( empty( $options ) ) { 1146 return false; 1147 } 1148 1105 1149 $result = EcwidPlatform::fetch_url( $url, $options ); 1106 1150 -
ecwid-shopping-cart/tags/6.12.17/readme.txt
r3118980 r3131402 6 6 Requires at least: 4.4 7 7 Tested up to: 6.6 8 Stable tag: 6.12.1 68 Stable tag: 6.12.17 9 9 10 10 Powerful, easy to use ecommerce shopping cart for WordPress. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available. … … 154 154 155 155 == Changelog == 156 = 6.12.17 - Aug 5, 2024 = 157 - Internal improvements and optimizations. 158 156 159 = 6.12.16 - Jul 16, 2024 = 157 160 - Resolved an issue with the store sometimes failing to connect to a plugin. -
ecwid-shopping-cart/trunk/ecwid-shopping-cart.php
r3118980 r3131402 6 6 Text Domain: ecwid-shopping-cart 7 7 Author: Ecwid Ecommerce 8 Version: 6.12.1 68 Version: 6.12.17 9 9 Author URI: https://ecwid.to/ecwid-site 10 10 License: GPLv2 or later -
ecwid-shopping-cart/trunk/js/static-page.js
r2853599 r3131402 10 10 var mainCategoryId = 0; 11 11 var initialCategoryOffset = 0; 12 var pageAlreadyLoaded = false; 12 13 13 14 function find(selector) { … … 229 230 return; 230 231 } 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 232 235 var storeClosedWrapper = document.querySelectorAll('.ecwid-maintenance-wrapper'); 233 236 var storeNotClosedAndWrapperExists = !storeClosed && storeClosedWrapper.length > 0; … … 270 273 } 271 274 272 if (!ecwidPageOpened 275 if (!hasEcwidMessages() 276 && !ecwidPageOpened 273 277 && openedPage.type === "CATEGORY" 274 278 && openedPage.categoryId === mainCategoryId … … 360 364 } 361 365 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'); 364 368 if (categoryId !== mainCategoryId) { 365 369 addStaticClickEvent(element, openEcwidPage('category', { 'id': categoryId })); … … 409 413 }) 410 414 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)); 414 424 }); 415 425 … … 501 511 } 502 512 503 function openEcwidPage(page, params ) {513 function openEcwidPage(page, params, stopPropagation = false) { 504 514 return function (e) { 515 if (stopPropagation) { 516 e.stopPropagation(); 517 } 505 518 if (isCtrlClickOnProductEvent(page, e)) { 506 519 // In case product element in grid was clicked with ctrl/meta key, do not invoke e.preventDefault() … … 538 551 539 552 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 540 559 // let's wait for the Ecwid environment to be loaded for up to 2000 milliseconds 541 560 if (attempt >= 40) { … … 547 566 548 567 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 }); 550 572 } else { 551 573 setTimeout(function () { -
ecwid-shopping-cart/trunk/lib/ecwid_api_v3.php
r3116030 r3131402 189 189 190 190 if ( ! $result ) { 191 if ( empty( $options ) ) { 192 return false; 193 } 194 191 195 $result = EcwidPlatform::fetch_url( $url, $options ); 192 196 … … 263 267 264 268 if ( ! $result ) { 269 if ( empty( $options ) ) { 270 return false; 271 } 272 265 273 $result = EcwidPlatform::fetch_url( $url, $options ); 266 274 … … 317 325 318 326 if ( ! $result ) { 327 if ( empty( $options ) ) { 328 return false; 329 } 330 319 331 $result = EcwidPlatform::fetch_url( $url, $options ); 320 332 … … 365 377 366 378 if ( ! $result ) { 379 if ( empty( $options ) ) { 380 return false; 381 } 382 367 383 $result = EcwidPlatform::fetch_url( $url, $options ); 384 368 385 if ( $result['code'] != '200' ) { 369 386 return false; … … 411 428 ); 412 429 430 if ( empty( $options ) ) { 431 return false; 432 } 433 413 434 $result = EcwidPlatform::fetch_url( $url, $options ); 414 435 … … 444 465 $params 445 466 ); 467 468 if ( empty( $options ) ) { 469 return false; 470 } 446 471 447 472 $result = EcwidPlatform::fetch_url( $url, $options ); … … 569 594 $url = $this->build_request_url( $url, $params ); 570 595 596 if ( empty( $options ) ) { 597 return false; 598 } 599 571 600 $result = EcwidPlatform::fetch_url( $url, $options ); 572 601 … … 607 636 $options = $this->build_request_headers(); 608 637 $url = $this->build_request_url( $this->_profile_api_url, $params ); 638 639 if ( empty( $options ) ) { 640 return false; 641 } 609 642 610 643 $result = EcwidPlatform::fetch_url( $url, $options ); … … 822 855 823 856 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 } 829 865 830 866 return $headers; … … 988 1024 $options = $this->build_request_headers(); 989 1025 $url = $this->build_request_url( $this->_starter_site_api_url, $request_params ); 1026 1027 if ( empty( $options ) ) { 1028 return false; 1029 } 990 1030 991 1031 $result = EcwidPlatform::fetch_url( $url, $options ); … … 1103 1143 $url = $this->build_request_url( $this->_batch_requests_api_url, $params ); 1104 1144 1145 if ( empty( $options ) ) { 1146 return false; 1147 } 1148 1105 1149 $result = EcwidPlatform::fetch_url( $url, $options ); 1106 1150 -
ecwid-shopping-cart/trunk/readme.txt
r3118980 r3131402 6 6 Requires at least: 4.4 7 7 Tested up to: 6.6 8 Stable tag: 6.12.1 68 Stable tag: 6.12.17 9 9 10 10 Powerful, easy to use ecommerce shopping cart for WordPress. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available. … … 154 154 155 155 == Changelog == 156 = 6.12.17 - Aug 5, 2024 = 157 - Internal improvements and optimizations. 158 156 159 = 6.12.16 - Jul 16, 2024 = 157 160 - Resolved an issue with the store sometimes failing to connect to a plugin.
Note: See TracChangeset
for help on using the changeset viewer.