Ecwid Ecommerce Shopping Cart - Version 6.8.5

Version Description

  • Jul 25, 2019 =
  • Improvements for the "Store page speedup" feature. 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.
  • Several fixes and improvements for the "Import from WooCommerce" tool.
  • Fixed a "Call to undefined function pll_current_language()" error message to improve compatibility with the Polylang plugin.
  • Minor fixes and improvements.
Download this release

Release Info

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

Code changes from version 6.8.4 to 6.8.5

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.4
9
  Author URI: https://ecwid.to/ecwid-site
10
  */
11
 
@@ -373,7 +373,8 @@ 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
- $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(
@@ -1328,13 +1329,9 @@ function ecwid_wrap_shortcode_content($content, $name, $attrs)
1328
 
1329
  function ecwid_get_scriptjs_code( $force_lang = null ) {
1330
  static $code = '';
1331
-
1332
- if( is_null( $force_lang ) ) {
1333
- $force_lang = apply_filters( 'ecwid_lang', $force_lang );
1334
- }
1335
 
1336
  $store_id = get_ecwid_store_id();
1337
- $params = ecwid_get_scriptjs_params( $force_lang );
1338
 
1339
  $code = '<script data-cfasync="false" type="text/javascript" src="https://' . Ecwid_Config::get_scriptjs_domain() . '/script.js?' . $store_id . $params . '"></script>';
1340
  $code .= ecwid_sso();
@@ -1359,6 +1356,10 @@ function ecwid_get_default_language( $lang ) {
1359
 
1360
  function ecwid_get_scriptjs_params( $force_lang = null ) {
1361
 
 
 
 
 
1362
  $store_id = get_ecwid_store_id();
1363
  $force_lang_str = !empty( $force_lang ) ? "&lang=$force_lang" : '';
1364
  $params = '&data_platform=wporg' . $force_lang_str;
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.5
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
+ $current_post = get_post();
377
+ $need_tracking = !empty( $current_post ) && $current_post->post_status == 'publish' && $current_post->post_password == '' && !ecwid_is_demo_store();
378
 
379
  wp_enqueue_script( 'ecwid-frontend-js', ECWID_PLUGIN_URL . 'js/frontend.js', array( 'jquery' ), get_option( 'ecwid_plugin_version' ) );
380
  wp_localize_script( 'ecwid-frontend-js', 'ecwidParams', array(
1329
 
1330
  function ecwid_get_scriptjs_code( $force_lang = null ) {
1331
  static $code = '';
 
 
 
 
1332
 
1333
  $store_id = get_ecwid_store_id();
1334
+ $params = ecwid_get_scriptjs_params();
1335
 
1336
  $code = '<script data-cfasync="false" type="text/javascript" src="https://' . Ecwid_Config::get_scriptjs_domain() . '/script.js?' . $store_id . $params . '"></script>';
1337
  $code .= ecwid_sso();
1356
 
1357
  function ecwid_get_scriptjs_params( $force_lang = null ) {
1358
 
1359
+ if( is_null( $force_lang ) ) {
1360
+ $force_lang = apply_filters( 'ecwid_lang', $force_lang );
1361
+ }
1362
+
1363
  $store_id = get_ecwid_store_id();
1364
  $force_lang_str = !empty( $force_lang ) ? "&lang=$force_lang" : '';
1365
  $params = '&data_platform=wporg' . $force_lang_str;
includes/class-ecwid-products.php CHANGED
@@ -37,7 +37,6 @@ class Ecwid_Products {
37
  add_filter( 'post_thumbnail_html', array( $this, 'thumbnail' ) );
38
  add_action( 'wp_ajax_ecwid_get_post_link', array($this, 'ajax_get_post_link' ) );
39
  add_action( 'wp_ajax_nopriv_ecwid_get_post_link', array($this, 'ajax_get_post_link' ) );
40
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_frontend' ) );
41
  add_filter( 'post_type_link', array( $this, 'replace_product_page_url_on_search' ), 10, 3 );
42
  add_action( 'template_redirect', array( $this, 'redirect_to_store_page' ) );
43
  add_action( 'ecwid_on_plugin_update', array( $this, 'on_plugin_update' ) );
@@ -59,14 +58,7 @@ class Ecwid_Products {
59
  public function enqueue_admin() {
60
  EcwidPlatform::enqueue_style( 'sync.css' );
61
  }
62
-
63
- public function enqueue_frontend() {
64
- wp_enqueue_script('ecwid-product-page', ECWID_PLUGIN_URL . 'js/product.js', array('jquery'), get_option('ecwid_plugin_version'));
65
- wp_localize_script('ecwid-product-page', 'ecwidProduct', array(
66
- 'ajaxurl' => admin_url('admin-ajax.php')
67
- ));
68
- }
69
-
70
  public function replace_product_page_url_on_search( $url, $post, $leavename = false ) {
71
  if ( $post->post_type == self::POST_TYPE_PRODUCT ) {
72
  $new_url = $this->_get_post_link( $post->ID );
37
  add_filter( 'post_thumbnail_html', array( $this, 'thumbnail' ) );
38
  add_action( 'wp_ajax_ecwid_get_post_link', array($this, 'ajax_get_post_link' ) );
39
  add_action( 'wp_ajax_nopriv_ecwid_get_post_link', array($this, 'ajax_get_post_link' ) );
 
40
  add_filter( 'post_type_link', array( $this, 'replace_product_page_url_on_search' ), 10, 3 );
41
  add_action( 'template_redirect', array( $this, 'redirect_to_store_page' ) );
42
  add_action( 'ecwid_on_plugin_update', array( $this, 'on_plugin_update' ) );
58
  public function enqueue_admin() {
59
  EcwidPlatform::enqueue_style( 'sync.css' );
60
  }
61
+
 
 
 
 
 
 
 
62
  public function replace_product_page_url_on_search( $url, $post, $leavename = false ) {
63
  if ( $post->post_type == self::POST_TYPE_PRODUCT ) {
64
  $new_url = $this->_get_post_link( $post->ID );
includes/class-ecwid-static-page.php CHANGED
@@ -106,7 +106,12 @@ class Ecwid_Static_Page {
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
 
112
  foreach ( $pb_attribures as $attribute ) {
@@ -141,7 +146,6 @@ class Ecwid_Static_Page {
141
  }
142
  }
143
 
144
-
145
  $url = self::_get_endpoint_url( $endpoint_params );
146
 
147
  foreach ( $params as $name => $value ) {
@@ -269,7 +273,7 @@ class Ecwid_Static_Page {
269
  }
270
 
271
  $store_page_params = Ecwid_Store_Page::get_store_page_params();
272
- if ( @$store_page_params['default_category_id'] || @$store_page_params['default_product_id'] ) {
273
  return false;
274
  }
275
 
@@ -293,7 +297,7 @@ class Ecwid_Static_Page {
293
  return false;
294
  }
295
 
296
- if ( 0 && get_ecwid_store_id() > 15182050 && get_ecwid_store_id() % 2 == 0 ) {
297
  return true;
298
  }
299
 
106
  $params['offset'] = intval( $_GET['offset'] );
107
  }
108
 
109
+ if( !array_key_exists( 'category', $_GET) && isset( $store_page_params['default_category_id'] ) && $store_page_params['default_category_id'] > 0 ) {
110
+ $params['default_category_id'] = $store_page_params['default_category_id'];
111
+ }
112
+
113
+ $accept_language = apply_filters( 'ecwid_lang', @$_SERVER['HTTP_ACCEPT_LANGUAGE'] );
114
+
115
  $params['lang'] = $accept_language;
116
 
117
  foreach ( $pb_attribures as $attribute ) {
146
  }
147
  }
148
 
 
149
  $url = self::_get_endpoint_url( $endpoint_params );
150
 
151
  foreach ( $params as $name => $value ) {
273
  }
274
 
275
  $store_page_params = Ecwid_Store_Page::get_store_page_params();
276
+ if ( @$store_page_params['default_product_id'] ) {
277
  return false;
278
  }
279
 
297
  return false;
298
  }
299
 
300
+ if ( get_option( self::OPTION_IS_ENABLED ) == '' && get_ecwid_store_id() % 5 == 0 ) {
301
  return true;
302
  }
303
 
includes/importer/class-ecwid-import.php CHANGED
@@ -55,7 +55,7 @@ class Ecwid_Import
55
  $ecwid_categories = $api->get_categories(array('limit' => 1));
56
  $result['ecwid_total_categories'] = $ecwid_categories->total;
57
 
58
- $result['allow_delete_demo'] = count( Ecwid_Importer::get_ecwid_demo_products() > 0 );
59
 
60
  $count = wp_count_posts( 'product' );
61
 
55
  $ecwid_categories = $api->get_categories(array('limit' => 1));
56
  $result['ecwid_total_categories'] = $ecwid_categories->total;
57
 
58
+ $result['allow_delete_demo'] = count( Ecwid_Importer::get_ecwid_demo_products() ) > 0;
59
 
60
  $count = wp_count_posts( 'product' );
61
 
includes/importer/class-ecwid-importer.php CHANGED
@@ -58,7 +58,7 @@ class Ecwid_Importer
58
  $current_task = $this->_get_current_task();
59
 
60
  $task_data = $this->_tasks[$current_task];
61
-
62
  if ( !isset( $status['plan_limit'] )
63
  || !is_array( $status['plan_limit'] )
64
  || !array_key_exists( $task_data['type'], $status['plan_limit'] )
@@ -81,11 +81,17 @@ class Ecwid_Importer
81
  if ( is_wp_error( $error_data ) ) {
82
  $message = var_export( $result['data']->get_error_message(), true );
83
  } elseif ( is_array( $error_data ) ) {
 
84
  $message = @$error_data['response']['code'];
85
- if ( $error_data['http_message'] ) {
 
 
 
 
 
86
  $message .= ' ' . $error_data['http_message'];
87
  }
88
-
89
  if ( @$error_data['api_message'] ) {
90
  $message .= ':' . $error_data['api_message'];
91
  }
@@ -93,6 +99,7 @@ class Ecwid_Importer
93
  if ( @$error_data['api_code'] ) {
94
  $message .= '(' . $error_data['api_code'] . ')';
95
  }
 
96
  } elseif ( @$error_data == 'skipped' ) {
97
  $message = $result['message'];
98
  }
58
  $current_task = $this->_get_current_task();
59
 
60
  $task_data = $this->_tasks[$current_task];
61
+
62
  if ( !isset( $status['plan_limit'] )
63
  || !is_array( $status['plan_limit'] )
64
  || !array_key_exists( $task_data['type'], $status['plan_limit'] )
81
  if ( is_wp_error( $error_data ) ) {
82
  $message = var_export( $result['data']->get_error_message(), true );
83
  } elseif ( is_array( $error_data ) ) {
84
+
85
  $message = @$error_data['response']['code'];
86
+
87
+ if ( $error_data['response']['message'] ) {
88
+ $message .= ' ' . $error_data['response']['message'];
89
+ }
90
+
91
+ if ( @$error_data['http_message'] ) {
92
  $message .= ' ' . $error_data['http_message'];
93
  }
94
+
95
  if ( @$error_data['api_message'] ) {
96
  $message .= ':' . $error_data['api_message'];
97
  }
99
  if ( @$error_data['api_code'] ) {
100
  $message .= '(' . $error_data['api_code'] . ')';
101
  }
102
+
103
  } elseif ( @$error_data == 'skipped' ) {
104
  $message = $result['message'];
105
  }
includes/importer/task/class-ecwid-importer-task-create-product-variation.php CHANGED
@@ -46,7 +46,7 @@ class Ecwid_Importer_Task_Create_Product_Variation extends Ecwid_Importer_Task_P
46
 
47
  $variation_data['price'] = $var['display_price'];
48
  if ($var['weight']) {
49
- $variation_data['weight'] = $var['weight'];
50
  }
51
  if ($var['max_qty']) {
52
  $variation_data['quantity'] = $var['max_qty'];
46
 
47
  $variation_data['price'] = $var['display_price'];
48
  if ($var['weight']) {
49
+ $variation_data['weight'] = (float)$var['weight'];
50
  }
51
  if ($var['max_qty']) {
52
  $variation_data['quantity'] = $var['max_qty'];
includes/importer/task/class-ecwid-importer-task-create-product.php CHANGED
@@ -9,7 +9,7 @@ class Ecwid_Importer_Task_Create_Product extends Ecwid_Importer_Task_Product_Bas
9
  public function execute( Ecwid_Importer $exporter, array $product_data ) {
10
 
11
  $this->_woo_product_id = $product_data['woo_id'];
12
-
13
  $product = wc_get_product( $this->_woo_product_id );
14
 
15
  $data = array(
@@ -59,7 +59,13 @@ class Ecwid_Importer_Task_Create_Product extends Ecwid_Importer_Task_Product_Bas
59
  $api = new Ecwid_Api_V3();
60
 
61
  if ( $exporter->get_setting( Ecwid_Importer::SETTING_UPDATE_BY_SKU ) ) {
62
- $products = $api->get_products( array( 'sku' => $data['sku'] ) );
 
 
 
 
 
 
63
 
64
  if ( $products->total > 0 ) {
65
  $ecwid_id = $products->items[0]->id;
9
  public function execute( Ecwid_Importer $exporter, array $product_data ) {
10
 
11
  $this->_woo_product_id = $product_data['woo_id'];
12
+
13
  $product = wc_get_product( $this->_woo_product_id );
14
 
15
  $data = array(
59
  $api = new Ecwid_Api_V3();
60
 
61
  if ( $exporter->get_setting( Ecwid_Importer::SETTING_UPDATE_BY_SKU ) ) {
62
+
63
+ if( isset( $data['sku'] ) ) {
64
+ $filter = array( 'sku' => $data['sku'] );
65
+ } else {
66
+ $filter = array( 'id' => $this->_woo_product_id );
67
+ }
68
+ $products = $api->get_products( $filter );
69
 
70
  if ( $products->total > 0 ) {
71
  $ecwid_id = $products->items[0]->id;
includes/integrations/class-ecwid-integration-polylang.php CHANGED
@@ -12,7 +12,9 @@ class Ecwid_Integration_Polylang
12
  }
13
 
14
  public function force_scriptjs_lang( $lang ) {
15
- $lang = pll_current_language();
 
 
16
  return $lang;
17
  }
18
 
12
  }
13
 
14
  public function force_scriptjs_lang( $lang ) {
15
+ if( function_exists('pll_current_language') ) {
16
+ $lang = pll_current_language();
17
+ }
18
  return $lang;
19
  }
20
 
js/cache-control.js CHANGED
@@ -9,7 +9,15 @@ ecwidCheckApiCache = function(){
9
  }
10
 
11
  jQuery(document).ready(function() {
 
 
 
 
12
 
 
 
 
13
  ecwidCheckApiCache();
14
 
15
- });
 
9
  }
10
 
11
  jQuery(document).ready(function() {
12
+
13
+ if( document.cookie.search("ecwid_event_is_working_beforeunload") < 0 ) {
14
+ ecwidCheckApiCache();
15
+ }
16
 
17
+ });
18
+
19
+ jQuery(window).on('beforeunload', function() {
20
  ecwidCheckApiCache();
21
 
22
+ document.cookie = "ecwid_event_is_working_beforeunload=true";
23
+ });
lib/ecwid_api_v3.php CHANGED
@@ -270,6 +270,8 @@ class Ecwid_Api_V3
270
 
271
  if ( Ecwid_Seo_Links::is_enabled() ) {
272
  $params['cleanUrls'] = 'true';
 
 
273
  }
274
 
275
  $url = $this->build_request_url(
270
 
271
  if ( Ecwid_Seo_Links::is_enabled() ) {
272
  $params['cleanUrls'] = 'true';
273
+ } else {
274
+ $params['cleanUrls'] = 'false';
275
  }
276
 
277
  $url = $this->build_request_url(
lib/ecwid_platform.php CHANGED
@@ -250,11 +250,12 @@ class EcwidPlatform {
250
  if (get_option('ecwid_http_use_stream', false)) {
251
  self::$http_use_streams = true;
252
  }
 
253
  $result = wp_remote_get( $url, array_merge(
254
- $options,
255
  array(
256
  'timeout' => get_option( 'ecwid_remote_get_timeout', $default_timeout )
257
- )
 
258
  )
259
  );
260
 
250
  if (get_option('ecwid_http_use_stream', false)) {
251
  self::$http_use_streams = true;
252
  }
253
+
254
  $result = wp_remote_get( $url, array_merge(
 
255
  array(
256
  'timeout' => get_option( 'ecwid_remote_get_timeout', $default_timeout )
257
+ ),
258
+ $options
259
  )
260
  );
261
 
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.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,6 +153,12 @@ 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.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.
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.5
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.5 - Jul 25, 2019 =
157
+ - **Improvements for the "Store page speedup" feature.** 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
+ - **Several fixes and improvements for the "Import from WooCommerce" tool.**
159
+ - **Fixed a "Call to undefined function pll_current_language()" error message** to improve compatibility with the Polylang plugin.
160
+ - Minor fixes and improvements.
161
+
162
  = 6.8.4 - Jul 9, 2019 =
163
  - **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.
164
  - **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.
templates/advanced-settings.php CHANGED
@@ -192,7 +192,7 @@
192
  name="<?php echo Ecwid_Static_Page::OPTION_IS_ENABLED; ?>"
193
  type="checkbox"
194
 
195
- <?php if ( get_option( Ecwid_Static_Page::OPTION_IS_ENABLED ) == Ecwid_Static_Page::OPTION_VALUE_ENABLED ): ?>
196
  checked="checked"
197
  <?php endif; ?>
198
 
192
  name="<?php echo Ecwid_Static_Page::OPTION_IS_ENABLED; ?>"
193
  type="checkbox"
194
 
195
+ <?php if ( get_option( Ecwid_Static_Page::OPTION_IS_ENABLED ) == Ecwid_Static_Page::OPTION_VALUE_ENABLED || Ecwid_Static_Page::is_enabled_static_home_page() ): ?>
196
  checked="checked"
197
  <?php endif; ?>
198