Ecwid Ecommerce Shopping Cart - Version 6.8.4

Version Description

  • Jul 9, 2019 =
  • Several fixes and improvements for the recently released Store page speedup feature. In particular, the changes improve the caching mechanism to avoid high database usage and fix layout issues in Internet Exporer browser. If you havent tried the store speedup tool yet, please feel free to do so on the Ecwid/Advanced setting page in your WordPress admin backend.
  • Fixed a warning on the sites with old PHP versions. If your ecommerce site is running on an outdated PHP version, this update might fix a warning 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.
Download this release

Release Info

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

Code changes from version 6.8.3 to 6.8.4

ecwid-shopping-cart.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.ecwid.com?source=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.8.3
9
  Author URI: https://ecwid.to/ecwid-site
10
  */
11
 
@@ -373,9 +373,13 @@ function ecwid_enqueue_frontend() {
373
 
374
  wp_enqueue_style('ecwid-css', ECWID_PLUGIN_URL . 'css/frontend.css',array(), get_option('ecwid_plugin_version'));
375
 
 
 
376
  wp_enqueue_script( 'ecwid-frontend-js', ECWID_PLUGIN_URL . 'js/frontend.js', array( 'jquery' ), get_option( 'ecwid_plugin_version' ) );
377
  wp_localize_script( 'ecwid-frontend-js', 'ecwidParams', array(
378
- 'useJsApiToOpenStoreCategoriesPages' => Ecwid_Nav_Menus::should_use_js_api_for_categories_menu()
 
 
379
  ));
380
 
381
  if ( get_post() && get_post()->post_type == Ecwid_Products::POST_TYPE_PRODUCT ) {
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.8.4
9
  Author URI: https://ecwid.to/ecwid-site
10
  */
11
 
373
 
374
  wp_enqueue_style('ecwid-css', ECWID_PLUGIN_URL . 'css/frontend.css',array(), get_option('ecwid_plugin_version'));
375
 
376
+ $need_tracking = get_post()->post_status == 'publish' && get_post()->post_password == '' && !ecwid_is_demo_store();
377
+
378
  wp_enqueue_script( 'ecwid-frontend-js', ECWID_PLUGIN_URL . 'js/frontend.js', array( 'jquery' ), get_option( 'ecwid_plugin_version' ) );
379
  wp_localize_script( 'ecwid-frontend-js', 'ecwidParams', array(
380
+ 'useJsApiToOpenStoreCategoriesPages' => Ecwid_Nav_Menus::should_use_js_api_for_categories_menu(),
381
+ 'trackPublicPage' => $need_tracking,
382
+ 'storeId' => get_ecwid_store_id()
383
  ));
384
 
385
  if ( get_post() && get_post()->post_type == Ecwid_Products::POST_TYPE_PRODUCT ) {
includes/class-ecwid-static-page.php CHANGED
@@ -102,6 +102,10 @@ class Ecwid_Static_Page {
102
  $params['base_url'] = get_permalink();
103
  }
104
 
 
 
 
 
105
  $accept_language = apply_filters( 'ecwid_lang', $_SERVER['HTTP_ACCEPT_LANGUAGE'] );
106
  $params['lang'] = $accept_language;
107
 
@@ -146,7 +150,7 @@ class Ecwid_Static_Page {
146
 
147
  $url = substr( $url, 0, -1 );
148
 
149
- $cache_key = self::_build_cache_name( $url );
150
  $cached_data = EcwidPlatform::get_from_catalog_cache( $cache_key );
151
 
152
  if ( $cached_data ) {
@@ -169,7 +173,13 @@ class Ecwid_Static_Page {
169
 
170
  $fetched_data = @json_decode( $fetched_data['data'] );
171
 
172
- EcwidPlatform::invalidate_catalog_cache_from( substr($fetched_data->lastUpdated, 0, -3) );
 
 
 
 
 
 
173
 
174
  EcwidPlatform::store_in_catalog_cache( $cache_key, $fetched_data );
175
 
@@ -179,16 +189,6 @@ class Ecwid_Static_Page {
179
  return null;
180
  }
181
 
182
- protected static function _build_cache_name( $key ) {
183
- $cache_suffix = max(
184
- EcwidPlatform::get( EcwidPlatform::CATEGORIES_CACHE_VALID_FROM ),
185
- EcwidPlatform::get( EcwidPlatform::PRODUCTS_CACHE_VALID_FROM ),
186
- EcwidPlatform::get( EcwidPlatform::PROFILE_CACHE_VALID_FROM )
187
- );
188
-
189
- return $key . $cache_suffix;
190
- }
191
-
192
  public static function _get_data_field( $field ) {
193
  $data = self::get_data_for_current_page();
194
 
@@ -277,10 +277,6 @@ class Ecwid_Static_Page {
277
  return true;
278
  }
279
 
280
- if ( array_key_exists( 'offset', $_GET ) ) {
281
- return false;
282
- }
283
-
284
  if ( !EcwidPlatform::is_catalog_cache_trusted() ) {
285
  return false;
286
  }
102
  $params['base_url'] = get_permalink();
103
  }
104
 
105
+ if ( array_key_exists( 'offset', $_GET ) ) {
106
+ $params['offset'] = intval( $_GET['offset'] );
107
+ }
108
+
109
  $accept_language = apply_filters( 'ecwid_lang', $_SERVER['HTTP_ACCEPT_LANGUAGE'] );
110
  $params['lang'] = $accept_language;
111
 
150
 
151
  $url = substr( $url, 0, -1 );
152
 
153
+ $cache_key = $url;
154
  $cached_data = EcwidPlatform::get_from_catalog_cache( $cache_key );
155
 
156
  if ( $cached_data ) {
173
 
174
  $fetched_data = @json_decode( $fetched_data['data'] );
175
 
176
+ if( isset( $fetched_data->lastUpdated ) ) {
177
+ $last_update = substr( $fetched_data->lastUpdated, 0, -3 );
178
+ } else {
179
+ $last_update = time();
180
+ }
181
+
182
+ EcwidPlatform::invalidate_catalog_cache_from( $last_update );
183
 
184
  EcwidPlatform::store_in_catalog_cache( $cache_key, $fetched_data );
185
 
189
  return null;
190
  }
191
 
 
 
 
 
 
 
 
 
 
 
192
  public static function _get_data_field( $field ) {
193
  $data = self::get_data_for_current_page();
194
 
277
  return true;
278
  }
279
 
 
 
 
 
280
  if ( !EcwidPlatform::is_catalog_cache_trusted() ) {
281
  return false;
282
  }
includes/kliken.php CHANGED
@@ -17,7 +17,7 @@ if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Google-Site-Verification' ) ) {
17
  "<!--Kliken Google Site Verification Token Tag-->)%s";
18
 
19
 
20
- $matches = [];
21
  if ( preg_match( $pattern, $info->customHeaderHtmlCode, $matches ) ) {
22
  echo $matches[1];
23
  }
17
  "<!--Kliken Google Site Verification Token Tag-->)%s";
18
 
19
 
20
+ $matches = array();
21
  if ( preg_match( $pattern, $info->customHeaderHtmlCode, $matches ) ) {
22
  echo $matches[1];
23
  }
js/cache-control.js CHANGED
@@ -1,13 +1,15 @@
 
 
 
 
 
 
 
 
 
 
1
  jQuery(document).ready(function() {
2
 
3
- function ecwidCheckApiCache() {
4
- jQuery.getJSON(
5
- ecwidCacheControlParams.ajax_url,
6
- {
7
- action: 'check_api_cache',
8
- }
9
- );
10
- }
11
  ecwidCheckApiCache();
12
 
13
- })
1
+
2
+ ecwidCheckApiCache = function(){
3
+ jQuery.getJSON(
4
+ ecwidCacheControlParams.ajax_url,
5
+ {
6
+ action: 'check_api_cache',
7
+ }
8
+ );
9
+ }
10
+
11
  jQuery(document).ready(function() {
12
 
 
 
 
 
 
 
 
 
13
  ecwidCheckApiCache();
14
 
15
+ });
js/frontend.js CHANGED
@@ -38,15 +38,62 @@ jQuery(document).ready(function() {
38
 
39
  ecwidShoppingCartMakeStoreLinksUseApiCall(jQuery("a[data-ecwid-page]"));
40
 
 
 
 
41
  if ( typeof Ecwid != 'undefined' ) {
42
- Ecwid.OnAPILoaded.add(function() {
43
-
44
  var font = window.ec.config.chameleonDefaults
45
  && window.ec.config.chameleonDefaults.font
46
  && window.ec.config.chameleonDefaults.font['font-family'] || '';
47
  document.cookie = "ec_store_chameleon_font=" + font;
 
 
48
 
49
- });
50
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
- });
38
 
39
  ecwidShoppingCartMakeStoreLinksUseApiCall(jQuery("a[data-ecwid-page]"));
40
 
41
+
42
+
43
+
44
  if ( typeof Ecwid != 'undefined' ) {
45
+ Ecwid.OnAPILoaded.add(function () {
46
+
47
  var font = window.ec.config.chameleonDefaults
48
  && window.ec.config.chameleonDefaults.font
49
  && window.ec.config.chameleonDefaults.font['font-family'] || '';
50
  document.cookie = "ec_store_chameleon_font=" + font;
51
+ })
52
+ };
53
 
54
+ if ( ecwidParams.trackPublicPage ) {
55
+ if ( typeof Ecwid != 'undefined' ) {
56
+ Ecwid.OnAPILoaded.add(function () {
57
+
58
+ var tracker = window['eca'];
59
+
60
+ if (tracker) {
61
+ var noTracking = false;
62
+ var noTrackingWidgets = ['ProductBrowser', 'Product', 'SingleProduct'];
63
+ var initializedWidgets = Ecwid.getInitializedWidgets();
64
+ for (var i = 0; i < noTrackingWidgets.length; i++) {
65
+ if (initializedWidgets.indexOf(noTrackingWidgets[i]) != -1) {
66
+ noTracking = true;
67
+ break;
68
+ }
69
+ }
70
+
71
+ if (!noTracking) {
72
+ tracker('send', {'eventName': 'PAGE_VIEW', entityType: 'PAGE', 'storeId': Ecwid.getOwnerId()});
73
+ }
74
+ }
75
+ });
76
+ } else {
77
+ (function(w, d, analyticsJsUrl, trackerName) {
78
+ w['HeapAnalyticsObject'] = trackerName;
79
+ w[trackerName] = w[trackerName] || function() {
80
+ (w[trackerName].q = w[trackerName].q || []).push(arguments)
81
+ }, w[trackerName].l = 1 * new Date();
82
+ var analyticsScript = d.createElement('script');
83
+ analyticsScript.async = true;
84
+ analyticsScript.src = analyticsJsUrl;
85
+
86
+ var firstScript = d.getElementsByTagName('script')[0];
87
+ var maxAttempts = 50;
88
+ var interval = setInterval(function() {
89
+ if (/loaded|complete/.test(d.readyState) || (0 === maxAttempts--)) {
90
+ firstScript.parentNode.insertBefore(analyticsScript, firstScript);
91
+ clearInterval(interval)
92
+ }
93
+ }, 100);
94
+ })(window, document, 'https://ecomm.events/i.js', "eca");
95
+ eca('send', {'eventName': 'PAGE_VIEW', entityType: 'PAGE', 'storeId': ecwidParams.storeId});
96
+ }
97
+ }
98
 
99
+ });
js/static-page.js CHANGED
@@ -99,6 +99,8 @@
99
 
100
  function setupAfterEcwidLoaded() {
101
 
 
 
102
  Ecwid.OnAPILoaded.add(function () {
103
  var storeClosed = window.ecwid_initial_data.data.storeClosed;
104
  var storeClosedWrapper = document.querySelectorAll('.ecwid-maintenance-wrapper');
@@ -120,7 +122,8 @@
120
  if (openedPage.type === "CART"
121
  || openedPage.type === "ORDERS"
122
  || openedPage.type === "FAVORITES"
123
- || openedPage.type === "SIGN_IN") {
 
124
  // static links from bottom of the page should be processed before page load event finishes,
125
  // so self pre-opening scroll didn't make the page jump
126
  switchToDynamicMode();
@@ -172,7 +175,10 @@
172
 
173
  function addStaticPageHandlers() {
174
  function addClickHandlers(selector, elementProcessor) {
175
- document.querySelectorAll(selector).forEach(elementProcessor);
 
 
 
176
  }
177
 
178
  addClickHandlers('#' + staticId + ' .ec-breadcrumbs a', function (element) {
@@ -346,7 +352,9 @@
346
  showStorefront();
347
  hideStaticHtml();
348
  var staticEl = find('#' + staticId);
349
- staticEl.remove();
 
 
350
  var switchToDynamicCallback = window.ec.storefront.staticPages.switchToDynamicCallback;
351
  if (!autoSwitchStaticToDynamicWhenReady && switchToDynamicCallback) {
352
  switchToDynamicCallback();
99
 
100
  function setupAfterEcwidLoaded() {
101
 
102
+ // если магазин не закрыт для клиента, то в storeClosed не будет true
103
+ // если магазин не закрыт для клиента и мы загрузили закрытую плашку проверим это в динамике
104
  Ecwid.OnAPILoaded.add(function () {
105
  var storeClosed = window.ecwid_initial_data.data.storeClosed;
106
  var storeClosedWrapper = document.querySelectorAll('.ecwid-maintenance-wrapper');
122
  if (openedPage.type === "CART"
123
  || openedPage.type === "ORDERS"
124
  || openedPage.type === "FAVORITES"
125
+ || openedPage.type === "SIGN_IN"
126
+ || openedPage.type === "RESET_PASSWORD") {
127
  // static links from bottom of the page should be processed before page load event finishes,
128
  // so self pre-opening scroll didn't make the page jump
129
  switchToDynamicMode();
175
 
176
  function addStaticPageHandlers() {
177
  function addClickHandlers(selector, elementProcessor) {
178
+ var elements = document.querySelectorAll(selector);
179
+ for (var i = 0; i < elements.length; i++) {
180
+ elementProcessor(elements[i]);
181
+ }
182
  }
183
 
184
  addClickHandlers('#' + staticId + ' .ec-breadcrumbs a', function (element) {
352
  showStorefront();
353
  hideStaticHtml();
354
  var staticEl = find('#' + staticId);
355
+ if (staticEl && staticEl.parentNode) {
356
+ staticEl.parentNode.removeChild(staticEl);
357
+ }
358
  var switchToDynamicCallback = window.ec.storefront.staticPages.switchToDynamicCallback;
359
  if (!autoSwitchStaticToDynamicWhenReady && switchToDynamicCallback) {
360
  switchToDynamicCallback();
lib/ecwid_platform.php CHANGED
@@ -298,16 +298,15 @@ class EcwidPlatform {
298
  {
299
  $result = null;
300
 
301
- $args =array();
302
 
303
- if (!empty($params)) {
304
  $args = $params;
305
  }
306
 
307
  $args['body'] = $data;
308
 
309
- if (get_option('ecwid_http_use_stream', false) !== true) {
310
-
311
  $result = wp_remote_post( $url, $args );
312
  }
313
 
298
  {
299
  $result = null;
300
 
301
+ $args = array();
302
 
303
+ if ( !empty( $params ) ) {
304
  $args = $params;
305
  }
306
 
307
  $args['body'] = $data;
308
 
309
+ if ( get_option('ecwid_http_use_stream', false) !== true) {
 
310
  $result = wp_remote_post( $url, $args );
311
  }
312
 
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.2
6
- Stable tag: 6.8.3
7
 
8
  Powerful, easy to use ecommerce shopping cart. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.
9
 
@@ -153,6 +153,10 @@ You can use Ecwid’s built-in import tools to copy your store products from any
153
  * [Ecwid eCommerce Forums](https://www.ecwid.com/forums/forumdisplay.php?f=19)
154
 
155
  == Changelog ==
 
 
 
 
156
  = 6.8.3 - Jul 1, 2019 =
157
  - **Fixed scroll issues.** Ecwid adjusts the browser scroll when someone navigates to product and category pages in your shop. This is to make sure a visitor will see the product pages aligned well on the page. This didn't work well on some sites — we fixed that.
158
  - A few bug fixes in the Ecwid ecommerce blocks in Gutenberg.
3
  Tags: ecommerce, e-commerce, storefront, online store, sell
4
  Requires at least: 3.7
5
  Tested up to: 5.2
6
+ Stable tag: 6.8.4
7
 
8
  Powerful, easy to use ecommerce shopping cart. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.
9
 
153
  * [Ecwid eCommerce Forums](https://www.ecwid.com/forums/forumdisplay.php?f=19)
154
 
155
  == Changelog ==
156
+ = 6.8.4 - Jul 9, 2019 =
157
+ - **Several fixes and improvements for the recently released “Store page speedup” feature.** In particular, the changes improve the caching mechanism to avoid high database usage and fix layout issues in Internet Exporer browser. If you haven’t tried the store speedup tool yet, please feel free to do so on the Ecwid/Advanced setting page in your WordPress admin backend.
158
+ - **Fixed a warning on the sites with old PHP versions**. If your ecommerce site is running on an outdated PHP version, this update might fix a warning 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
+
160
  = 6.8.3 - Jul 1, 2019 =
161
  - **Fixed scroll issues.** Ecwid adjusts the browser scroll when someone navigates to product and category pages in your shop. This is to make sure a visitor will see the product pages aligned well on the page. This didn't work well on some sites — we fixed that.
162
  - A few bug fixes in the Ecwid ecommerce blocks in Gutenberg.