Ecwid Ecommerce Shopping Cart - Version 5.4.3

Version Description

  • Speed optimization for the plugin settings pages. We improved the plugin admin settings code to make sure it requires less time and resources and thus works faster.
  • Fixed a bug in the integration with the Google XML Sitemaps plugin. The sitemaps generated by that plugin might contain invalid data related to the store product pages. That was caused by a bug in the Ecwid plugin. We fixed that, your sitemap should work fine now.
  • Fixed the preg_match warning messages appearing in rare occasions on the plugin pages. If you happen to see those messages on your site, please update the Ecwid online store plugin, it should fix them.
  • Bug fixes and improvements for the SEO content of the product and categories pages on the site. This is for search engines to be able to index your store better.
Download this release

Release Info

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

Code changes from version 5.4.2 to 5.4.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: 5.4.2
9
  Author URI: http://www.ecwid.com?source=wporg
10
  */
11
 
@@ -596,13 +596,9 @@ function ecwid_check_version()
596
  add_option('ecwid_remote_get_timeout', '5');
597
  }
598
 
599
- if (ecwid_migrations_is_original_plugin_version_older_than('4.1.3')) {
600
- add_option( 'ecwid_support_email', 'wordpress@ecwid.com' );
601
- }
602
 
603
- if (ecwid_migrations_is_original_plugin_version_older_than('4.4.5')) {
604
- add_option('ecwid_enable_sso');
605
- }
606
 
607
  add_option( Ecwid_Products::OPTION_ENABLED, Ecwid_Products::is_enabled() );
608
 
@@ -624,6 +620,9 @@ function ecwid_check_version()
624
  // Since 5.4.2
625
  delete_option('ecwid_hide_appearance_menu');
626
 
 
 
 
627
  Ecwid_Config::load_from_ini();
628
 
629
  add_option( 'force_scriptjs_render', false );
@@ -792,11 +791,10 @@ function ecwid_check_api_cache()
792
  {
793
  $last_cache = get_option('ecwid_last_api_cache_check');
794
 
 
795
  if (time() - $last_cache > HOUR_IN_SECONDS ) {
796
  ecwid_invalidate_cache();
797
  }
798
-
799
- update_option('ecwid_last_api_cache_check', time());
800
  }
801
 
802
  function ecwid_admin_check_api_cache()
@@ -806,8 +804,6 @@ function ecwid_admin_check_api_cache()
806
  if (time() - $last_cache > MINUTE_IN_SECONDS * 5 ) {
807
  ecwid_invalidate_cache();
808
  }
809
-
810
- update_option('ecwid_last_api_cache_check', time());
811
  }
812
 
813
  function ecwid_invalidate_cache( $full_reset = false)
@@ -830,7 +826,8 @@ function ecwid_invalidate_cache( $full_reset = false)
830
  EcwidPlatform::invalidate_products_cache_from(strtotime($stats->productsUpdated));
831
  EcwidPlatform::invalidate_categories_cache_from(strtotime($stats->categoriesUpdated));
832
  }
833
-
 
834
  }
835
  }
836
 
@@ -1238,8 +1235,7 @@ function _ecwid_get_seo_title()
1238
  }
1239
  }
1240
  }
1241
-
1242
-
1243
  if ( ! empty( $ecwid_seo_title ) ) {
1244
  return $ecwid_seo_title;
1245
  }
