Ecwid Ecommerce Shopping Cart - Version 6.0.3

Version Description

  • Apr 19, 2018 =
  • Fixed incorrect sorting in the store categories menu widgets. If you use display store categories inn your site menu or in a sidebar using the Ecwid categories sidebar widget, you might notice that the categories list order differs from that in your store control panel. We fixed that now the sorting matches.
  • Fixed unclickable products/categories in storefront. This issue appeared in very rare occasions, when a site is running on https (like https://example.com) but someone opens it using an http link (http://example.com). If there was no redirect (it happens sometimes), you might notice that your store product listing doesnt react on clicks in the http version of your site. We fixed that now it works well in all cases. We recommend redirecting http to https version though anyway.
Download this release

Release Info

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

Code changes from version 6.0.2 to 6.0.3

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 Team
8
- Version: 6.0.2
9
  Author URI: http://www.ecwid.com?source=wporg
10
  */
11
 
@@ -980,6 +980,17 @@ function ecwid_content_has_productbrowser( $content ) {
980
  return $result;
981
  }
982
 
 
 
 
 
 
 
 
 
 
 
 
983
  function ecwid_ajax_crawling_fragment() {
984
 
985
  if ( !Ecwid_Api_V3::is_available() ) return;
@@ -1924,6 +1935,7 @@ function ecwid_reset_categories_cache()
1924
 
1925
  EcwidPlatform::cache_reset( 'nav_categories_posts' );
1926
  EcwidPlatform::cache_reset( 'all_categories' );
 
1927
  }
1928
 
1929
  add_action( 'tool_box', 'ecwid_add_toolbox' );
@@ -2235,11 +2247,7 @@ function ecwid_get_admin_sso_url( $time, $page = '' ) {
2235
  return false;
2236
  }
2237
 
2238
- if (function_exists('get_user_locale')) {
2239
- $lang = get_user_locale();
2240
- } else {
2241
- $lang = get_locale();
2242
- }
2243
 
2244
  return sprintf(
2245
  'https://' . Ecwid_Config::get_cpanel_domain() . '/api/v3/%s/sso?token=%s&timestamp=%s&signature=%s&place=%s&lang=%s',
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 Team
8
+ Version: 6.0.3
9
  Author URI: http://www.ecwid.com?source=wporg
10
  */
11
 
980
  return $result;
981
  }
982
 
983
+ function ecwid_get_current_user_locale()
984
+ {
985
+ if (function_exists('get_user_locale')) {
986
+ $lang = get_user_locale();
987
+ } else {
988
+ $lang = get_locale();
989
+ }
990
+
991
+ return $lang;
992
+ }
993
+
994
  function ecwid_ajax_crawling_fragment() {
995
 
996
  if ( !Ecwid_Api_V3::is_available() ) return;
1935
 
1936
  EcwidPlatform::cache_reset( 'nav_categories_posts' );
1937
  EcwidPlatform::cache_reset( 'all_categories' );
1938
+ EcwidPlatform::invalidate_categories_cache_from();
1939
  }
1940
 
1941
  add_action( 'tool_box', 'ecwid_add_toolbox' );
2247
  return false;
2248
  }
2249
 
2250
+ $lang = ecwid_get_current_user_locale();
 
 
 
 
2251
 
