Ecwid Ecommerce Shopping Cart - Version 6.10.2

Version Description

  • Jun 30, 2020 =
  • Fixed a PHP error message ("Failed opening required") for PHP version 5.2 in WordPress admin panel. If your ecommerce site is running on an outdated PHP version, this update might fix a error message for you. Please update your PHP as soon as possible (or ask your hoster to do that for you) its much more secure to use the latest versions of software on your server.
  • Minor fixes and improvements.

See full changelog

Download this release

Release Info

Developer Ecwid
Plugin Icon 128x128 Ecwid Ecommerce Shopping Cart
Version 6.10.2
Comparing to
See all releases

Code changes from version 6.10.1 to 6.10.2

css/frontend.css CHANGED
@@ -95,4 +95,8 @@ html#ecwid_html body#ecwid_body .ecwid.ecwid-SingleProduct-v2.ecwid-random-produ
95
 
96
  .ec-demo-notice .ec-notice__wrap {
97
  background-color:#fcf5e8 !important;
 
 
 
 
98
  }
95
 
96
  .ec-demo-notice .ec-notice__wrap {
97
  background-color:#fcf5e8 !important;
98
+ }
99
+
100
+ .ec-cart-widget[data-icon]::before {
101
+ content: '';
102
  }
ecwid-shopping-cart.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.ecwid.com?partner=wporg
5
  Description: Ecwid is a free full-featured shopping cart. It can be easily integrated with any Wordpress blog and takes less than 5 minutes to set up.
6
  Text Domain: ecwid-shopping-cart
7
  Author: Ecwid Ecommerce
8
- Version: 6.10.1
9
  Author URI: https://ecwid.to/ecwid-site
10
  License: GPLv2 or later
11
  */
5
  Description: Ecwid is a free full-featured shopping cart. It can be easily integrated with any Wordpress blog and takes less than 5 minutes to set up.
6
  Text Domain: ecwid-shopping-cart
7
  Author: Ecwid Ecommerce
8
+ Version: 6.10.2
9
  Author URI: https://ecwid.to/ecwid-site
10
  License: GPLv2 or later
11
  */
includes/class-ecwid-seo-links.php CHANGED
@@ -209,7 +209,11 @@ class Ecwid_Seo_Links {
209
  return $config;
210
  }
211
 
212
- $url = esc_js( get_permalink( $page_id ) );
 
 
 
 
213
 
214
 
215
  if( parse_url($url, PHP_URL_SCHEME) == 'https' && parse_url($url, PHP_URL_PORT) == '443' ) {
209
  return $config;
210
  }
211
 
212
+ if ( Ecwid_Ajax_Defer_Renderer::is_enabled() ) {
213
+ $url = esc_js( Ecwid_Store_Page::get_store_url() );
214
+ } else {
215
+ $url = esc_js( get_permalink( $page_id ) );
216
+ }
217
 
218
 
219
  if( parse_url($url, PHP_URL_SCHEME) == 'https' && parse_url($url, PHP_URL_PORT) == '443' ) {
includes/themes.php CHANGED
@@ -66,7 +66,6 @@ function ecwid_apply_theme($theme_name = null)
66
  'businesso' => array( 'css' ),
67
  'flatsome' => array( Ecwid_Theme_Base::PROP_USE_JS_API_FOR_CATS_NAV_MENU ),
68
  'themify-music' => array( Ecwid_Theme_Base::PROP_AJAX_DEFER_RENDERING ),
69
- 'bridge' => array( Ecwid_Theme_Base::PROP_AJAX_DEFER_RENDERING ),
70
  'Parallax-One' => array( 'css' ),
71
  'twentytwenty' => array( 'css', 'title' ),
72
  'jevelin3' => array( 'css-no-parent' ),
@@ -93,7 +92,8 @@ function ecwid_apply_theme($theme_name = null)
93
  'enfold',
94
  'vantage',
95
  'zenlife',
96
- 'Divi'
 
97
  );
98
 
99
  $custom_themes = apply_filters( 'ecwid_custom_themes', $custom_themes );
66
  'businesso' => array( 'css' ),
67
  'flatsome' => array( Ecwid_Theme_Base::PROP_USE_JS_API_FOR_CATS_NAV_MENU ),
68
  'themify-music' => array( Ecwid_Theme_Base::PROP_AJAX_DEFER_RENDERING ),
 