@@ -1961,7 +1957,7 @@ function ecwid_general_settings_do_page() {
1961
  } else {
1962
  global $ecwid_oauth;
1963
 
1964
- if ( get_option('ecwid_disable_dashboard') ) {
1965
  require_once ECWID_PLUGIN_DIR . 'templates/dashboard.php';
1966
  } else if ( !$ecwid_oauth->has_scope( 'allow_sso' ) && !isset($_GET['reconnect']) ) {
1967
  if ( ecwid_test_oauth(true) ) {
@@ -1983,46 +1979,7 @@ function ecwid_general_settings_do_page() {
1983
 
1984
  require_once ECWID_PLUGIN_DIR . 'templates/reconnect.php';
1985
  } else {
1986
- $time = time() - get_option('ecwid_time_correction', 0);
1987
- $page = 'dashboard';
1988
-
1989
- $iframe_src = ecwid_get_iframe_src($time, $page);
1990
-
1991
- $request = Ecwid_Http::create_get('embedded_admin_iframe', $iframe_src, array(Ecwid_Http::POLICY_RETURN_VERBOSE));
1992
- if (!$request) {
1993
- echo Ecwid_Message_Manager::show_message('no_oauth');
1994
- return;
1995
- }
1996
-
1997
- $result = $request->do_request(array(
1998
- 'timeout' => 20
1999
- ));
2000
-
2001
- if ($result['code'] == 403 && strpos($result['data'], 'Token too old') !== false ) {
2002
-
2003
- if (isset($result['headers']['date'])) {
2004
- $time = strtotime($result['headers']['date']);
2005
-
2006
- $iframe_src = ecwid_get_iframe_src($time, $page);
2007
-
2008
- $request = Ecwid_Http::create_get('embedded_admin_iframe', $iframe_src, array(Ecwid_Http::POLICY_RETURN_VERBOSE));
2009
- if (!$request) {
2010
- echo Ecwid_Message_Manager::show_message('no_oauth');
2011
- return;
2012
- }
2013
- $result = $request->do_request();
2014
-
2015
- if ($result['code'] == 200) {
2016
- update_option('ecwid_time_correction', time() - $time);
2017
- }
2018
- }
2019
- }
2020
-
2021
- if ( is_array( $result ) && $result['code'] == 200 ) {
2022
- ecwid_admin_do_page( 'dashboard' );
2023
- } else {
2024
- require_once ECWID_PLUGIN_DIR . 'templates/reconnect-sso.php';
2025
- }
2026
  }
2027
  }
2028
  }
@@ -2079,6 +2036,31 @@ function ecwid_admin_do_page( $page ) {
2079
 
2080
  $result = $request->do_request();
2081
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2082
  if (empty($result['code']) && empty($result['data'])) {
2083
  require_once ECWID_PLUGIN_DIR . 'templates/admin-timeout.php';
2084
  } else if ($result['code'] != 200) {
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: 5.4.3
9
  Author URI: http://www.ecwid.com?source=wporg
10
  */
11
 
596
  add_option('ecwid_remote_get_timeout', '5');
597
  }
598
 
599
+ add_option( 'ecwid_support_email', 'wordpress@ecwid.com' );
 
 
600
 
601
+ add_option('ecwid_enable_sso');
 
 
602
 
603
  add_option( Ecwid_Products::OPTION_ENABLED, Ecwid_Products::is_enabled() );
604
 
620
  // Since 5.4.2
621
  delete_option('ecwid_hide_appearance_menu');
622
 
623
+ // Since 5.4.3?
624
+ add_option( Ecwid_Widget_Floating_Shopping_Cart::OPTION_MOVE_INTO_BODY, '' );
625
+
626
  Ecwid_Config::load_from_ini();
627
 
628
  add_option( 'force_scriptjs_render', false );
791
  {
792
  $last_cache = get_option('ecwid_last_api_cache_check');
793
 
794
+
795
  if (time() - $last_cache > HOUR_IN_SECONDS ) {
796
  ecwid_invalidate_cache();
797
  }
 
 
798
  }
799
 
800
  function ecwid_admin_check_api_cache()
804
  if (time() - $last_cache > MINUTE_IN_SECONDS * 5 ) {
805
  ecwid_invalidate_cache();
806
  }
 
 
807
  }
808
 
809
  function ecwid_invalidate_cache( $full_reset = false)
826
  EcwidPlatform::invalidate_products_cache_from(strtotime($stats->productsUpdated));
827
  EcwidPlatform::invalidate_categories_cache_from(strtotime($stats->categoriesUpdated));
828
  }
829
+
830
+ update_option('ecwid_last_api_cache_check', time());
831
  }
832
  }
833
 
1235
  }
1236
  }
1237
  }
1238
+
 
1239
  if ( ! empty( $ecwid_seo_title ) ) {
1240
  return $ecwid_seo_title;
1241
  }
