Ecwid Ecommerce Shopping Cart - Version 5.7.3

Version Description

  • Jan 18, 2018 =
  • Improved compatibility with Customizr theme. We are inspecting how the plugin works with a popular Customizr theme and making the store appearance and behavior fit the theme better. This is the first part of improvements for Customizr, we will continue making it better in the future versions.
  • Improvements in the way the plugin communicates with the Ecwid APIs. We cleaned up the plugin code and improved its internal functions to make sure storefront and product widgets are using the newest Ecwid API and work more stable.
  • Minor improvements in the SEO. We made a few fixes and adjustments in canonical tags and SEO-friendly URLs functionality.
  • Ecwid e-commerce service is constantly updated with new cool features and improvements. To see more updates and learn something new about selling online, see our blog.
Download this release

Release Info

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

Code changes from version 5.7.2 to 5.7.3

css/admin.css CHANGED
@@ -91,6 +91,7 @@ div.ecwid-message {
91
  position: relative;
92
  display: table;
93
  width: 100%;
 
94
  }
95
 
96
  .ecwid-message .ecwid-message-buttons > div {
91
  position: relative;
92
  display: table;
93
  width: 100%;
94
+ min-height: 30px;
95
  }
96
 
97
  .ecwid-message .ecwid-message-buttons > div {
css/themes/customizr.css CHANGED
@@ -56,4 +56,9 @@
56
 
57
  .ecwid-productBrowser table {
58
  line-height: normal;
 
 
 
 
 
59
  }
56
 
57
  .ecwid-productBrowser table {
58
  line-height: normal;
59
+ }
60
+
61
+
62
+ html#ecwid_html body#ecwid_body.ecwid-shopping-cart input[type=radio]:checked::before {
63
+ background-color:transparent !important;
64
  }
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.7.2
9
  Author URI: http://www.ecwid.com?source=wporg
10
  */
11
 