69
  'Parallax-One' => array( 'css' ),
70
  'twentytwenty' => array( 'css', 'title' ),
71
  'jevelin3' => array( 'css-no-parent' ),
92
  'enfold',
93
  'vantage',
94
  'zenlife',
95
+ 'Divi',
96
+ 'bridge'
97
  );
98
 
99
  $custom_themes = apply_filters( 'ecwid_custom_themes', $custom_themes );
includes/themes/class-ecwid-theme-bridge.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once ECWID_THEMES_DIR . '/class-ecwid-theme-base.php';
4
+
5
+ class Ecwid_Theme_Bridge extends Ecwid_Theme_Base
6
+ {
7
+ protected $name = 'Bridge';
8
+
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+
13
+ add_filter( Ecwid_Ajax_Defer_Renderer::FILTER_ENABLED, array( $this, 'filter_enabled_defer_rendering' ) );
14
+ }
15
+
16
+ public function filter_enabled_defer_rendering()
17
+ {
18
+ if( function_exists( 'bridge_qode_options' ) ) {
19
+ return bridge_qode_options()->getOptionValue('page_transitions');
20
+ }
21
+
22
+ return false;
23
+ }
24
+ }
25
+
26
+ return new Ecwid_Theme_Bridge();
js/static-page.js CHANGED
@@ -101,19 +101,16 @@
101
 
102
  addStaticPageHandlers();
103
 
104
-
105
  function setupAfterEcwidLoaded() {
106
 
107
- // если магазин не закрыт для клиента, то в storeClosed не будет true
108
- // если магазин не закрыт для клиента и мы загрузили закрытую плашку проверим это в динамике
109
  Ecwid.OnAPILoaded.add(function () {
110
  var storeClosed = window.ecwid_initial_data.data.storeClosed;
111
  var storeClosedWrapper = document.querySelectorAll('.ecwid-maintenance-wrapper');
112
- var storeClosedAndWrapperNotExists = storeClosed && storeClosedWrapper.length === 0;
113
  var storeNotClosedAndWrapperExists = !storeClosed && storeClosedWrapper.length > 0;
114
 
115
- if (!isDynamicMode()
116
- && (storeNotClosedAndWrapperExists || storeClosedAndWrapperNotExists)) {
117
  switchToDynamicMode();
118
  }
119
  });
@@ -135,7 +132,7 @@
135
  }
136
  });
137
 
138
- Ecwid.OnPageLoaded.add(function (openedPage) {
139
  if (isDynamicMode()) {
140
  // if we've already switched to dynamic, we don't need to dispatch this event anymore
141
  return;
@@ -158,7 +155,7 @@
158
  // other than self we must show opened page in dynamic view,
159
  // because static view contains only root category page
160
  switchToDynamicMode();
161
- });
162
  }
163
 
164
  function switchToDynamicWhenReadyWithRetries(retry) {
@@ -243,13 +240,13 @@
243
 
244
  addClickHandlers('#' + staticId + ' .grid__sort .grid-sort__item--filter', function (element) {
245
  addStaticClickEvent(element, function () {
246
- Ecwid.OnPageLoaded.add(function () {
247
  if (isDynamicMode()) {
248
  return;
249
  }
250
  switchToDynamicMode();
251
  Ecwid.showProductFilters();
252
- });
253
  });
254
  });
255
 
@@ -258,11 +255,21 @@
258
  addStaticClickEvent(element, openEcwidPage('category', {'id': categoryId}));
259
  });
260
 
261
- addClickHandlers('#' + staticId + ' .grid-product a', function (element) {
 
 
 
 
 
262
  var productId = element.getAttribute('data-product-id');
263
  addStaticClickEvent(element, openEcwidPage('product', {'id': productId}));
264
  });