2252
  return sprintf(
2253
  'https://' . Ecwid_Config::get_cpanel_domain() . '/api/v3/%s/sso?token=%s&timestamp=%s&signature=%s&place=%s&lang=%s',
includes/class-ecwid-nav-menus.php CHANGED
@@ -210,10 +210,16 @@ class Ecwid_Nav_Menus {
210
  if ( !$posts ) {
211
  $posts = array();
212
  $api = new Ecwid_Api_V3();
213
- $categories = $api->get_categories( array( 'parent' => 0 ) );
214
 
215
- if ($categories) {
216
- foreach ($categories->items as $category) {
 
 
 
 
 
 
217
  $category = Ecwid_Category::get_by_id( $category->id );
218
  $post = new stdClass;
219
  $post->ID = -1;
210
  if ( !$posts ) {
211
  $posts = array();
212
  $api = new Ecwid_Api_V3();
213
+ $result = $api->get_categories( array( 'parent' => 0 ) );
214
 
215
+
216
+
217
+ if ( $result && $result->count > 0 ) {
218
+
219
+ $categories = $result->items;
220
+ usort( $categories, Ecwid_Category::usort_callback() );
221
+
222
+ foreach ($categories as $category) {
223
  $category = Ecwid_Category::get_by_id( $category->id );
224
  $post = new stdClass;
225
  $post->ID = -1;
includes/class-ecwid-popup-deactivate.php CHANGED
@@ -87,8 +87,8 @@ class Ecwid_Popup_Deactivate extends Ecwid_Popup {
87
  if ( $disabled ) return true;
88
 
89
  if ( Ecwid_Config::is_wl() ) return true;
90
-
91
- if (strpos(get_user_locale(), 'en') !== 0) return true;
92
 
93
  return false;
94
  }
87
  if ( $disabled ) return true;
88
 
89
  if ( Ecwid_Config::is_wl() ) return true;
90
+
91
+ if (strpos(ecwid_get_current_user_locale(), 'en') !== 0) return true;
92
 
93
  return false;
94
  }
includes/class-ecwid-seo-links.php CHANGED
@@ -23,7 +23,7 @@ class Ecwid_Seo_Links {
23
  add_filter( 'redirect_canonical', array( $this, 'redirect_canonical' ), 10, 2 );
24
  add_action( 'template_redirect', array( $this, 'redirect_escaped_fragment' ) );
25
  add_filter( 'get_shortlink', array( $this, 'get_shortlink' ) );
26
-
27
  add_action( 'ecwid_print_inline_js_config', array( $this, 'add_js_config') );
28
 
29
  add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', array( $this, 'is_post_slug_bad'), 10, 4 );
@@ -199,16 +199,20 @@ class Ecwid_Seo_Links {
199
  }
200
 
201
  public function add_js_config() {
202
-
203
  global $wp_query;
204
  $page_id = $wp_query->get( 'page_id' );
205
 
206
  $has_store = Ecwid_Store_Page::is_store_page( $page_id );
207
-
208
- if ( !$has_store ) return;
 
 
 
 
209
 
210
  $url = esc_js( get_page_link( $page_id ) );
211
-
212
  echo <<<JS
213
  window.ec.config.storefrontUrls = window.ec.config.storefrontUrls || {};
214
  window.ec.config.storefrontUrls.cleanUrls = true;
23
  add_filter( 'redirect_canonical', array( $this, 'redirect_canonical' ), 10, 2 );
24
  add_action( 'template_redirect', array( $this, 'redirect_escaped_fragment' ) );
25
  add_filter( 'get_shortlink', array( $this, 'get_shortlink' ) );
26
+
27
  add_action( 'ecwid_print_inline_js_config', array( $this, 'add_js_config') );
28
 
29
  add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', array( $this, 'is_post_slug_bad'), 10, 4 );
199
  }
200
 
201
  public function add_js_config() {
202
+
203
  global $wp_query;
204
  $page_id = $wp_query->get( 'page_id' );
205
 
206
  $has_store = Ecwid_Store_Page::is_store_page( $page_id );
207
+
208
+ if ( !$has_store ) {
209
+ if ( !Ecwid_Ajax_Defer_Renderer::is_enabled() ) {
210
+ return;
211
+ }
212
+ }
213
 
214
  $url = esc_js( get_page_link( $page_id ) );
215
+
216
  echo <<<JS
217
  window.ec.config.storefrontUrls = window.ec.config.storefrontUrls || {};
218
  window.ec.config.storefrontUrls.cleanUrls = true;
includes/class-ecwid-wp-dashboard-feed.php CHANGED
@@ -20,7 +20,7 @@ class Ecwid_WP_Dashboard_Feed {
20
  $media_url = 'https://www.ecwid.com/wp-json/wp/v2/media/';
21
  $images_cdn = 'https://web-cdn.ecwid.com/wp-content/uploads/';
22
 
23
- $lang = get_user_locale();
24
  if ( $lang == 'ru_RU' ) {
25
  $url = 'https://www.ecwid.ru/wp-json/wp/v2/posts?per_page=3&categories=1';
26
  $media_url = 'https://www.ecwid.ru/wp-json/wp/v2/media/';
@@ -60,7 +60,7 @@ class Ecwid_WP_Dashboard_Feed {
60
  protected function _get_cache_name()
61
  {
62
  $name = self::CACHE_POSTS;
63
- $name .= '-' . get_user_locale();
64
 
65
  return $name;
66
  }
20
  $media_url = 'https://www.ecwid.com/wp-json/wp/v2/media/';
21
  $images_cdn = 'https://web-cdn.ecwid.com/wp-content/uploads/';
22
 
23
+ $lang = ecwid_get_current_user_locale();
24
  if ( $lang == 'ru_RU' ) {
25
  $url = 'https://www.ecwid.ru/wp-json/wp/v2/posts?per_page=3&categories=1';
26
  $media_url = 'https://www.ecwid.ru/wp-json/wp/v2/media/';
60
  protected function _get_cache_name()
61
  {
62
  $name = self::CACHE_POSTS;
63
+ $name .= '-' . ecwid_get_current_user_locale();
64
 
65
  return $name;
66
  }
includes/widgets/class-ecwid-widget-vertical-categories-list.php CHANGED
@@ -16,10 +16,13 @@ class Ecwid_Widget_Vertical_Categories_List extends WP_Widget {
16
 
17
  $api = new Ecwid_Api_V3();
18
 
19
- $categories = $api->get_categories(array( 'parent' => 0 ) );
20
 
21
- if ( !$categories || empty( $categories->items ) ) return;
22
 
 
 
 
23
  /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
24
  $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Browse by Category', 'ecwid-shopping-cart' ) : $instance['title'], $instance, $this->id_base );
25
 
@@ -30,7 +33,7 @@ class Ecwid_Widget_Vertical_Categories_List extends WP_Widget {
30
 
31
  echo '<ul>';
32
 
33
- foreach ($categories->items as $category) {
34
  $category = Ecwid_Category::get_by_id( $category->id );
35
  echo '<li>';
36
  echo '<a href="' . $category->link
16
 
17
  $api = new Ecwid_Api_V3();
18
 
19
+ $result = $api->get_categories(array( 'parent' => 0 ) );
20
 
21
+ if ( !$result || empty( $result->items ) ) return;
22
 
23
+ $categories = $result->items;
24
+ usort( $categories, Ecwid_Category::usort_callback() );
25
+
26
  /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
27
  $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Browse by Category', 'ecwid-shopping-cart' ) : $instance['title'], $instance, $this->id_base );
28
 
33
 
34
  echo '<ul>';
35
 
36
+ foreach ($categories as $category) {
37
  $category = Ecwid_Category::get_by_id( $category->id );
38
  echo '<li>';
39
  echo '<a href="' . $category->link
lib/ecwid_api_v3.php CHANGED
@@ -389,7 +389,7 @@ class Ecwid_Api_V3
389
 
390
  $profile = EcwidPlatform::cache_get( self::PROFILE_CACHE_NAME );
391
 
392
- if ($profile) {
393
  return $profile;
394
  }
395
 
389
 
390
  $profile = EcwidPlatform::cache_get( self::PROFILE_CACHE_NAME );
391
 
392
+ if ( $profile ) {
393
  return $profile;
394
  }
395
 
lib/ecwid_category.php CHANGED
@@ -8,6 +8,14 @@ class Ecwid_Category extends Ecwid_Catalog_Entry
8
  protected $_cache_name_prefix = 'ecwid-category-';
9
  protected $_link_prefix = 'c';
10
 
 
 
 
 
 
 
 
 
11
  protected function _get_from_local_object_cache( $id ) {
12
  if ( isset( self::$categories[$id] ) ) {
13
  return self::$categories[$id];
8
  protected $_cache_name_prefix = 'ecwid-category-';
9
  protected $_link_prefix = 'c';
10
 
11
+ public static function usort_callback() {
12
+ return array( 'Ecwid_Category', 'usort_categories_orderby' );
13
+ }
14
+
15
+ public static function usort_categories_orderby( $a, $b ) {
16
+ return @$a->orderBy > @$b->orderBy;
17
+ }
18
+
19
  protected function _get_from_local_object_cache( $id ) {
20
  if ( isset( self::$categories[$id] ) ) {
21
  return self::$categories[$id];
lib/ecwid_platform.php CHANGED
@@ -337,13 +337,15 @@ class EcwidPlatform {
337
  return $type . '_' . md5($url);
338
  }
339
 
340
- static public function invalidate_products_cache_from( $time )
341
  {
 
342
  EcwidPlatform::set( self::PRODUCTS_CACHE_VALID_FROM, $time );
343
  }
344
 
345
- static public function invalidate_categories_cache_from( $time )
346
  {
 
347
  EcwidPlatform::set( self::CATEGORIES_CACHE_VALID_FROM, $time );
348
  }
349
  }
337
  return $type . '_' . md5($url);
338
  }
339
 
340
+ static public function invalidate_products_cache_from( $time = null )
341
  {
342
+ $time = is_null( $time ) ? time() : $time;
343
  EcwidPlatform::set( self::PRODUCTS_CACHE_VALID_FROM, $time );
344
  }
345
 
346
+ static public function invalidate_categories_cache_from( $time = null )
347
  {
348
+ $time = is_null( $time ) ? time() : $time;
349
  EcwidPlatform::set( self::CATEGORIES_CACHE_VALID_FROM, $time );
350
  }
351
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Ecwid
3
  Tags: ecommerce, downloadable products, Facebook ecommerce, online store, paypal, product catalog, shop, shopping cart, store
4
  Requires at least: 3.5
5
  Tested up to: 4.9
6
- Stable tag: 6.0.2
7
 
8
  Powerful, easy to use ecommerce shopping cart. Bank level PCI DSS Level 1 security. iPhone & Android apps. Superb support. Free plan available.
9
 
@@ -149,6 +149,10 @@ You can use Ecwid’s built-in import tools to copy your store products from any
149
  * [Ecwid eCommerce Forums](https://www.ecwid.com/forums/forumdisplay.php?f=19)
150
 
151
  == Changelog ==
 
 
 
 
152
  = 6.0.2 - Apr 13, 2018 =
153
  - Fixed an error that occurred under specific server configurations.
154
 
3
  Tags: ecommerce, downloadable products, Facebook ecommerce, online store, paypal, product catalog, shop, shopping cart, store
4
  Requires at least: 3.5
5
  Tested up to: 4.9
6
+ Stable tag: 6.0.3
7
 
8
  Powerful, easy to use ecommerce shopping cart. Bank level PCI DSS Level 1 security. iPhone & Android apps. Superb support. Free plan available.
9
 
149
  * [Ecwid eCommerce Forums](https://www.ecwid.com/forums/forumdisplay.php?f=19)
150
 
151
  == Changelog ==
152
+ = 6.0.3 - Apr 19, 2018 =
153
+ - Fixed incorrect sorting in the store categories menu widgets. If you use display store categories inn your site menu or in a sidebar using the Ecwid categories sidebar widget, you might notice that the categories list order differs from that in your store control panel. We fixed that — now the sorting matches.
154
+ - Fixed unclickable products/categories in storefront. This issue appeared in very rare occasions, when a site is running on https (like https://example.com) but someone opens it using an http link (http://example.com). If there was no redirect (it happens sometimes), you might notice that your store product listing doesn’t react on clicks in the http version of your site. We fixed that — now it works well in all cases. We recommend redirecting http to https version though anyway.
155
+
156
  = 6.0.2 - Apr 13, 2018 =
157
  - Fixed an error that occurred under specific server configurations.
158
 
templates/admin-message.php CHANGED
@@ -49,4 +49,4 @@
49
  </div>
50
  </div>
51
  <?php endif; ?>
52
- </div>
49
  </div>
50
  </div>
51
  <?php endif; ?>
52
+ </div>
templates/importer/landing.tpl.php CHANGED
@@ -33,4 +33,4 @@
33
  </p>
34
  </div>
35
 
36
- </div>
33
  </p>
34
  </div>
35
 
36
+ </div>