@@ -287,7 +287,10 @@ add_filter('redirect_canonical', 'ecwid_redirect_canonical2', 10, 3);
287
  function ecwid_redirect_canonical2($redir, $req) {
288
  global $wp_query;
289
 
290
- if ($wp_query->get('page_id') == Ecwid_Store_Page::get_current_store_page_id() && $req . '/' == $redir) {
 
 
 
291
  return false;
292
  }
293
 
@@ -326,7 +329,7 @@ function ecwid_enqueue_frontend() {
326
 
327
  wp_enqueue_script( 'ecwid-frontend-js', ECWID_PLUGIN_URL . 'js/frontend.js', array( 'jquery' ), get_option( 'ecwid_plugin_version' ) );
328
  wp_localize_script( 'ecwid-frontend-js', 'ecwidParams', array(
329
- 'useJsApiToOpenStorePages' => (bool)get_option( 'ecwid_use_js_api_to_open_store_pages', true )
330
  ));
331
 
332
  if ( get_post() && get_post()->post_type == Ecwid_Products::POST_TYPE_PRODUCT ) {
@@ -437,7 +440,7 @@ function ecwid_load_textdomain() {
437
 
438
  function ecwid_404_on_broken_escaped_fragment() {
439
 
440
- if ( !Ecwid_Api_V3::is_available() && !ecwid_is_apiv1_enabled() ) {
441
  return;
442
  }
443
 
@@ -488,13 +491,11 @@ function ecwid_is_store_closed()
488
  $api = new Ecwid_Api_V3();
489
  $profile = $api->get_store_profile();
490
 
491
- return @$profile->settings->closed;
492
- } else if ( ecwid_is_apiv1_enabled() ) {
493
- $api = ecwid_new_product_api();
494
-
495
- $profile = $api->get_profile();
496
 
497
- return $profile['closed'];
498
  }
499
 
500
  return false;
@@ -518,7 +519,8 @@ function ecwid_backward_compatibility() {
518
 
519
  function ecwid_build_sitemap($callback)
520
  {
521
- if (!ecwid_is_paid_account() || !ecwid_is_store_page_available()) return;
 
522
 
523
  $page_id = Ecwid_Store_Page::get_current_store_page_id();
524
 
@@ -632,8 +634,10 @@ function ecwid_check_version()
632
  // Since 5.4.3?
633
  add_option( Ecwid_Widget_Floating_Shopping_Cart::OPTION_MOVE_INTO_BODY, '' );
634
 
635
- add_option( 'ecwid_use_js_api_to_open_store_pages', true );
636
-
 
 
637
  Ecwid_Config::load_from_ini();
638
 
639
  add_option( 'force_scriptjs_render', false );
@@ -824,7 +828,8 @@ function ecwid_invalidate_cache( $full_reset = false)
824
  EcwidPlatform::invalidate_categories_cache_from(time());
825
  EcwidPlatform::invalidate_products_cache_from(time());
826
  EcwidPlatform::cache_reset( Ecwid_Api_V3::PROFILE_CACHE_NAME );
827
-
 
828
  return;
829
  }
830
 
@@ -836,9 +841,8 @@ function ecwid_invalidate_cache( $full_reset = false)
836
  if ($stats) {
837
  EcwidPlatform::invalidate_products_cache_from(strtotime($stats->productsUpdated));
838
  EcwidPlatform::invalidate_categories_cache_from(strtotime($stats->categoriesUpdated));
 
839
  }
840
-
841
- update_option('ecwid_last_api_cache_check', time());
842
  }
843
  }
844
 
@@ -965,7 +969,7 @@ function ecwid_content_has_productbrowser( $content ) {
965
 
966
  function ecwid_ajax_crawling_fragment() {
967
 
968
- if ( !Ecwid_Api_V3::is_available() && !ecwid_is_apiv1_enabled() ) return;
969
 
970
  if ( isset( $_GET['_escaped_fragment_'] ) ) return;
971
 
@@ -1026,10 +1030,15 @@ function ecwid_canonical() {
1026
  if ($params) {
1027
  if ( $params['mode'] == 'product' ) {
1028
  $product = Ecwid_Product::get_by_id( $params['id'] );
1029
- $link = $product->url;
 
 
1030
  } elseif ( $params['mode'] == 'category' ) {
1031
  $category = Ecwid_Category::get_by_id( $params['id'] );
1032
- $link = $category->link;
 
 
 
1033
  }
1034
  }
1035
  }
@@ -1045,7 +1054,7 @@ function ecwid_canonical() {
1045
 
1046
  function ecwid_is_applicable_escaped_fragment() {
1047
 
1048
- if (!Ecwid_Api_V3::is_available() && !ecwid_is_apiv1_enabled()) {
1049
  return false;
1050
  }
1051
 
@@ -1067,12 +1076,16 @@ function ecwid_meta_description() {
1067
  if ( ecwid_is_applicable_escaped_fragment() ) {
1068
  $params = ecwid_parse_escaped_fragment( $_GET['_escaped_fragment_'] );
1069
 
1070
- if ($params['mode'] == 'product') {
1071
  $product = Ecwid_Product::get_by_id( $params['id'] );
1072
- $description = $product->description;
1073
- } elseif ($params['mode'] == 'category') {
 
 
1074
  $category = Ecwid_Category::get_by_id( $params['id'] );
1075
- $description = $category->description;
 
 
1076
  }
1077
  } else if ( Ecwid_Seo_Links::is_product_browser_url() ) {
1078
  $params = Ecwid_Seo_Links::maybe_extract_html_catalog_params();
@@ -1241,6 +1254,11 @@ function _ecwid_get_seo_title()
1241
 
1242
  if ( $params['mode'] == 'product' ) {
1243
  $product = Ecwid_Product::get_by_id( $params['id'] );
 
 
 
 
 
1244
  if ( isset( $product->seoTitle ) && !empty( $product->seoTitle ) ) {
1245
  $ecwid_seo_title = $product->seoTitle;
1246
  } else {
@@ -1249,7 +1267,7 @@ function _ecwid_get_seo_title()
1249
 
1250
  if ( $product->defaultCategoryId ) {
1251
  $category = $api->get_category( $product->defaultCategoryId );
1252
- if ( $category && isset($category->name)) {
1253
  $ecwid_seo_title .= ' ' . ecwid_get_title_separator() . ' ' . $category->name;
1254
  }
1255
  }
@@ -1372,6 +1390,10 @@ function ecwid_get_scriptjs_params( $force_lang = null ) {
1372
  if (is_active_widget(false, false, 'ecwidrandomproduct')) {
1373
  $params .= '&data_rpw=1';
1374
  }
 
 
 
 
1375
 
1376
  return $params;
1377
  }
@@ -1769,6 +1791,9 @@ function ecwid_get_update_params_options() {
1769
  'ecwid_disable_pb_url' => array(
1770
  'type' => 'bool'
1771
  ),
 
 
 
1772
  Ecwid_Widget_Floating_Shopping_Cart::OPTION_DISPLAY_POSITION => array(
1773
  'values' => array(
1774
  '',
@@ -2099,6 +2124,7 @@ function ecwid_general_settings_do_page() {
2099
  }
2100
  } else {
2101
  global $ecwid_oauth;
 
2102
 
2103
  if ( Ecwid_Admin::disable_dashboard() ) {
2104
  require_once ECWID_PLUGIN_DIR . 'templates/dashboard.php';
@@ -2109,7 +2135,6 @@ function ecwid_general_settings_do_page() {
2109
  require_once ECWID_PLUGIN_DIR . 'templates/dashboard.php';
2110
  }
2111
  } else {
2112
-
2113
  if ($connection_error || isset($_GET['reconnect'])) {
2114
  if (isset($_GET['reason'])) switch ($_GET['reason']) {
2115
  case 'spw': $reconnect_message = sprintf( __( 'To be able to choose a product to insert to your posts and pages, you will need to re-connect your site to your %s store. This will only require you to accept permissions request – so that the plugin will be able to list your products in the "Add product" dialog.', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand() );
@@ -2167,8 +2192,14 @@ function ecwid_get_admin_sso_url( $time, $page = '' ) {
2167
  }
2168
 
2169
 
2170
- function ecwid_get_iframe_src($time, $page) {
2171
- return ecwid_get_admin_sso_url($time, $page) . '&inline&&min-height=700';
 
 
 
 
 
 
2172
  }
2173
 
2174
  function ecwid_admin_do_page( $page ) {
@@ -2177,6 +2208,12 @@ function ecwid_admin_do_page( $page ) {
2177
  require_once ECWID_PLUGIN_DIR . 'templates/admin-timeout.php';
2178
  die();
2179
  }
 
 
 
 
 
 
2180
  global $ecwid_oauth;
2181
 
2182
  if (isset($_GET['ecwid_page']) && $_GET['ecwid_page']) {
@@ -2196,6 +2233,7 @@ function ecwid_admin_do_page( $page ) {
2196
  $iframe_src = ecwid_get_iframe_src($time, $page);
2197
 
2198
  $request = Ecwid_Http::create_get('embedded_admin_iframe', $iframe_src, array(Ecwid_Http::POLICY_RETURN_VERBOSE));
 
2199
  if (!$request) {
2200
  echo Ecwid_Message_Manager::show_message('no_oauth');
2201
  return;
@@ -2203,7 +2241,7 @@ function ecwid_admin_do_page( $page ) {
2203
 
2204
  $result = $request->do_request();
2205
 
2206
- if ($result['code'] == 403 && (
2207
  strpos($result['data'], 'Token too old') !== false
2208
  || strpos($result['data'], 'window.top.location = \'https://my.ecwid.com/api/v3/' . get_ecwid_store_id() . '/sso?') !== false
2209
  )
@@ -2378,28 +2416,6 @@ function ecwid_get_categories_for_selector() {
2378
  return $result;
2379
  }
2380
 
2381
- function ecwid_get_product_seo_url( $product_id ) {
2382
- if ( Ecwid_Products::is_enabled() ) {
2383
- global $ecwid_products;
2384
-
2385
- return $ecwid_products->get_product_link( $product_id );
2386
- } elseif (Ecwid_Api_V3::is_available()) {
2387
- $api = new Ecwid_Api_V3();
2388
- if ( $api->is_api_available() ) {
2389
- $product = Ecwid_Product::get_by_id( $product_id );
2390
-
2391
- if ($product->get_seo_link()) {
2392
- return $product->get_seo_link();
2393
- }
2394
-
2395
- $product = $api->get_product( $product_id );
2396
- return $product->url;
2397
- }
2398
- }
2399
-
2400
- return Ecwid_Store_Page::get_store_url() . '#!/p/' . $product_id;
2401
- }
2402
-
2403
  function ecwid_advanced_settings_do_page() {
2404
  $categories = ecwid_get_categories_for_selector();
2405
 
@@ -2855,7 +2871,7 @@ function ecwid_should_display_escaped_fragment_catalog()
2855
  {
2856
  if (!isset($_GET['_escaped_fragment_'])) return;
2857
 
2858
- if ( Ecwid_Api_V3::is_available() || ecwid_is_apiv1_enabled() ) {
2859
  return !ecwid_is_store_closed();
2860
  }
2861
 
@@ -2901,37 +2917,7 @@ function ecwid_is_paid_account()
2901
  'PREMIUM', $profile->account->availableFeatures
2902
  );
2903
  }
2904
- return ecwid_is_apiv1_enabled() && get_ecwid_store_id() != Ecwid_Config::get_demo_store_id();
2905
- }
2906
-
2907
- function ecwid_is_apiv1_enabled()
2908
- {
2909
- $ecwid_is_api_enabled = get_option('ecwid_is_api_enabled');
2910
- $ecwid_api_check_time = get_option('ecwid_api_check_time');
2911
- $now = time();
2912
-
2913
- if ( $now > ($ecwid_api_check_time + ECWID_API_AVAILABILITY_CHECK_TIME) && get_ecwid_store_id() != Ecwid_Config::get_demo_store_id() ) {
2914
- $ecwid = ecwid_new_product_api();
2915
-
2916
- $ecwid_is_api_enabled = ($ecwid->is_api_enabled() ? 'on' : 'off');
2917
-
2918
- update_option('ecwid_is_api_enabled', $ecwid_is_api_enabled);
2919
- update_option('ecwid_api_check_time', $now);
2920
- }
2921
-
2922
- if ('on' == $ecwid_is_api_enabled)
2923
- return true;
2924
- else
2925
- return false;
2926
- }
2927
-
2928
- function ecwid_new_product_api()
2929
- {
2930
- include_once ECWID_PLUGIN_DIR . 'lib/ecwid_product_api.php';
2931
- $ecwid_store_id = intval(get_ecwid_store_id());
2932
- $api = new EcwidProductApi($ecwid_store_id);
2933
-
2934
- return $api;
2935
  }
2936
 
2937
  function ecwid_embed_svg($name) {
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.7.3
9
  Author URI: http://www.ecwid.com?source=wporg
10
  */
11
 
287
  function ecwid_redirect_canonical2($redir, $req) {
288
  global $wp_query;
289
 
290
+ $adds_slash = $req . '/' == $redir;
291
+ $adds_slash |= urldecode($req . '/') == urldecode($redir);
292
+
293
+ if ($wp_query->get('page_id') == Ecwid_Store_Page::get_current_store_page_id() && $adds_slash) {
294
  return false;
295
  }
296
 
329
 
330
  wp_enqueue_script( 'ecwid-frontend-js', ECWID_PLUGIN_URL . 'js/frontend.js', array( 'jquery' ), get_option( 'ecwid_plugin_version' ) );
331
  wp_localize_script( 'ecwid-frontend-js', 'ecwidParams', array(
332
+ 'useJsApiToOpenStoreCategoriesPages' => (bool)get_option( 'ecwid_use_js_api_to_open_store_categories_pages', false )
333
  ));
334
 
335
  if ( get_post() && get_post()->post_type == Ecwid_Products::POST_TYPE_PRODUCT ) {
440
 
441
  function ecwid_404_on_broken_escaped_fragment() {
442
 
443
+ if ( !Ecwid_Api_V3::is_available() ) {
444
  return;
445
  }
446
 
491
  $api = new Ecwid_Api_V3();
492
  $profile = $api->get_store_profile();
493
 
494
+ if ( !$profile || !isset( $profile->settings ) ) {
495
+ return false;
496
+ }
 
 
497
 
498
+ return @$profile->settings->closed;
499
  }
500
 
501
  return false;
519
 
520
  function ecwid_build_sitemap($callback)
521
  {
522
+
523
+ if ( !ecwid_is_paid_account() || !ecwid_is_store_page_available() ) return;
524
 
525
  $page_id = Ecwid_Store_Page::get_current_store_page_id();
526
 
634
  // Since 5.4.3?
635
  add_option( Ecwid_Widget_Floating_Shopping_Cart::OPTION_MOVE_INTO_BODY, '' );
636
 
637
+ // Since 5.7.x?
638
+ add_option( 'ecwid_use_js_api_to_open_store_categories_pages', false );
639
+ delete_option( 'ecwid_use_js_api_to_open_store_pages' );
640
+
641
  Ecwid_Config::load_from_ini();
642
 
643
  add_option( 'force_scriptjs_render', false );
828
  EcwidPlatform::invalidate_categories_cache_from(time());
829
  EcwidPlatform::invalidate_products_cache_from(time());
830
  EcwidPlatform::cache_reset( Ecwid_Api_V3::PROFILE_CACHE_NAME );
831
+ EcwidPlatform::cache_reset('all_categories');
832
+
833
  return;
834
  }
835
 
841
  if ($stats) {
842
  EcwidPlatform::invalidate_products_cache_from(strtotime($stats->productsUpdated));
843
  EcwidPlatform::invalidate_categories_cache_from(strtotime($stats->categoriesUpdated));
844
+ update_option('ecwid_last_api_cache_check', time());
845
  }
 
 
846
  }
847
  }
848
 
969
 
970
  function ecwid_ajax_crawling_fragment() {
971
 
972
+ if ( !Ecwid_Api_V3::is_available() ) return;
973
 
974
  if ( isset( $_GET['_escaped_fragment_'] ) ) return;
975
 
1030
  if ($params) {
1031
  if ( $params['mode'] == 'product' ) {
1032
  $product = Ecwid_Product::get_by_id( $params['id'] );
1033
+ if ( $product ) {
1034
+ $link = $product->url;
1035
+ }
1036
  } elseif ( $params['mode'] == 'category' ) {
1037
  $category = Ecwid_Category::get_by_id( $params['id'] );
1038
+
1039
+ if ( $category ) {
1040
+ $link = $category->link;
1041
+ }
1042
  }
1043
  }
1044
  }
1054
 
1055
  function ecwid_is_applicable_escaped_fragment() {
1056
 
1057
+ if (!Ecwid_Api_V3::is_available() ) {
1058
  return false;
1059
  }
1060
 
1076
  if ( ecwid_is_applicable_escaped_fragment() ) {
1077
  $params = ecwid_parse_escaped_fragment( $_GET['_escaped_fragment_'] );
1078
 
1079
+ if ( $params['mode'] == 'product' ) {
1080
  $product = Ecwid_Product::get_by_id( $params['id'] );
1081
+ if ( $product ) {
1082
+ $description = $product->description;
1083
+ }
1084
+ } elseif ( $params['mode'] == 'category' ) {
1085
  $category = Ecwid_Category::get_by_id( $params['id'] );
1086
+ if ( $category ) {
1087
+ $description = $category->description;
1088
+ }
1089
  }
1090
  } else if ( Ecwid_Seo_Links::is_product_browser_url() ) {
1091
  $params = Ecwid_Seo_Links::maybe_extract_html_catalog_params();
1254
 
1255
  if ( $params['mode'] == 'product' ) {
1256
  $product = Ecwid_Product::get_by_id( $params['id'] );
1257
+
1258
+ if ( !$product ) {
1259
+ return '';
1260
+ }
1261
+
1262
  if ( isset( $product->seoTitle ) && !empty( $product->seoTitle ) ) {
1263
  $ecwid_seo_title = $product->seoTitle;
1264
  } else {
1267
 
1268
  if ( $product->defaultCategoryId ) {
1269
  $category = $api->get_category( $product->defaultCategoryId );
1270
+ if ( $category && isset( $category->name ) ) {
1271
  $ecwid_seo_title .= ' ' . ecwid_get_title_separator() . ' ' . $category->name;
1272
  }
1273
  }
1390
  if (is_active_widget(false, false, 'ecwidrandomproduct')) {
1391
  $params .= '&data_rpw=1';
1392
  }
1393
+
1394
+ if (!Ecwid_Api_V3::get_token()) {
1395
+ $params .= '&data_no_apiv3=1';
1396
+ }
1397
 
1398
  return $params;
1399
  }
1791
  'ecwid_disable_pb_url' => array(
1792
  'type' => 'bool'
1793
  ),
1794
+ 'ecwid_use_js_api_to_open_store_categories_pages' => array(
1795
+ 'type' => 'bool'
1796
+ ),
1797
  Ecwid_Widget_Floating_Shopping_Cart::OPTION_DISPLAY_POSITION => array(
1798
  'values' => array(
1799
  '',
2124
  }
2125
  } else {
2126
  global $ecwid_oauth;
2127
+
2128
 
2129
  if ( Ecwid_Admin::disable_dashboard() ) {
2130
  require_once ECWID_PLUGIN_DIR . 'templates/dashboard.php';
2135
  require_once ECWID_PLUGIN_DIR . 'templates/dashboard.php';
2136
  }
2137
  } else {
 
2138
  if ($connection_error || isset($_GET['reconnect'])) {
2139
  if (isset($_GET['reason'])) switch ($_GET['reason']) {
2140
  case 'spw': $reconnect_message = sprintf( __( 'To be able to choose a product to insert to your posts and pages, you will need to re-connect your site to your %s store. This will only require you to accept permissions request – so that the plugin will be able to list your products in the "Add product" dialog.', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand() );
2192
  }
2193
 
2194
 
2195
+ function ecwid_get_iframe_src($time, $page)
2196
+ {
2197
+ $url = ecwid_get_admin_sso_url($time, $page);
2198
+ if ($url) {
2199
+ return $url . '&inline&&min-height=700';
2200
+ } else {
2201
+ return false;
2202
+ }
2203
  }
2204
 
2205
  function ecwid_admin_do_page( $page ) {
2208
  require_once ECWID_PLUGIN_DIR . 'templates/admin-timeout.php';
2209
  die();
2210
  }
2211
+
2212
+ if (Ecwid_Api_V3::get_token() == false) {
2213
+ require_once ECWID_PLUGIN_DIR . 'templates/reconnect-sso.php';
2214
+ die();
2215
+ }
2216
+
2217
  global $ecwid_oauth;
2218
 
2219
  if (isset($_GET['ecwid_page']) && $_GET['ecwid_page']) {
2233
  $iframe_src = ecwid_get_iframe_src($time, $page);
2234
 
2235
  $request = Ecwid_Http::create_get('embedded_admin_iframe', $iframe_src, array(Ecwid_Http::POLICY_RETURN_VERBOSE));
2236
+
2237
  if (!$request) {
2238
  echo Ecwid_Message_Manager::show_message('no_oauth');
2239
  return;
2241
 
2242
  $result = $request->do_request();
2243
 
2244
+ if ( @$result['code'] == 403 && (
2245
  strpos($result['data'], 'Token too old') !== false
2246
  || strpos($result['data'], 'window.top.location = \'https://my.ecwid.com/api/v3/' . get_ecwid_store_id() . '/sso?') !== false
2247
  )
2416
  return $result;
2417
  }
2418
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2419
  function ecwid_advanced_settings_do_page() {
2420
  $categories = ecwid_get_categories_for_selector();
2421
 
2871
  {
2872
  if (!isset($_GET['_escaped_fragment_'])) return;
2873
 
2874
+ if ( Ecwid_Api_V3::is_available()) {
2875
  return !ecwid_is_store_closed();
2876
  }
2877
 
2917
  'PREMIUM', $profile->account->availableFeatures
2918
  );
2919
  }
2920
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2921
  }
2922
 
2923
  function ecwid_embed_svg($name) {
includes/class-ecwid-message-manager.php CHANGED
@@ -194,7 +194,7 @@ TXT
194
  'title' => sprintf( __( 'Greetings! Your %s plugin is now active.', 'ecwid-shopping-cart'), Ecwid_Config::get_brand() ),
195
  'message' => __('Take a few simple steps to complete store setup', 'ecwid-shopping-cart'),
196
  'primary_title' => __( 'Set up your store', 'ecwid-shopping-cart'),
197
- 'primary_url' => 'admin.php?page=ecwid',
198
  'hideable' => true,
199
  'default' => 'disabled'
200
  ),
@@ -232,6 +232,15 @@ TXT
232
  'hideable' => false,
233
  'type' => 'error'
234
  ),
 
 
 
 
 
 
 
 
 
235
  );
236
  }
237
 
@@ -247,7 +256,8 @@ TXT
247
  $admin_page = $screen->base;
248
  }
249
 
250
- if ($admin_page == 'toplevel_page_ec-store' && isset($_GET['reconnect'])) {
 
251
  return false;
252
  }
253
 
@@ -264,6 +274,11 @@ TXT
264
  case 'on_appearance_widgets':
265
  return isset($_GET['from-ec-store']) && $_GET['from-ec-store'] != 'true' && $admin_page == 'widgets';
266
 
 
 
 
 
 
267
  case 'please_vote':
268
 
269
  if ( Ecwid_Config::is_wl() ) return false;
194
  'title' => sprintf( __( 'Greetings! Your %s plugin is now active.', 'ecwid-shopping-cart'), Ecwid_Config::get_brand() ),
195
  'message' => __('Take a few simple steps to complete store setup', 'ecwid-shopping-cart'),
196
  'primary_title' => __( 'Set up your store', 'ecwid-shopping-cart'),
197
+ 'primary_url' => 'admin.php?page=' . Ecwid_Admin::ADMIN_SLUG,
198
  'hideable' => true,
199
  'default' => 'disabled'
200
  ),
232
  'hideable' => false,
233
  'type' => 'error'
234
  ),
235
+
236
+ 'no_token' => array(
237
+ 'title' => sprintf( __( 'Action required: please connect your %s account', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand() ),
238
+ 'message' => sprintf( __( 'Your storefront (product listing and checkout) is working fine, but the advanced store functions like SEO and sidebar widgets are disabled. To enable them and make sure your store works properly, please press the button below to connect your %s account. This will take less than a minute — you will only be asked to log in to your account and allow this site to get your store data.', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand() ),
239
+ 'type' => 'error',
240
+ 'primary_title' => __( 'Connect', 'ecwid-shopping-cart' ),
241
+ 'primary_url' => admin_url( 'admin-post.php?action=ec_connect&reconnect' ),
242
+ 'hideable' => true
243
+ )
244
  );
245
  }
246
 
256
  $admin_page = $screen->base;
257
  }
258
 
259
+ $is_ecwid_menu = $admin_page == 'toplevel_page_' . Ecwid_Admin::ADMIN_SLUG;
260
+ if ($is_ecwid_menu && isset($_GET['reconnect'])) {
261
  return false;
262
  }
263
 
274
  case 'on_appearance_widgets':
275
  return isset($_GET['from-ec-store']) && $_GET['from-ec-store'] != 'true' && $admin_page == 'widgets';
276
 
277
+ case 'no_token':
278
+ $no_token = Ecwid_Api_V3::get_token() == false;
279
+ $is_not_demo = get_ecwid_store_id() != Ecwid_Config::get_demo_store_id();
280
+ return $no_token && $is_not_demo && !$is_ecwid_menu;
281
+
282
  case 'please_vote':
283
 
284
  if ( Ecwid_Config::is_wl() ) return false;
includes/class-ecwid-nav-menus.php CHANGED
@@ -191,38 +191,40 @@ class Ecwid_Nav_Menus {
191
  if ( !$posts ) {
192
  $posts = array();
193
  $categories = ecwid_get_categories();
194
- foreach ($categories as $category) {
195
- $post = new stdClass;
196
- $post->ID = -1;
197
- $post->post_author = '';
198
- $post->post_date = '';
199
- $post->post_date_gmt = '';
200
- $post->post_password = '';
201
- $post->post_name = '';
202
- $post->post_type = $item->post_type;
203
- $post->post_status = 'publish';
204
- $post->to_ping = '';
205
- $post->pinged = '';
206
- $post->post_parent = 0;
207
- $post->url = Ecwid_Store_Page::get_category_url($category->id);
208
- $post->classes = '';
209
- $post->type = 'post';
210
- $post->db_id = 0;
211
- $post->title = $category->name;
212
- $post->target = '';
213
- $post->object = '';
214
- $post->attr_title = '';
215
- $post->description = '';
216
- $post->xfn = '';
217
- $post->object_id = 0;
218
- // $post->ecwid_page_type = 'category';
219
- // $post->ecwid_category_id = $category->id;
220
-
221
- $posts[] = $post;
 
 
 
 
222
  }
223
-
224
- EcwidPlatform::cache_set( 'nav_categories_posts', $posts, DAY_IN_SECONDS );
225
- }
226
 
227
  foreach ( $posts as $post ) {
228
  $counter++;
@@ -238,7 +240,8 @@ class Ecwid_Nav_Menus {
238
 
239
  public function nav_menu_link_attributes( $attributes, $item )
240
  {
241
- if ( !isset( $item->ecwid_page_type ) ) {
 
242
  return $attributes;
243
  }
244
 
191
  if ( !$posts ) {
192
  $posts = array();
193
  $categories = ecwid_get_categories();
194
+ if ($categories) {
195
+ foreach ($categories as $category) {
196
+ $post = new stdClass;
197
+ $post->ID = -1;
198
+ $post->post_author = '';
199
+ $post->post_date = '';
200
+ $post->post_date_gmt = '';
201
+ $post->post_password = '';
202
+ $post->post_name = '';
203
+ $post->post_type = $item->post_type;
204
+ $post->post_status = 'publish';
205
+ $post->to_ping = '';
206
+ $post->pinged = '';
207
+ $post->post_parent = 0;
208
+ $post->url = Ecwid_Store_Page::get_category_url($category->id);
209
+ $post->classes = '';
210
+ $post->type = 'post';
211
+ $post->db_id = 0;
212
+ $post->title = $category->name;
213
+ $post->target = '';
214
+ $post->object = '';
215
+ $post->attr_title = '';
216
+ $post->description = '';
217
+ $post->xfn = '';
218
+ $post->object_id = 0;
219
+ $post->ecwid_page_type = 'category';
220
+ $post->ecwid_category_id = $category->id;
221
+
222
+ $posts[] = $post;
223
+ }
224
+
225
+ EcwidPlatform::cache_set( 'nav_categories_posts', $posts, DAY_IN_SECONDS );
226
  }
227
+ }
 
 
228
 
229
  foreach ( $posts as $post ) {
230
  $counter++;
240
 
241
  public function nav_menu_link_attributes( $attributes, $item )
242
  {
243
+
244
+ if ( !isset( $item->ecwid_page_type ) ) {
245
  return $attributes;
246
  }
247
 
includes/class-ecwid-popup-deactivate.php CHANGED
@@ -45,9 +45,16 @@ class Ecwid_Popup_Deactivate extends Ecwid_Popup {
45
  $body_lines[] = 'Plugin installed: ' . strftime( '%d %b %Y', get_option( 'ecwid_installation_date' ) );
46
  $body_lines[] = 'Reason:' . $reason['text'] . "\n" . ( !empty( $_GET['message'] ) ? $_GET['message'] : '[no message]' );
47
 
48
- global $current_user;
49
- $reply_to = $current_user->user_email;
50
-
 
 
 
 
 
 
 
51
  $subject_template = __( '[%s] WordPress plugin deactivation feedback (store ID: %s)', 'ecwid-shopping-cart' );
52
 
53
  $prefix = $reason['code'];
45
  $body_lines[] = 'Plugin installed: ' . strftime( '%d %b %Y', get_option( 'ecwid_installation_date' ) );
46
  $body_lines[] = 'Reason:' . $reason['text'] . "\n" . ( !empty( $_GET['message'] ) ? $_GET['message'] : '[no message]' );
47
 
48
+ $api = new Ecwid_Api_V3();
49
+
50
+ $profile = $api->get_store_profile();
51
+ if ( $profile && @$profile->account && @$profile->account->accountEmail ) {
52
+ $reply_to = $profile->account->accountEmail;
53
+ } else {
54
+ global $current_user;
55
+ $reply_to = $current_user->user_email;
56
+ }
57
+
58
  $subject_template = __( '[%s] WordPress plugin deactivation feedback (store ID: %s)', 'ecwid-shopping-cart' );
59
 
60
  $prefix = $reason['code'];
includes/class-ecwid-product-popup.php CHANGED
@@ -24,7 +24,11 @@ class Ecwid_Product_Popup {
24
  if ($current_screen->base != 'post') {
25
  return;
26
  }
27
-
 
 
 
 
28
  if (Ecwid_Api_V3::get_token()) {
29
  add_action('media_buttons_context', array($this, 'add_editor_button'));
30
  add_action('admin_enqueue_scripts', array($this, 'add_scripts'));
24
  if ($current_screen->base != 'post') {
25
  return;
26
  }
27
+
28
+ if ( !in_array( $current_screen->post_type, array( 'page', 'post' ) ) ) {
29
+ return;
30
+ }
31
+
32
  if (Ecwid_Api_V3::get_token()) {
33
  add_action('media_buttons_context', array($this, 'add_editor_button'));
34
  add_action('admin_enqueue_scripts', array($this, 'add_scripts'));
includes/class-ecwid-seo-links.php CHANGED
@@ -248,11 +248,13 @@ JS;
248
  public static function enable() {
249
  update_option( self::OPTION_ENABLED, true );
250
  Ecwid_Store_Page::schedule_flush_rewrites();
 
251
  }
252
 
253
  public static function disable() {
254
  update_option( self::OPTION_ENABLED, false );
255
  Ecwid_Store_Page::schedule_flush_rewrites();
 
256
  }
257
 
258
  public static function is_feature_available() {
248
  public static function enable() {
249
  update_option( self::OPTION_ENABLED, true );
250
  Ecwid_Store_Page::schedule_flush_rewrites();
251
+ ecwid_invalidate_cache( true );
252
  }
253
 
254
  public static function disable() {
255
  update_option( self::OPTION_ENABLED, false );
256
  Ecwid_Store_Page::schedule_flush_rewrites();
257
+ ecwid_invalidate_cache( true );
258
  }
259
 
260
  public static function is_feature_available() {
includes/shortcodes/class-ecwid-shortcode-productbrowser.php CHANGED
@@ -62,7 +62,6 @@ HTML;
62
  */
63
  public function _build_html_catalog($store_id, $params)
64
  {
65
- include_once ECWID_PLUGIN_DIR . 'lib/ecwid_product_api.php';
66
  include_once ECWID_PLUGIN_DIR . 'lib/ecwid_catalog.php';
67
 
68
  $page_url = get_page_link();
62
  */
63
  public function _build_html_catalog($store_id, $params)
64
  {
 
65
  include_once ECWID_PLUGIN_DIR . 'lib/ecwid_catalog.php';
66
 
67
  $page_url = get_page_link();
includes/themes.php CHANGED
@@ -41,7 +41,7 @@ function ecwid_apply_theme($theme_name = null)
41
  'pixova-lite' => array( 'js', 'scroll' ),
42
  'accesspress-mag' => array( 'css' ),
43
  'attitude' => array( 'css-no-parent' ),
44
- 'customizr' => array( 'js', 'css' ),
45
  'edin' => array( 'js' ),
46
  'evolve' => array( 'css-no-parent' ),
47
  'mantra' => array( 'css-no-parent' ),
41
  'pixova-lite' => array( 'js', 'scroll' ),
42
  'accesspress-mag' => array( 'css' ),
43
  'attitude' => array( 'css-no-parent' ),
44
+ 'customizr' => array( 'js', 'css-no-parent' ),
45
  'edin' => array( 'js' ),
46
  'evolve' => array( 'css-no-parent' ),
47
  'mantra' => array( 'css-no-parent' ),
includes/widgets/class-ecwid-widget-latest-products.php CHANGED
@@ -22,6 +22,6 @@ class Ecwid_Widget_Latest_Products extends Ecwid_Widget_Products_List_Base {
22
  'limit' => $this->_instance['number_of_products']
23
  ));
24
 
25
- return $result->items;
26
  }
27
  }
22
  'limit' => $this->_instance['number_of_products']
23
  ));
24
 
25
+ return @$result->items;
26
  }
27
  }
includes/widgets/class-ecwid-widget-random-product.php CHANGED
@@ -13,6 +13,10 @@ class Ecwid_Widget_Random_Product extends WP_Widget {
13
 
14
  $product = Ecwid_Product::get_random_product();
15
 
 
 
 
 
16
  $name = esc_attr($product->name);
17
 
18
  $url = $product->link;
13
 
14
  $product = Ecwid_Product::get_random_product();
15
 
16
+ if (! $product ) {
17
+ return;
18
+ }
19
+
20
  $name = esc_attr($product->name);
21
 
22
  $url = $product->link;
js/frontend.js CHANGED
@@ -3,7 +3,6 @@ window.ec.config = window.ec.config || {};
3
  window.ec.config.storefrontUrls = window.ec.config.storefrontUrls || {};
4
 
5
  jQuery(document).ready(function() {
6
- jQuery('.ecwid-store-with-categories a').click(function() {jQuery(':focus').blur()});
7
 
8
  window.ecwidShoppingCartMakeStoreLinksUseApiCall = function($link) {
9
 
@@ -20,22 +19,22 @@ jQuery(document).ready(function() {
20
  } else {
21
  Ecwid.openPage('category', 0);
22
  }
23
- } if (page == 'category') {
24
- Ecwid.openPage('category', {id:jQuery(this).data('ecwid-category-id')});
 
 
 
 
 
25
  } else if ( page == 'product' ) {
26
  Ecwid.openPage('product', {id: jQuery(this).data('ecwid-product-id')});
27
  } else {
28
  Ecwid.openPage(page);
29
  }
30
-
31
- jQuery(this).parents('ul.sub-menu.focus').removeClass('focus').blur().parents('li.menu-item.focus').removeClass('focus').blur();
32
-
33
  return false;
34
  });
35
  };
36
 
37
-
38
- if (ecwidParams.useJsApiToOpenStorePages) {
39
- ecwidShoppingCartMakeStoreLinksUseApiCall(jQuery("a[data-ecwid-page]"));
40
- }
41
  });
3
  window.ec.config.storefrontUrls = window.ec.config.storefrontUrls || {};
4
 
5
  jQuery(document).ready(function() {
 
6
 
7
  window.ecwidShoppingCartMakeStoreLinksUseApiCall = function($link) {
8
 
19
  } else {
20
  Ecwid.openPage('category', 0);
21
  }
22
+ } if (page == 'category' ) {
23
+ if (ecwidParams.useJsApiToOpenStoreCategoriesPages) {
24
+ Ecwid.openPage('category', {id:jQuery(this).data('ecwid-category-id')});
25
+ jQuery(this).hide().blur().show();
26
+ } else {
27
+ return;
28
+ }
29
  } else if ( page == 'product' ) {
30
  Ecwid.openPage('product', {id: jQuery(this).data('ecwid-product-id')});
31
  } else {
32
  Ecwid.openPage(page);
33
  }
34
+
 
 
35
  return false;
36
  });
37
  };
38
 
39
+ ecwidShoppingCartMakeStoreLinksUseApiCall(jQuery("a[data-ecwid-page]"));
 
 
 
40
  });
lib/ecwid_api_v3.php CHANGED
@@ -73,6 +73,7 @@ class Ecwid_Api_V3
73
  );
74
 
75
  $result = EcwidPlatform::get_from_categories_cache($url);
 
76
  if ( !$result ) {
77
  $result = EcwidPlatform::fetch_url( $url );
78
 
@@ -294,10 +295,14 @@ class Ecwid_Api_V3
294
  if (empty($encrypted)) return false;
295
 
296
  $token = EcwidPlatform::decrypt($encrypted);
 
 
 
 
297
  } else {
298
  $token = $db_value;
299
  }
300
-
301
  return $token;
302
  }
303
 
@@ -367,6 +372,10 @@ class Ecwid_Api_V3
367
  $url = $this->build_request_url($url, $params);
368
  $result = EcwidPlatform::fetch_url($url);
369
 
 
 
 
 
370
  return json_decode($result['data']);
371
  }
372
 
@@ -398,8 +407,8 @@ class Ecwid_Api_V3
398
  if ($profile && isset($profile->settings) && isset($profile->settings->hideOutOfStockProductsInStorefront)) {
399
  EcwidPlatform::set('hide_out_of_stock', $profile->settings->hideOutOfStockProductsInStorefront);
400
  }
401
-
402
- return self::$profile;
403
  }
404
 
405
  public function create_store()
73
  );
74
 
75
  $result = EcwidPlatform::get_from_categories_cache($url);
76
+
77
  if ( !$result ) {
78
  $result = EcwidPlatform::fetch_url( $url );
79
 
295
  if (empty($encrypted)) return false;
296
 
297
  $token = EcwidPlatform::decrypt($encrypted);
298
+
299
+ if ($token == $db_value) {
300
+ return false;
301
+ }
302
  } else {
303
  $token = $db_value;
304
  }
305
+
306
  return $token;
307
  }
308
 
372
  $url = $this->build_request_url($url, $params);
373
  $result = EcwidPlatform::fetch_url($url);
374
 
375
+ if ( !isset( $result['data'] ) ) {
376
+ return null;
377
+ }
378
+
379
  return json_decode($result['data']);
380
  }
381
 
407
  if ($profile && isset($profile->settings) && isset($profile->settings->hideOutOfStockProductsInStorefront)) {
408
  EcwidPlatform::set('hide_out_of_stock', $profile->settings->hideOutOfStockProductsInStorefront);
409
  }
410
+
411
+ return $profile;
412
  }
413
 
414
  public function create_store()
lib/ecwid_catalog.php CHANGED
@@ -19,6 +19,10 @@ class EcwidCatalog
19
  public function get_product($id)
20
  {
21
  $result = $this->_get_data_for_product($id);
 
 
 
 
22
 
23
  ob_start();
24
  $product = $result->product;
@@ -35,6 +39,10 @@ class EcwidCatalog
35
  {
36
  $data = $this->_get_data_for_category( $id, @$_GET['offset'] );
37
 
 
 
 
 
38
  $main_category = null;
39
  if ($id > 0) {
40
  $main_category = $data->main_category;
@@ -61,23 +69,17 @@ class EcwidCatalog
61
 
62
  $profile = $api->get_store_profile();
63
 
 
 
 
 
64
  return (object) array(
65
  'product' => $product,
66
  'formats' => $profile->formatsAndUnits
67
  );
68
- } else {
69
-
70
- $params = array
71
- (
72
- array("alias" => "product", "action" => "product", "params" => array("id" => $id)),
73
- array("alias" => "formats", "action" => "profile")
74
- );
75
-
76
- $batch_result = $this->_get_apiv1_batch_result( $params );
77
-
78
- return $batch_result;
79
- }
80
 
 
81
  }
82
 
83
  protected function _get_data_for_category( $id, $offset = 0 )
@@ -108,40 +110,19 @@ class EcwidCatalog
108
 
109
  $profile = $api->get_store_profile();
110
 
 
 
 
 
111
  return (object) array(
112
  'main_category' => $main_category,
113
  'categories' => $categories->items,
114
  'products' => $products->items,
115
  'formats' => $profile->formatsAndUnits
116
  );
117
- } else {
118
- $params = array
119
- (
120
- array("alias" => "categories", "action" => "categories", "params" => array("parent" => $id)),
121
- array("alias" => "products", "action" => "products", "params" => array("category" => $id)),
122
- array("alias" => "formats", "action" => "profile")
123
- );
124
- if ($id > 0) {
125
- $params[] = array('alias' => 'main_category', "action" => "category", "params" => array("id" => $id));
126
- }
127
-
128
- $batch_result = $this->_get_apiv1_batch_result( $params );
129
- if ( $batch_result && !isset($batch_result->main_category) ) {
130
- $batch_result->main_category = null;
131
- }
132
-
133
- return $batch_result;
134
- }
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;
145
  }
146
 
147
  public function parse_escaped_fragment($escaped_fragment)
19
  public function get_product($id)
20
  {
21
  $result = $this->_get_data_for_product($id);
22
+
23
+ if ( !$result ) {
24
+ return '';
25
+ }
26
 
27
  ob_start();
28
  $product = $result->product;
39
  {
40
  $data = $this->_get_data_for_category( $id, @$_GET['offset'] );
41
 
42
+ if ( !$data ) {
43
+ return '';
44
+ }
45
+
46
  $main_category = null;
47
  if ($id > 0) {
48
  $main_category = $data->main_category;
69
 
70
  $profile = $api->get_store_profile();
71
 
72
+ if (!$profile) {
73
+ return null;
74
+ }
75
+
76
  return (object) array(
77
  'product' => $product,
78
  'formats' => $profile->formatsAndUnits
79
  );
80
+ }
 
 
 
 
 
 
 
 
 
 
 
81
 
82
+ return null;
83
  }
84
 
85
  protected function _get_data_for_category( $id, $offset = 0 )
110
 
111
  $profile = $api->get_store_profile();
112
 
113
+ if ( is_null( $profile ) || !isset( $categories->items ) || !isset( $products->items ) ) {
114
+ return null;
115
+ }
116
+
117
  return (object) array(
118
  'main_category' => $main_category,
119
  'categories' => $categories->items,
120
  'products' => $products->items,
121
  'formats' => $profile->formatsAndUnits
122
  );
123
+ }
124
+
125
+ return null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  }
127
 
128
  public function parse_escaped_fragment($escaped_fragment)
lib/ecwid_category.php CHANGED
@@ -49,6 +49,10 @@ class Ecwid_Category extends Ecwid_Catalog_Entry
49
  } else {
50
  $e->_init_from_stdclass( $entry_data );
51
  }
 
 
 
 
52
 
53
  $e->_put_into_local_object_cache($e);
54
 
@@ -79,13 +83,9 @@ class Ecwid_Category extends Ecwid_Catalog_Entry
79
  if ( $data && Ecwid_Seo_Links::is_enabled() ) {
80
  $data->seo_link = $data->url;
81
  }
82
- } else {
83
- $api = ecwid_new_product_api();
84
- $data = $api->get_category($id);
85
- }
86
 
87
  if ($data) {
88
-
89
  $this->_init_from_stdclass($data);
90
  }
91
 
49
  } else {
50
  $e->_init_from_stdclass( $entry_data );
51
  }
52
+
53
+ if ( !$e->_data ) {
54
+ return null;
55
+ }
56
 
57
  $e->_put_into_local_object_cache($e);
58
 
83
  if ( $data && Ecwid_Seo_Links::is_enabled() ) {
84
  $data->seo_link = $data->url;
85
  }
86
+ }
 
 
 
87
 
88
  if ($data) {
 
89
  $this->_init_from_stdclass($data);
90
  }
91
 
lib/ecwid_platform.php CHANGED
@@ -101,7 +101,7 @@ class EcwidPlatform {
101
 
102
  $use_file_get_contents = EcwidPlatform::cache_get('ecwid_fetch_url_use_file_get_contents', false);
103
 
104
- if ($use_file_get_contents) {
105
  $result = @file_get_contents($url, null, $ctx);
106
  } else {
107
  if (get_option('ecwid_http_use_stream', false)) {
101
 
102
  $use_file_get_contents = EcwidPlatform::cache_get('ecwid_fetch_url_use_file_get_contents', false);
103
 
104
+ if ( $use_file_get_contents ) {
105
  $result = @file_get_contents($url, null, $ctx);
106
  } else {
107
  if (get_option('ecwid_http_use_stream', false)) {
lib/ecwid_product.php CHANGED
@@ -41,6 +41,9 @@ class Ecwid_Product extends Ecwid_Catalog_Entry
41
 
42
  if ( !$product_data ) {
43
  $p->_load($id);
 
 
 
44
  $p->_persist();
45
  } else {
46
  $p->_data = $product_data;
@@ -81,6 +84,10 @@ class Ecwid_Product extends Ecwid_Catalog_Entry
81
  )
82
  );
83
 
 
 
 
 
84
  $random_product_id = $result->items[$index - $offset]->id;
85
  }
86
 
@@ -148,9 +155,6 @@ class Ecwid_Product extends Ecwid_Catalog_Entry
148
  if ( $data && Ecwid_Seo_Links::is_enabled() ) {
149
  $data->seo_link = $data->url;
150
  }
151
- } else {
152
- $api = ecwid_new_product_api();
153
- $data = $api->get_product_https($id);
154
  }
155
 
156
  if ($data) {
41
 
42
  if ( !$product_data ) {
43
  $p->_load($id);
44
+ if ( !$p->_data ) {
45
+ return null;
46
+ }
47
  $p->_persist();
48
  } else {
49
  $p->_data = $product_data;
84
  )
85
  );
86
 
87
+ if (!@$result->items) {
88
+ return null;
89
+ }
90
+
91
  $random_product_id = $result->items[$index - $offset]->id;
92
  }
93
 
155
  if ( $data && Ecwid_Seo_Links::is_enabled() ) {
156
  $data->seo_link = $data->url;
157
  }
 
 
 
158
  }
159
 
160
  if ($data) {
lib/ecwid_requests.php CHANGED
@@ -285,6 +285,8 @@ class Ecwid_HTTP_Get_WpRemoteGet extends Ecwid_HTTP_Get {
285
  );
286
 
287
  if (is_wp_error($this->raw_result)) {
 
 
288
  $this->_trigger_error();
289
 
290
  return $this->raw_result;
285
  );
286
 
287
  if (is_wp_error($this->raw_result)) {
288
+ $this->error = $this->raw_result;
289
+
290
  $this->_trigger_error();
291
 
292
  return $this->raw_result;
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: 5.7.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,11 +149,17 @@ 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.7.2 - Dec 20, 1017 =
 
 
 
 
 
 
153
  - **Fixed a couple of bugs on the Ecwid dashboard page.** The store control panel might not appear in the Wordpress backend for some users (especially it was likely to happen in Safari browser). We fixed it. So if you experienced that issue in your Wordpress admin backend, this update should fix it for you.
154
  - **Added fixes and layout improvements to make Ecwid e-commerce plugin compatible with “Abubize Business” and “Evolve Plus” Wordpress themes.** If you use one of those themes, you might notice layout issues on your store page caused by the theme styles overriding Ecwid styles. We fixed that. If you find any trouble in how Ecwid works with your theme, please let us know.
155
  - **Fixed an issue in the way Ecwid shortcode is rendered in the Wordpress page editor.** You might notice the Wordpress editor froze when you changed the "widgets" part of the Ecwid shortcode in the editor. For example, if you put a shortcode with categories widget only (without product browser). We fixed it — now you can adjust the shortcode as you wish. Note this problem only affected the Wordpress editor — neither your store nor your control panel were affected. So, if you don't customize the shortcode content, you can just ignore this, everything is working fine for you.
156
- - **Several minor fixes and improvements.** Ecwid is constantly updated with new cool ecommerce features. To see more updates and learn something new about selling online, see our blog.
157
 
158
  = 5.7.1 =
159
  - **Fix for the “The requested product is not available” error message appeared in the version 5.7**. The issue was caused by the new “Default product” feature. Some users found that error message when adding their store to a new page in the plugin and specifying the default category for that page. Everything should work fine now.
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: 5.7.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.7.3 - Jan 18, 2018 =
153
+ - **Improved compatibility with Customizr theme.** We are inspecting how the plugin works with a popular “Customizr” theme and making the store appearance and behavior fit the theme better. This is the first part of improvements for Customizr, we will continue making it better in the future versions.
154
+ - **Improvements in the way the plugin communicates with the Ecwid APIs.** We cleaned up the plugin code and improved its internal functions to make sure storefront and product widgets are using the newest Ecwid API and work more stable.
155
+ - **Minor improvements in the SEO.** We made a few fixes and adjustments in canonical tags and SEO-friendly URLs functionality.
156
+ - **Ecwid e-commerce service is constantly updated with new cool features and improvements.** To see more updates and learn something new about selling online, see [our blog](https://www.ecwid.com/blog/ecwid-updates).
157
+
158
+ = 5.7.2 - Dec 20, 2017 =
159
  - **Fixed a couple of bugs on the Ecwid dashboard page.** The store control panel might not appear in the Wordpress backend for some users (especially it was likely to happen in Safari browser). We fixed it. So if you experienced that issue in your Wordpress admin backend, this update should fix it for you.
160
  - **Added fixes and layout improvements to make Ecwid e-commerce plugin compatible with “Abubize Business” and “Evolve Plus” Wordpress themes.** If you use one of those themes, you might notice layout issues on your store page caused by the theme styles overriding Ecwid styles. We fixed that. If you find any trouble in how Ecwid works with your theme, please let us know.
161
  - **Fixed an issue in the way Ecwid shortcode is rendered in the Wordpress page editor.** You might notice the Wordpress editor froze when you changed the "widgets" part of the Ecwid shortcode in the editor. For example, if you put a shortcode with categories widget only (without product browser). We fixed it — now you can adjust the shortcode as you wish. Note this problem only affected the Wordpress editor — neither your store nor your control panel were affected. So, if you don't customize the shortcode content, you can just ignore this, everything is working fine for you.
162
+ - **Several minor fixes and improvements.** Ecwid is constantly updated with new cool ecommerce features. To see more updates and learn something new about selling online, see our see [our blog](https://www.ecwid.com/blog/ecwid-updates).
163
 
164
  = 5.7.1 =
165
  - **Fix for the “The requested product is not available” error message appeared in the version 5.7**. The issue was caused by the new “Default product” feature. Some users found that error message when adding their store to a new page in the plugin and specifying the default category for that page. Everything should work fine now.