265
 
 
 
 
 
 
266
  addClickHandlers('#' + staticId + ' .grid-product__buy-now', function (element) {
267
  var productId = element.getAttribute('data-product-id');
268
  addStaticClickEvent(element, openEcwidPage('product', {'id': productId}));
@@ -346,7 +353,7 @@
346
  return function (e) {
347
  e.preventDefault();
348
  // we must wait for Ecwid first page to be ready before changing it
349
- Ecwid.OnPageLoaded.add(function () {
350
  if (isDynamicMode()) {
351
  // if we've already switched to dynamic, we don't need to dispatch this event anymore
352
  return;
@@ -356,14 +363,45 @@
356
  onClickCallback();
357
  }
358
  ecwidPageOpened = true;
 
 
 
 
 
 
359
  Ecwid.openPage(page, params);
360
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
  }
362
  }
363
 
364
  function hideStorefront() {
365
  var dynamicEl = find('#' + dynamicId);
366
- dynamicEl.setAttribute("style", dynamicEl.getAttribute("style") + invisibleDynamicContainerStyle);
 
 
367
  }
368
 
369
  function showStorefront() {
@@ -393,20 +431,51 @@
393
 
394
  function switchToDynamicMode() {
395
  requestAnimationFrame(function () {
 
396
  showStorefront();
397
  hideStaticHtml();
 
398
  var staticEl = find('#' + staticId);
399
  if (staticEl && staticEl.parentNode) {
400
  staticEl.parentNode.removeChild(staticEl);
401
  }
402
  var switchToDynamicCallback = window.ec.storefront.staticPages.switchToDynamicCallback;
 
 
 
 
 
 
 
403
  if (!autoSwitchStaticToDynamicWhenReady && switchToDynamicCallback) {
404
  switchToDynamicCallback();
405
  }
406
  });
407
  }
408
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
 
410
  processStaticHomePage();
411
 
412
- })();
101
 
102
  addStaticPageHandlers();
103
 
 
104
  function setupAfterEcwidLoaded() {
105
 
106
+ // если магазин не закрыт для клиента, то в storeClosed не будет true
107
+ // если магазин не закрыт для клиента и мы загрузили закрытую плашку проверим это в динамике
108
  Ecwid.OnAPILoaded.add(function () {
109
  var storeClosed = window.ecwid_initial_data.data.storeClosed;
110
  var storeClosedWrapper = document.querySelectorAll('.ecwid-maintenance-wrapper');
 
111
  var storeNotClosedAndWrapperExists = !storeClosed && storeClosedWrapper.length > 0;
112
 
113
+ if (!isDynamicMode() && (storeClosed || storeNotClosedAndWrapperExists)) {
 
114
  switchToDynamicMode();
115
  }
116
  });
132
  }
133
  });
134
 
135
+ addOnPageLoadedCallback(function (openedPage) {
136
  if (isDynamicMode()) {
137
  // if we've already switched to dynamic, we don't need to dispatch this event anymore
138
  return;
155
  // other than self we must show opened page in dynamic view,
156
  // because static view contains only root category page
157
  switchToDynamicMode();
158
+ }, 0);
159
  }
160
 
161
  function switchToDynamicWhenReadyWithRetries(retry) {
240
 
241
  addClickHandlers('#' + staticId + ' .grid__sort .grid-sort__item--filter', function (element) {
242
  addStaticClickEvent(element, function () {
243
+ addOnPageLoadedCallback(function () {
244
  if (isDynamicMode()) {
245
  return;
246
  }
247
  switchToDynamicMode();
248
  Ecwid.showProductFilters();
249
+ }, 0);
250
  });
251
  });
252
 
255
  addStaticClickEvent(element, openEcwidPage('category', {'id': categoryId}));
256
  });
257
 
258
+ addClickHandlers('#' + staticId + ' .grid-product:not(.grid-product--view-all) a', function (element) {
259
+ var productId = element.getAttribute('data-product-id');
260
+ addStaticClickEvent(element, openEcwidPage('product', {'id': productId}));
261
+ });
262
+
263
+ addClickHandlers('#' + staticId + ' .grid-product:not(.grid-product--view-all) .grid-product__wrap[data-product-id]', function (element) {
264
  var productId = element.getAttribute('data-product-id');
265
  addStaticClickEvent(element, openEcwidPage('product', {'id': productId}));
266
  });
267
 