1957
  } else {
1958
  global $ecwid_oauth;
1959
 
1960
+ if ( get_option( 'ecwid_disable_dashboard' ) && !isset( $_GET['reconnect'] ) ) {
1961
  require_once ECWID_PLUGIN_DIR . 'templates/dashboard.php';
1962
  } else if ( !$ecwid_oauth->has_scope( 'allow_sso' ) && !isset($_GET['reconnect']) ) {
1963
  if ( ecwid_test_oauth(true) ) {
1979
 
1980
  require_once ECWID_PLUGIN_DIR . 'templates/reconnect.php';
1981
  } else {
1982
+ ecwid_admin_do_page( 'dashboard' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1983
  }
1984
  }
1985
  }
2036
 
2037
  $result = $request->do_request();
2038
 
2039
+ if ($result['code'] == 403 && strpos($result['data'], 'Token too old') !== false ) {
2040
+
2041
+ if (isset($result['headers']['date'])) {
2042
+ $time = strtotime($result['headers']['date']);
2043
+
2044
+ $iframe_src = ecwid_get_iframe_src($time, $page);
2045
+
2046
+ $request = Ecwid_Http::create_get('embedded_admin_iframe', $iframe_src, array(Ecwid_Http::POLICY_RETURN_VERBOSE));
2047
+ if (!$request) {
2048
+ echo Ecwid_Message_Manager::show_message('no_oauth');
2049
+ return;
2050
+ }
2051
+ $result = $request->do_request();
2052
+
2053
+ if ($result['code'] == 200) {
2054
+ update_option('ecwid_time_correction', time() - $time);
2055
+ }
2056
+ }
2057
+
2058
+ $iframe_src = ecwid_get_iframe_src($time, $page);
2059
+
2060
+ $request = Ecwid_Http::create_get('embedded_admin_iframe', $iframe_src, array(Ecwid_Http::POLICY_RETURN_VERBOSE));
2061
+ $result = $request->do_request();
2062
+ }
2063
+
2064
  if (empty($result['code']) && empty($result['data'])) {
2065
  require_once ECWID_PLUGIN_DIR . 'templates/admin-timeout.php';
2066
  } else if ($result['code'] != 200) {
includes/class-ecwid-admin.php CHANGED
@@ -42,7 +42,7 @@ class Ecwid_Admin {
42
  );
43
 
44
  global $ecwid_oauth;
45
- if (!$is_newbie && $ecwid_oauth->has_scope('allow_sso')) {
46
  add_submenu_page(
47
  self::ADMIN_SLUG,
48
  __('Sales', 'ecwid-shopping-cart'),
42
  );
43
 
44
  global $ecwid_oauth;
45
+ if (!$is_newbie && $ecwid_oauth->has_scope('allow_sso') && !get_option( 'ecwid_disable_dashboard' )) {
46
  add_submenu_page(
47
  self::ADMIN_SLUG,
48
  __('Sales', 'ecwid-shopping-cart'),
includes/class-ecwid-product-popup.php CHANGED
@@ -56,7 +56,6 @@ class Ecwid_Product_Popup {
56
  }
57
 
58
  $params['limit'] = 10;
59
-
60
  $params['offset'] = 0;
61
 
62
  if ( array_key_exists( 'page', $_REQUEST ) ) {
56
  }
57
 
58
  $params['limit'] = 10;
 
59
  $params['offset'] = 0;
60
 
61
  if ( array_key_exists( 'page', $_REQUEST ) ) {
includes/class-ecwid-sitemap-builder.php CHANGED
@@ -8,7 +8,7 @@ class EcwidSitemapBuilder {
8
  const PRIORITY_PRODUCT = 0.6;
9
  const PRIORITY_CATEGORY = 0.5;
10
 
11
- public function __construct($base_url, $callback, $api) {
12
  $this->callback = $callback;
13
  $this->base_url = $base_url;
14
  }
8
  const PRIORITY_PRODUCT = 0.6;
9
  const PRIORITY_CATEGORY = 0.5;
10
 
11
+ public function __construct($base_url, $callback) {
12
  $this->callback = $callback;
13
  $this->base_url = $base_url;
14
  }
includes/class-ecwid-store-page.php CHANGED
@@ -5,6 +5,7 @@ class Ecwid_Store_Page {
5
  const OPTION_STORE_PAGES = 'ecwid_store_pages';
6
  const OPTION_MAIN_STORE_PAGE_ID = 'ecwid_store_page_id';
7
  const OPTION_FLUSH_REWRITES = 'ecwid_flush_rewrites';
 
8
 
9
  protected static $_store_pages = false;
10
 
@@ -174,7 +175,7 @@ class Ecwid_Store_Page {
174
  }
175
 
176
  self::_set_store_pages( $pages );
177
- self::_schedule_flush_rewrite();
178
  }
179
 
180
  public static function reset_store_page( $page_id ) {
@@ -225,7 +226,7 @@ class Ecwid_Store_Page {
225
  return self::$_store_pages;
226
  }
227
 
228
- protected static function _schedule_flush_rewrite() {
229
  update_option( self::OPTION_FLUSH_REWRITES, 1 );
230
  }
231
 
@@ -301,9 +302,45 @@ class Ecwid_Store_Page {
301
  return array('publish', 'private', 'draft');
302
  }
303
 
304
- public static function on_frontend_rendered() {}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
  }
306
 
307
  add_action( 'init', array( 'Ecwid_Store_Page', 'flush_rewrites' ) );
308
- add_action( 'shutdown', array( 'Ecwid_Store_Page', 'on_frontend_rendered' ) );
309
- add_action( 'save_post', array( 'Ecwid_Store_Page', 'on_save_post' ) );
 
5
  const OPTION_STORE_PAGES = 'ecwid_store_pages';
6
  const OPTION_MAIN_STORE_PAGE_ID = 'ecwid_store_page_id';
7
  const OPTION_FLUSH_REWRITES = 'ecwid_flush_rewrites';
8
+ const WARMUP_ACTION = 'ecwid_warmup_store';
9
 
10
  protected static $_store_pages = false;
11
 
175
  }
176
 
177
  self::_set_store_pages( $pages );
178
+ self::schedule_flush_rewrites();
179
  }
180
 
181
  public static function reset_store_page( $page_id ) {
226
  return self::$_store_pages;
227
  }
228
 
229
+ public static function schedule_flush_rewrites() {
230
  update_option( self::OPTION_FLUSH_REWRITES, 1 );
231
  }
232
 
302
  return array('publish', 'private', 'draft');
303
  }
304
 
305
+ public static function warmup_store()
306
+ {
307
+ $store_page = get_post( self::get_current_store_page_id() );
308
+
309
+ if ( !$store_page ) {
310
+ return;
311
+ }
312
+
313
+ $shortcodes = ecwid_find_shortcodes( $store_page->post_content, Ecwid_Shortcode_Base::get_store_shortcode_name() );
314
+
315
+ if ( sizeof( $shortcodes ) == 0 ) {
316
+ return;
317
+ }
318
+
319
+ $shortcode_data = $shortcodes[0];
320
+
321
+ $category = 0;
322
+
323
+ if ( isset( $shortcode_data[3] ) ) {
324
+ $attributes = shortcode_parse_atts($shortcode_data[3]);
325
+
326
+ if ( !$attributes ) {
327
+ return;
328
+ }
329
+
330
+ $category = $attributes['default_category_id'];
331
+ }
332
+
333
+ $page_url = get_page_link($store_page);
334
+
335
+ include_once ECWID_PLUGIN_DIR . 'lib/ecwid_catalog.php';
336
+
337
+ $catalog = new EcwidCatalog(get_ecwid_store_id(), $page_url);
338
+
339
+ $catalog->warmup_store_page(intval($category));
340
+ }
341
  }
342
 
343
  add_action( 'init', array( 'Ecwid_Store_Page', 'flush_rewrites' ) );
344
+ add_action( 'save_post', array( 'Ecwid_Store_Page', 'on_save_post' ) );
345
+ add_action( 'wp_ajax_' . Ecwid_Store_Page::WARMUP_ACTION, array( 'Ecwid_Store_Page', 'warmup_store' ) );
346
+ add_action( 'update_option_page_on_front', array( 'Ecwid_Store_Page', 'schedule_flush_rewrites' ) );
includes/widgets/class-ecwid-widget-floating-shopping-cart.php CHANGED
@@ -1,14 +1,15 @@
1
  <?php
2
  class Ecwid_Widget_Floating_Shopping_Cart extends WP_Widget {
3
  static $was_enqueued = false;
4
-
5
  static protected $positions = array(
6
  'topright',
7
  'bottomright'
8
  );
9
 
10
  const OPTION_DISPLAY_POSITION = 'ecwid_floating_shopping_cart_mode';
11
-
 
12
  static protected $default_position = 'bottomright';
13
 
14
  public function __construct() {
@@ -30,6 +31,21 @@ class Ecwid_Widget_Floating_Shopping_Cart extends WP_Widget {
30
  if (self::$was_enqueued) return;
31
 
32
  wp_enqueue_script('ecwid-floating-shopping-cart', ECWID_PLUGIN_URL . '/js/floating-shopping-cart.js', array('jquery'), get_option('ecwid_plugin_version'), true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  wp_enqueue_style('ecwid-floating-shopping-cart', ECWID_PLUGIN_URL . 'css/floating-shopping-cart.css', array(), get_option('ecwid_plugin_version'));
34
  }
35
 
@@ -82,7 +98,7 @@ class Ecwid_Widget_Floating_Shopping_Cart extends WP_Widget {
82
  <div class="ecwid-cart-icon off">
83
  <a href="$cart_url" data-count="0">
84
  <svg width="20" height="26" viewBox="0 0 20 26" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="M.5 6.5v14.81c0 2.255 1.79 4.084 4 4.084h11c2.21 0 4-1.83 4-4.085V6.5H.5zM6 10.585c.552 0 1-.457 1-1.02C7 9 6.552 8.542 6 8.542S5 9 5 9.563c0 .565.448 1.022 1 1.022zm8 0c.552 0 1-.457 1-1.02 0-.565-.448-1.022-1-1.022S13 9 13 9.563c0 .565.448 1.022 1 1.022z" stroke="#439CA0"/><path d="M14.5 6h-1V4.582c0-1.97-1.57-3.575-3.5-3.575S6.5 2.61 6.5 4.582V6h-1V4.582C5.5 2.048 7.52-.014 10-.014c2.482 0 4.5 2.062 4.5 4.596V6z" fill="#439CA0"/></g></svg>
85
- <div id="ecwid-cart"><script type="text/javascript"> xMinicart("style="); </script></div>
86
  </a>
87
  </div>
88
  </div>
1
  <?php
2
  class Ecwid_Widget_Floating_Shopping_Cart extends WP_Widget {
3
  static $was_enqueued = false;
4
+
5
  static protected $positions = array(
6
  'topright',
7
  'bottomright'
8
  );
9
 
10
  const OPTION_DISPLAY_POSITION = 'ecwid_floating_shopping_cart_mode';
11
+ const OPTION_MOVE_INTO_BODY = 'ecwid_move_floating_shopping_cart_into_body';
12
+
13
  static protected $default_position = 'bottomright';
14
 
15
  public function __construct() {
31
  if (self::$was_enqueued) return;
32
 
33
  wp_enqueue_script('ecwid-floating-shopping-cart', ECWID_PLUGIN_URL . '/js/floating-shopping-cart.js', array('jquery'), get_option('ecwid_plugin_version'), true);
34
+
35
+ $move_to_body = get_option( self::OPTION_MOVE_INTO_BODY );
36
+
37
+ if ( $move_to_body == '' ) {
38
+ $move_to_body = is_plugin_active( 'wptouch/wptouch.php' );
39
+ }
40
+
41
+ wp_localize_script(
42
+ 'ecwid-floating-shopping-cart',
43
+ 'ecwid_floating_shopping_cart_options',
44
+ array(
45
+ 'move_to_body' => intval($move_to_body)
46
+ )
47
+ );
48
+
49
  wp_enqueue_style('ecwid-floating-shopping-cart', ECWID_PLUGIN_URL . 'css/floating-shopping-cart.css', array(), get_option('ecwid_plugin_version'));
50
  }
51
 
98
  <div class="ecwid-cart-icon off">
99
  <a href="$cart_url" data-count="0">
100
  <svg width="20" height="26" viewBox="0 0 20 26" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="M.5 6.5v14.81c0 2.255 1.79 4.084 4 4.084h11c2.21 0 4-1.83 4-4.085V6.5H.5zM6 10.585c.552 0 1-.457 1-1.02C7 9 6.552 8.542 6 8.542S5 9 5 9.563c0 .565.448 1.022 1 1.022zm8 0c.552 0 1-.457 1-1.02 0-.565-.448-1.022-1-1.022S13 9 13 9.563c0 .565.448 1.022 1 1.022z" stroke="#439CA0"/><path d="M14.5 6h-1V4.582c0-1.97-1.57-3.575-3.5-3.575S6.5 2.61 6.5 4.582V6h-1V4.582C5.5 2.048 7.52-.014 10-.014c2.482 0 4.5 2.062 4.5 4.596V6z" fill="#439CA0"/></g></svg>
101
+ <div id="ecwid-cart"><script type="text/javascript"> xMinicart("style=","id=ecwid-cart"); </script></div>
102
  </a>
103
  </div>
104
  </div>
js/floating-shopping-cart.js CHANGED
@@ -17,6 +17,12 @@ var EcwidFloatingShoppingCart = function() {
17
  Ecwid.OnCartChanged.add(function(cartObj) {
18
  changeState(cartObj);
19
  });
 
 
 
 
 
 
20
  }
21
  };
22
 
17
  Ecwid.OnCartChanged.add(function(cartObj) {
18
  changeState(cartObj);
19
  });
20
+
21
+ if (ecwid_floating_shopping_cart_options.move_to_body == 1) {
22
+ jQuery(document).ready(function() {
23
+ jQuery('body').append(jQuery('.ecwid-float-icons'));
24
+ });
25
+ }
26
  }
27
  };
28
 
lib/ecwid_api_v3.php CHANGED
@@ -188,7 +188,7 @@ class Ecwid_Api_V3
188
  $this->_products_api_url,
189
  $params
190
  );
191
-
192
  $result = EcwidPlatform::get_from_products_cache( $url );
193
  if (!$result ) {
194
  $result = EcwidPlatform::fetch_url( $url );
@@ -197,17 +197,19 @@ class Ecwid_Api_V3
197
  }
198
 
199
  EcwidPlatform::store_in_products_cache( $url, $result );
 
200
 
201
- if ( !empty( $result->items ) ) {
202
- foreach ( $result->items as $item ) {
203
- Ecwid_Product::init_from_stdclass( $item );
 
 
 
204
  }
 
205
  }
206
-
207
  }
208
 
209
- $result = json_decode($result['data']);
210
-
211
  return $result;
212
  }
213
 
@@ -261,7 +263,7 @@ class Ecwid_Api_V3
261
  )
262
  );