268
+ addClickHandlers('#' + staticId + ' .grid-product--view-all a' , function (element) {
269
+ var categoryId = element.getAttribute('data-category-id');
270
+ addStaticClickEvent(element, openEcwidPage('category', {'id': categoryId}));
271
+ })
272
+
273
  addClickHandlers('#' + staticId + ' .grid-product__buy-now', function (element) {
274
  var productId = element.getAttribute('data-product-id');
275
  addStaticClickEvent(element, openEcwidPage('product', {'id': productId}));
353
  return function (e) {
354
  e.preventDefault();
355
  // we must wait for Ecwid first page to be ready before changing it
356
+ addOnPageLoadedCallback(function () {
357
  if (isDynamicMode()) {
358
  // if we've already switched to dynamic, we don't need to dispatch this event anymore
359
  return;
363
  onClickCallback();
364
  }
365
  ecwidPageOpened = true;
366
+ var element = find('#' + staticId + " .ec-wrapper");
367
+ if (!!element) {
368
+ elementsClassListAction([element], function(list) {
369
+ list.add("ec-wrapper--transition");
370
+ });
371
+ }
372
  Ecwid.openPage(page, params);
373
+ }, 0);
374
+ }
375
+ }
376
+
377
+ function addOnPageLoadedCallback(callback, attempt) {
378
+ // Иногда при загрузке витрины (статической версии) на странице еще не определен Ecwid.OnPageLoaded.
379
+ // Надо подождать пока он появится, отложенно отработать клик пользователя (например открыть детали товара).
380
+ // Время ретраев - 2 секунды. 50 ms * 40 попыток = 2000 ms.
381
+ // Время выбрано по времени загрузки script.js https://graphweb.ecwid.com:3000/d/000000007/ecwid-performance-metrics
382
+ // 99 перцентиль иногда поднимается до 1.5 секунд. Сделал небольшой запас
383
+
384
+ if (attempt >= 40) {
385
+ if (!!console) {
386
+ console.warn("failed to add Ecwid.OnPageLoaded callback");
387
+ }
388
+ return;
389
+ }
390
+
391
+ if (typeof(Ecwid) == 'object' && typeof(Ecwid.OnPageLoaded) == 'object') {
392
+ Ecwid.OnPageLoaded.add(callback);
393
+ } else {
394
+ setTimeout(function () {
395
+ addOnPageLoadedCallback(callback, attempt + 1);
396
+ }, 50);
397
  }
398
  }
399
 
400
  function hideStorefront() {
401
  var dynamicEl = find('#' + dynamicId);
402
+ var currentStyleAttribute = dynamicEl.getAttribute("style") || "";
403
+
404
+ dynamicEl.setAttribute("style", currentStyleAttribute + invisibleDynamicContainerStyle);
405
  }
406
 
407
  function showStorefront() {
431
 
432
  function switchToDynamicMode() {
433
  requestAnimationFrame(function () {
434
+ removeClassAnimationForAutoSwitchToDynamic();
435
  showStorefront();
436
  hideStaticHtml();
437
+
438
  var staticEl = find('#' + staticId);
439
  if (staticEl && staticEl.parentNode) {
440
  staticEl.parentNode.removeChild(staticEl);
441
  }
442
  var switchToDynamicCallback = window.ec.storefront.staticPages.switchToDynamicCallback;
443
+
444
+ var element = find('#' + staticId + " .ec-wrapper");
445
+ if (!!element) {
446
+ elementsClassListAction([element], function(list) {
447
+ list.remove("ec-wrapper--transition");
448
+ });
449
+ }
450
  if (!autoSwitchStaticToDynamicWhenReady && switchToDynamicCallback) {
451
  switchToDynamicCallback();
452
  }
453
  });
454
  }
455
 
456
+ function removeClassAnimationForAutoSwitchToDynamic() {
457
+ if (!autoSwitchStaticToDynamicWhenReady) {
458
+ return;
459
+ }
460
+ var wrapers = document.querySelectorAll('.ec-wrapper--animated-transitions');
461
+ var arrWrapers = Array.prototype.slice.call(wrapers);
462
+ elementsClassListAction(arrWrapers, function(list) {
463
+ list.remove('ec-wrapper--animated-transitions');
464
+ });
465
+ }
466
+
467
+ function elementsClassListAction(elements, callback) {
468
+ if (!(Array.isArray(elements))) {
469
+ return;
470
+ }
471
+ for (var key in elements) {
472
+ var list = elements[key].classList;
473
+ if (typeof list != "undefined") {
474
+ callback(list);
475
+ }
476
+ }
477
+ }
478
 
479
  processStaticHomePage();
480
 
481
+ })();
lib/ecwid_api_v3.php CHANGED
@@ -539,6 +539,11 @@ class Ecwid_Api_V3
539
  return $profile;
540
  }
541
 
 
 
 
 
 
542
  $params = array(
543
  'token' => self::get_token()
544
  );
539
  return $profile;
540
  }
541
 
542
+ if( !self::get_token() ) {
543
+ self::set_api_status( self::API_STATUS_ERROR_TOKEN );
544
+ return false;
545
+ }
546
+
547
  $params = array(
548
  'token' => self::get_token()
549
  );
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Ecwid
3
  Tags: ecommerce, e-commerce, storefront, online store, sell
4
  Requires at least: 3.7
5
  Tested up to: 5.4
6
- Stable tag: 6.10.1
7
 
8
  Powerful, easy to use ecommerce shopping cart. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.
9
 
@@ -154,7 +154,8 @@ You can use Ecwid’s built-in import tools to copy your store products from any
154
 
155
  == Changelog ==
156
 
157
- = 6.10.1 - Jun 15, 2020 =
158
- - Minor improvements for the store dashboard menu items in the WordPress admin backend.
 
159
 
160
  [See full changelog](https://raw.githubusercontent.com/Ecwid/ecwid-wordpress-plugin/master/CHANGELOG.txt)
3
  Tags: ecommerce, e-commerce, storefront, online store, sell
4
  Requires at least: 3.7
5
  Tested up to: 5.4
6
+ Stable tag: 6.10.2
7
 
8
  Powerful, easy to use ecommerce shopping cart. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.
9
 
154
 
155
  == Changelog ==
156
 
157
+ = 6.10.2 - Jun 30, 2020 =
158
+ - Fixed a PHP error message ("Failed opening required") for PHP version 5.2 in WordPress admin panel. If your ecommerce site is running on an outdated PHP version, this update might fix a error message for you. Please update your PHP as soon as possible (or ask your hoster to do that for you) — it’s much more secure to use the latest versions of software on your server.
159
+ - Minor fixes and improvements.
160
 
161
  [See full changelog](https://raw.githubusercontent.com/Ecwid/ecwid-wordpress-plugin/master/CHANGELOG.txt)
templates/admin/storefront/area-navigation.php CHANGED
@@ -21,7 +21,7 @@
21
  <div class="cta-block__title"><?php _e( 'Show your store on the home page', 'ecwid-shopping-cart'); ?></div>
22
  <div class="cta-block__content">
23
  <?php
24
- require __DIR__ . '/draft-message.php';
25
  ?>
26
 
27
  <div><?php
@@ -107,7 +107,7 @@
107
 
108
  <div class="cta-block__content">
109
  <?php
110
- require __DIR__ . '/draft-message.php';
111
  ?>
112
  <?php
113
  _e( 'A slug is the last part of a URL. You can create a custom slug for your store page. It’s better to keep it short since customers and search engines prefer short URLs. For example, use "/shop" or "/products".', 'ecwid-shopping-cart');
@@ -141,7 +141,7 @@
141
  <div class="cta-block__title"><?php _e( 'Add store page to the site menu', 'ecwid-shopping-cart'); ?></div>
142
  <div class="cta-block__content">
143
  <?php
144
- require __DIR__ . '/draft-message.php';
145
  ?>
146
 
147
  <div><?php _e( 'Make your store accessible from the site menu so your customers can easily find it.', 'ecwid-shopping-cart'); ?></div>
21
  <div class="cta-block__title"><?php _e( 'Show your store on the home page', 'ecwid-shopping-cart'); ?></div>
22
  <div class="cta-block__content">
23
  <?php
24
+ require self::$templates_dir . '/draft-message.php';
25
  ?>
26
 
27
  <div><?php
107
 
108
  <div class="cta-block__content">
109
  <?php
110
+ require self::$templates_dir . '/draft-message.php';
111
  ?>
112
  <?php
113
  _e( 'A slug is the last part of a URL. You can create a custom slug for your store page. It’s better to keep it short since customers and search engines prefer short URLs. For example, use "/shop" or "/products".', 'ecwid-shopping-cart');
141
  <div class="cta-block__title"><?php _e( 'Add store page to the site menu', 'ecwid-shopping-cart'); ?></div>
142
  <div class="cta-block__content">
143
  <?php
144
+ require self::$templates_dir . '/draft-message.php';
145
  ?>
146
 
147
  <div><?php _e( 'Make your store accessible from the site menu so your customers can easily find it.', 'ecwid-shopping-cart'); ?></div>