263
 
264
- if ($result['code'] != '200') {
265
  return false;
266
  }
267
  $result = json_decode($result['data']);
188
  $this->_products_api_url,
189
  $params
190
  );
191
+
192
  $result = EcwidPlatform::get_from_products_cache( $url );
193
  if (!$result ) {
194
  $result = EcwidPlatform::fetch_url( $url );
197
  }
198
 
199
  EcwidPlatform::store_in_products_cache( $url, $result );
200
+ }
201
 
202
+ $result = json_decode($result['data']);
203
+
204
+ if ( !empty( $result->items ) ) {
205
+ foreach ( $result->items as $item ) {
206
+ if (Ecwid_Seo_Links::is_enabled()) {
207
+ $item->seo_link = $item->url;
208
  }
209
+ Ecwid_Product::init_from_stdclass( $item );
210
  }
 
211
  }
212
 
 
 
213
  return $result;
214
  }
215
 
263
  )
264
  );
265
 
266
+ if ($r§esult['code'] != '200') {
267
  return false;
268
  }
269
  $result = json_decode($result['data']);
lib/ecwid_catalog.php CHANGED
@@ -4,15 +4,18 @@ class EcwidCatalog
4
  {
5
  var $store_id = 0;
6
  var $store_base_url = '';
7
- var $ecwid_api = null;
8
 
9
  public function __construct($store_id, $store_base_url)
10
  {
11
  $this->store_id = intval($store_id);
12
  $this->store_base_url = $store_base_url;
13
- $this->ecwid_api = new EcwidProductApi($this->store_id);
14
  }
15
 
 
 
 
 
 
16
  public function get_product($id)
17
  {
18
  $result = $this->_get_data_for_product($id);
@@ -77,7 +80,7 @@ class EcwidCatalog
77
 
78
  }
79
 
80
- protected function _get_data_for_category( $id, $offset )
81
  {
82
  if ( Ecwid_Api_V3::is_available() ) {
83
  $api = new Ecwid_Api_V3();
@@ -90,7 +93,7 @@ class EcwidCatalog
90
  $get_categories_params = array(
91
  'parent' => $id
92
  );
93
- if ($offset) {
94
  $get_categories_params['offset'] = $offset;
95
  }
96
  $categories = $api->get_categories( $get_categories_params );
@@ -132,9 +135,10 @@ class EcwidCatalog
132
  }
133
 
134
  protected function _get_apiv1_batch_result($params) {
135
- $batch_result = $this->ecwid_api->get_batch_request($params);
 
136
  if ( is_array( $batch_result ) ) {
137
- $batch_result = $this->ecwid_api->get_batch_request($params);
138
  }
139
 
140
  return $batch_result;
4
  {
5
  var $store_id = 0;
6
  var $store_base_url = '';
 
7
 
8
  public function __construct($store_id, $store_base_url)
9
  {
10
  $this->store_id = intval($store_id);
11
  $this->store_base_url = $store_base_url;
 
12
  }
13
 
14
+ public function warmup_store_page( $category_id )
15
+ {
16
+ $this->_get_data_for_category( $category_id, null );
17
+ }
18
+
19
  public function get_product($id)
20
  {
21
  $result = $this->_get_data_for_product($id);
80
 
81
  }
82
 
83
+ protected function _get_data_for_category( $id, $offset = 0 )
84
  {
85
  if ( Ecwid_Api_V3::is_available() ) {
86
  $api = new Ecwid_Api_V3();
93
  $get_categories_params = array(
94
  'parent' => $id
95
  );
96
+ if ($offset && $offset > 0) {
97
  $get_categories_params['offset'] = $offset;
98
  }
99
  $categories = $api->get_categories( $get_categories_params );
135
  }
136
 
137
  protected function _get_apiv1_batch_result($params) {
138
+ $api = ecwid_new_product_api();
139
+ $batch_result = $api->get_batch_request($params);
140
  if ( is_array( $batch_result ) ) {
141
+ $batch_result = $api->get_batch_request($params);
142
  }
143
 
144
  return $batch_result;
lib/ecwid_platform.php CHANGED
@@ -268,6 +268,7 @@ class EcwidPlatform {
268
 
269
 
270
  static public function store_in_products_cache( $url, $data ) {
 
271
  self::_store_in_cache($url, 'products', $data);
272
  }
273
 
@@ -304,7 +305,7 @@ class EcwidPlatform {
304
  $cache_name = self::_build_cache_name( $key, 'products' );
305
 
306
  $result = self::cache_get( $cache_name );
307
-
308
  if ( $result['time'] > EcwidPlatform::get( self::PRODUCTS_CACHE_VALID_FROM ) ) {
309
  return $result['data'];
310
  }
268
 
269
 
270
  static public function store_in_products_cache( $url, $data ) {
271
+
272
  self::_store_in_cache($url, 'products', $data);
273
  }
274
 
305
  $cache_name = self::_build_cache_name( $key, 'products' );
306
 
307
  $result = self::cache_get( $cache_name );
308
+
309
  if ( $result['time'] > EcwidPlatform::get( self::PRODUCTS_CACHE_VALID_FROM ) ) {
310
  return $result['data'];
311
  }
lib/ecwid_product.php CHANGED
@@ -41,13 +41,13 @@ class Ecwid_Product extends Ecwid_Catalog_Entry
41
 
42
  if ( !$product_data ) {
43
  $p->_load($id);
 
44
  } else {
45
  $p->_data = $product_data;
46
  }
47
 
48
  $p->_put_into_local_object_cache($p);
49
 
50
- $p->_persist();
51
 
52
  return $p;
53
  }
41
 
42
  if ( !$product_data ) {
43
  $p->_load($id);
44
+ $p->_persist();
45
  } else {
46
  $p->_data = $product_data;
47
  }
48
 
49
  $p->_put_into_local_object_cache($p);
50
 
 
51
 
52
  return $p;
53
  }
lib/ecwid_requests.php CHANGED
@@ -344,10 +344,14 @@ class Ecwid_HTTP_Get_Fopen extends Ecwid_HTTP_Get {
344
 
345
  $result = array();
346
 
347
- foreach ($meta['wrapper_data'] as $item) {
 
 
 
 
348
 
349
  if (!is_string($item)) {
350
- ecwid_log_error(json_encode($item));
351
  continue;
352
  }
353
 
@@ -443,10 +447,14 @@ class Ecwid_HTTP_Post_Fopen extends Ecwid_Http_Post {
443
 
444
  $result = array();
445
 
446
- foreach ($meta['wrapper_data'] as $item) {
 
 
 
 
447
 
448
  if (!is_string($item)) {
449
- ecwid_log_error(json_encode($item));
450
  continue;
451
  }
452
 
344
 
345
  $result = array();
346
 
347
+ $headers = $meta['wrapper_data'];
348
+ if (isset($headers['headers'])) {
349
+ $headers = $headers['headers'];
350
+ }
351
+ foreach ($headers as $item) {
352
 
353
  if (!is_string($item)) {
354
+ ecwid_log_error(@json_encode($item));
355
  continue;
356
  }
357
 
447
 
448
  $result = array();
449
 
450
+ $headers = $meta['wrapper_data'];
451
+ if (isset($headers['headers'])) {
452
+ $headers = $headers['headers'];
453
+ }
454
+ foreach ($headers as $item) {
455
 
456
  if (!is_string($item)) {
457
+ ecwid_log_error(@json_encode($item));
458
  continue;
459
  }
460
 
lib/html-catalog-templates/category.php CHANGED
@@ -18,9 +18,10 @@
18
 
19
  <?php if ( $products ): foreach ( $products as $product ): ?>
20
 
 
21
  <div class="product-<?php echo $product->id; ?>">
22
  <span class="product-name">
23
- <a href="<?php echo Ecwid_Store_Page::get_product_url( $product->id ); ?>">
24
  <?php echo EcwidPlatform::esc_html( $product->name ); ?>
25
  </a>
26
  </span>
18
 
19
  <?php if ( $products ): foreach ( $products as $product ): ?>
20
 
21
+ <?php $product = Ecwid_Product::get_by_id($product->id); ?>
22
  <div class="product-<?php echo $product->id; ?>">
23
  <span class="product-name">
24
+ <a href="<?php echo $product->link; ?>">
25
  <?php echo EcwidPlatform::esc_html( $product->name ); ?>
26
  </a>
27
  </span>
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.8
6
- Stable tag: 5.4.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,12 @@ 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
  = 5.4.2 =
153
  - **Loading speed optimization for the Single Product widgets.** We continue working on improving the Ecwid ecommerce plugin loading speed. This update includes optimization of single product widgets. The optimization should have especially good effect if you added multiple single product widgets on a page (e.g. for creating a featured slider or a customized products grid).
154
  - **The Recently Viewed Products widget is also optimized.** It now works much faster. If you haven’t used the widget before, feel free to enable it under Appearance -> Widgets.
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.8
6
+ Stable tag: 5.4.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
+ = 5.4.3 =
153
+ - **Speed optimization for the plugin settings pages.** We improved the plugin admin settings code to make sure it requires less time and resources and thus works faster.
154
+ - **Fixed a bug in the integration with the Google XML Sitemaps plugin.** The sitemaps generated by that plugin might contain invalid data related to the store product pages. That was caused by a bug in the Ecwid plugin. We fixed that, your sitemap should work fine now.
155
+ - **Fixed the “preg_match” warning messages appearing in rare occasions on the plugin pages.** If you happen to see those messages on your site, please update the Ecwid online store plugin, it should fix them.
156
+ - **Bug fixes and improvements for the SEO content of the product and categories pages on the site.** This is for search engines to be able to index your store better.
157
+
158
  = 5.4.2 =
159
  - **Loading speed optimization for the Single Product widgets.** We continue working on improving the Ecwid ecommerce plugin loading speed. This update includes optimization of single product widgets. The optimization should have especially good effect if you added multiple single product widgets on a page (e.g. for creating a featured slider or a customized products grid).
160
  - **The Recently Viewed Products widget is also optimized.** It now works much faster. If you haven’t used the widget before, feel free to enable it under Appearance -> Widgets.
templates/dashboard.php CHANGED
@@ -11,7 +11,7 @@
11
  </span>
12
  <ul>
13
  <li>
14
- <a href="admin-post.php?action=ecwid_disconnect"><?php _e( 'Disconnect store', 'ecwid-shopping-cart' ); ?></a>
15
  </li>
16
  </ul>
17
  </div>
11
  </span>
12
  <ul>
13
  <li>
14
+ <a href="admin.php?page=ec-store&reconnect"><?php _e( 'Disconnect store', 'ecwid-shopping-cart' ); ?></a>
15
  </li>
16
  </ul>
17
  </div>
templates/ecwid-admin.php CHANGED
@@ -22,4 +22,13 @@
22
 
23
  <iframe seamless id="ecwid-frame" frameborder="0" width="100%" height="700" scrolling="yes"></iframe>
24
 
 
 
 
 
 
 
 
 
 
25
  <?php require_once ECWID_PLUGIN_DIR . 'templates/admin-footer.php'; ?>
22
 
23
  <iframe seamless id="ecwid-frame" frameborder="0" width="100%" height="700" scrolling="yes"></iframe>
24
 
25
+ <script type="text/javascript">
26
+ jQuery(document).ready(function() {
27
+ jQuery.ajax(
28
+ {
29
+ url: ajaxurl + '?action=<?php echo Ecwid_Store_Page::WARMUP_ACTION; ?>'
30
+ }
31
+ );
32
+ });
33
+ </script>
34
  <?php require_once ECWID_PLUGIN_DIR . 'templates/admin-footer.php'; ?>