Ecwid Ecommerce Shopping Cart - Version 3.0.2

Version Description

  • Fixed a few issues in the recently viewed products widget
Download this release

Release Info

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

Code changes from version 3.0.1 to 3.0.2

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: 3.0.1
9
  Author URI: http://www.ecwid.com?source=wporg
10
  */
11
 
@@ -373,17 +373,52 @@ function ecwid_check_version()
373
 
374
  if ($fresh_install) {
375
 
 
376
  do_action('ecwid_plugin_installed', $current_version);
377
  add_option('ecwid_plugin_version', $current_version);
378
 
379
  } elseif ($upgrade) {
380
 
 
381
  do_action('ecwid_plugin_upgraded', array( 'old' => $stored_version, 'new' => $current_version ) );
382
  update_option('ecwid_plugin_version', $current_version);
383
 
384
  }
385
  }
386
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
387
  function ecwid_override_option($name, $new_value = null)
388
  {
389
  static $overridden = array();
@@ -735,10 +770,10 @@ function ecwid_content_started($content)
735
 
736
  function ecwid_wrap_shortcode_content($content, $name)
737
  {
738
- return "<!-- Ecwid shopping cart plugin v 3.0.1 -->"
739
  . ecwid_get_scriptjs_code()
740
  . "<div class=\"ecwid-shopping-cart-$name\">$content</div>"
741
- . "<!-- END Ecwid Shopping Cart v 3.0.1 -->";
742
  }
743
 
744
  function ecwid_get_scriptjs_code($force_lang = null) {
@@ -1147,8 +1182,7 @@ EOT;
1147
  // Does not affect updates, automatically turned on for new users only
1148
  add_option("ecwid_advanced_theme_layout", get_option('ecwid_store_id') == ECWID_DEMO_STORE_ID ? 'Y' : 'N', 'yes');
1149
 
1150
- add_option('ecwid_oauth_client_id', 'RD4o2KQimiGUrFZc');
1151
- add_option('ecwid_oauth_client_secret', 'jEPVdcA3KbzKVrG8FZDgNnsY3wKHDTF8');
1152
 
1153
  $id = get_option("ecwid_store_page_id");
1154
  $_tmp_page = null;
@@ -1235,8 +1269,6 @@ function ecwid_uninstall() {
1235
  delete_option("ecwid_installation_date");
1236
  delete_option('ecwid_hide_appearance_menu');
1237
  delete_option("ecwid_advanced_theme_layout");
1238
- delete_option('ecwid_oauth_client_id');
1239
- delete_option('ecwid_oauth_client_secret');
1240
  }
1241
 
1242
  function ecwid_abs_intval($value) {
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: 3.0.2
9
  Author URI: http://www.ecwid.com?source=wporg
10
  */
11
 
373
 
374
  if ($fresh_install) {
375
 
376
+ ecwid_plugin_add_oauth();
377
  do_action('ecwid_plugin_installed', $current_version);
378
  add_option('ecwid_plugin_version', $current_version);
379
 
380
  } elseif ($upgrade) {
381
 
382
+ ecwid_plugin_add_oauth();
383
  do_action('ecwid_plugin_upgraded', array( 'old' => $stored_version, 'new' => $current_version ) );
384
  update_option('ecwid_plugin_version', $current_version);
385
 
386
  }
387
  }
388
 
389
+ function ecwid_log_error($message)
390
+ {
391
+ $errors = get_option('ecwid_error_log');
392
+ if (!$errors) {
393
+ $errors = array();
394
+ } else {
395
+ $errors = json_decode($errors);
396
+ if (!is_array($errors)) {
397
+ $errors = array();
398
+ }
399
+ }
400
+
401
+ while (count($errors) > 10) {
402
+ array_shift($errors);
403
+ }
404
+
405
+ $errors[] = array(
406
+ 'message' => $message,
407
+ 'date' => strftime('%c')
408
+ );
409
+
410
+ update_option('ecwid_error_log', json_encode($errors));
411
+ }
412
+
413
+ function ecwid_plugin_add_oauth()
414
+ {
415
+ add_option('ecwid_oauth_client_id', 'RD4o2KQimiGUrFZc');
416
+ add_option('ecwid_oauth_client_secret', 'jEPVdcA3KbzKVrG8FZDgNnsY3wKHDTF8');
417
+
418
+ update_option('ecwid_oauth_client_id', 'RD4o2KQimiGUrFZc');
419
+ update_option('ecwid_oauth_client_secret', 'jEPVdcA3KbzKVrG8FZDgNnsY3wKHDTF8');
420
+ }
421
+
422
  function ecwid_override_option($name, $new_value = null)
423
  {
424
  static $overridden = array();
770
 
771
  function ecwid_wrap_shortcode_content($content, $name)
772
  {
773
+ return "<!-- Ecwid shopping cart plugin v 3.0.2 -->"
774
  . ecwid_get_scriptjs_code()
775
  . "<div class=\"ecwid-shopping-cart-$name\">$content</div>"
776
+ . "<!-- END Ecwid Shopping Cart v 3.0.2 -->";
777
  }
778
 
779
  function ecwid_get_scriptjs_code($force_lang = null) {
1182
  // Does not affect updates, automatically turned on for new users only
1183
  add_option("ecwid_advanced_theme_layout", get_option('ecwid_store_id') == ECWID_DEMO_STORE_ID ? 'Y' : 'N', 'yes');
1184
 
1185
+ /* All new options should go to check_version thing */
 
1186
 
1187
  $id = get_option("ecwid_store_page_id");
1188
  $_tmp_page = null;
1269
  delete_option("ecwid_installation_date");
1270
  delete_option('ecwid_hide_appearance_menu');
1271
  delete_option("ecwid_advanced_theme_layout");
 
 
1272
  }
1273
 
1274
  function ecwid_abs_intval($value) {
includes/class-ecwid-oauth.php CHANGED
@@ -45,14 +45,19 @@ class Ecwid_OAuth {
45
  $params['grant_type'] = 'authorization_code';
46
 
47
  $return = wp_remote_post('https://my.ecwid.com/api/oauth/token', array('body' => $params));
48
- $result = json_decode($return['body']);
 
 
 
49
 
50
  if (
51
- !isset( $result->store_id )
 
52
  || !isset( $result->scope )
53
  || !isset( $result->access_token )
54
  || ( $result->token_type != 'Bearer' )
55
  ) {
 
56
  return $this->trigger_auth_error();
57
  }
58
 
45
  $params['grant_type'] = 'authorization_code';
46
 
47
  $return = wp_remote_post('https://my.ecwid.com/api/oauth/token', array('body' => $params));
48
+
49
+ if (is_array($return) && isset($return['body'])) {
50
+ $result = json_decode($return['body']);
51
+ }
52
 
53
  if (
54
+ !is_array($return)
55
+ || !isset( $result->store_id )
56
  || !isset( $result->scope )
57
  || !isset( $result->access_token )
58
  || ( $result->token_type != 'Bearer' )
59
  ) {
60
+ ecwid_log_error(json_encode($return));
61
  return $this->trigger_auth_error();
62
  }
63
 
js/products-list.js CHANGED
@@ -6,12 +6,15 @@ jQuery.widget('ecwid.productsList', {
6
  this.container = null;
7
  this._prefix = 'ecwid-productsList';
8
  this.sort = [];
 
 
 
 
9
 
10
 
11
  this.element.addClass(this._prefix);
12
  this._removeInitialContent();
13
  this.container = jQuery('<ul>').appendTo(this.element);
14
- this._setOption('debug', false);
15
  this._initFromHtmlData();
16
  this._readSingleProducts();
17
  this._onWindowResize();
@@ -148,7 +151,7 @@ jQuery.widget('ecwid.productsList', {
148
  },
149
 
150
  _getProductsToShow: function() {
151
- return this.sort.slice(0, this.options.max);
152
  },
153
 
154
  _addToSort: function(id) {
@@ -158,7 +161,6 @@ jQuery.widget('ecwid.productsList', {
158
  _triggerError: function(message) {
159
  message = 'ecwid.productsList ' + message;
160
  if (this.options.debug) {
161
- debugger;
162
  alert(message);
163
  }
164
  console.log(message);
6
  this.container = null;
7
  this._prefix = 'ecwid-productsList';
8
  this.sort = [];
9
+ this.options = {
10
+ max: 3,
11
+ debug: false
12
+ };
13
 
14
 
15
  this.element.addClass(this._prefix);
16
  this._removeInitialContent();
17
  this.container = jQuery('<ul>').appendTo(this.element);
 
18
  this._initFromHtmlData();
19
  this._readSingleProducts();
20
  this._onWindowResize();
151
  },
152
 
153
  _getProductsToShow: function() {
154
+ return this.sort.slice(0, this.option('max'));
155
  },
156
 
157
  _addToSort: function(id) {
161
  _triggerError: function(message) {
162
  message = 'ecwid.productsList ' + message;
163
  if (this.options.debug) {
 
164
  alert(message);
165
  }
166
  console.log(message);
js/recently-viewed-common.js CHANGED
@@ -19,7 +19,6 @@ if (wpCookies.get('test_ecwid_shopping_cart_recently_products_cookie') != 'test_
19
 
20
  Ecwid.OnPageLoaded.add(function(page) {
21
  if (page.type == 'PRODUCT') {
22
- debugger;
23
  var productInfo = fetchProductInfo(page.productId);
24
  saveProductToCookies(productInfo);
25
  }
@@ -37,7 +36,6 @@ var fetchProductInfo = function(productId) {
37
  var saveProductToCookies = function(product) {
38
  var cookieName = 'ecwid-shopping-cart-recently-viewed';
39
 
40
- debugger;
41
  var cookie = JSON.parse(wpCookies.get(cookieName));
42
 
43
  if (cookie == null || typeof(cookie) != 'object') {
@@ -66,4 +64,4 @@ var saveProductToCookies = function(product) {
66
 
67
  }
68
 
69
- })();
19
 
20
  Ecwid.OnPageLoaded.add(function(page) {
21
  if (page.type == 'PRODUCT') {
 
22
  var productInfo = fetchProductInfo(page.productId);
23
  saveProductToCookies(productInfo);
24
  }
36
  var saveProductToCookies = function(product) {
37
  var cookieName = 'ecwid-shopping-cart-recently-viewed';
38
 
 
39
  var cookie = JSON.parse(wpCookies.get(cookieName));
40
 
41
  if (cookie == null || typeof(cookie) != 'object') {
64
 
65
  }
66
 
67
+ })();
js/recently-viewed.js CHANGED
@@ -25,7 +25,9 @@ jQuery.widget('ecwid.recentlyViewedProducts', jQuery.ecwid.productsList, {
25
  setTimeout(function() {
26
  self.addViewedProduct(product);
27
  }, 500);
28
- }
 
 
29
  }
30
  );
31
  },
@@ -70,7 +72,7 @@ jQuery.widget('ecwid.recentlyViewedProducts', jQuery.ecwid.productsList, {
70
  }
71
  }
72
 
73
- return sort.reverse().slice(0, this.options.max);
74
  }
75
  });
76
 
25
  setTimeout(function() {
26
  self.addViewedProduct(product);
27
  }, 500);
28
+ } else {
29
+ self.refresh();
30
+ }
31
  }
32
  );
33
  },
72
  }
73
  }
74
 
75
+ return sort.reverse().slice(0, this.option('max')).reverse();
76
  }
77
  });
78
 
languages/ecwid-shopping-cart-ru_RU.mo CHANGED
Binary file
languages/ecwid-shopping-cart-ru_RU.po CHANGED
@@ -274,8 +274,8 @@ msgstr "Ошибка подключения: после нажатия на кн
274
  msgid "Don't have Ecwid account? Create it here"
275
  msgstr "Ещё нет аккаунта в Эквиде? Зарегистрируйтесь"
276
 
277
- msgid "Questions? Visit <a href=\"http://help.ecwid.com/?source=wporg\">Ecwid support center</a>"
278
- msgstr "Есть вопросы? Посетите <a href=\"http://help.ecwid.com/?source=wporg\">Центр поддержки Эквида (англ)</a> или <a href=\"http://www.ecwid.com/forums/forumdisplay.php?f=10\"> русскоязычный раздел форума</a>"
279
 
280
  msgid "Store ID"
281
  msgstr "ID Магазина"
274
  msgid "Don't have Ecwid account? Create it here"
275
  msgstr "Ещё нет аккаунта в Эквиде? Зарегистрируйтесь"
276
 
277
+ msgid "Questions? Visit <a %s>Ecwid support center</a>"
278
+ msgstr "Есть вопросы? Посетите <a %s>Центр поддержки Эквида (англ)</a> или <a target=\"_blank\" href=\"http://www.ecwid.com/forums/forumdisplay.php?f=10\"> русскоязычный раздел форума</a>"
279
 
280
  msgid "Store ID"
281
  msgstr "ID Магазина"
languages/ecwid-shopping-cart.pot CHANGED
@@ -274,7 +274,7 @@ msgstr ""
274
  msgid "Don't have Ecwid account? Create it here"
275
  msgstr ""
276
 
277
- msgid "Questions? Visit <a href=\"http://help.ecwid.com/?source=wporg\">Ecwid support center</a>"
278
  msgstr ""
279
 
280
  msgid "Store ID"
@@ -421,7 +421,7 @@ msgstr ""
421
  msgid "New features available, reconnect to be in touch with our updates"
422
  msgstr ""
423
 
424
- msgid "Add store"
425
  msgstr ""
426
 
427
  msgid "Store settings"
@@ -456,3 +456,4 @@ msgstr ""
456
 
457
  msgid "Demo Store"
458
  msgstr ""
 
274
  msgid "Don't have Ecwid account? Create it here"
275
  msgstr ""
276
 
277
+ msgid "Questions? Visit <a %s>Ecwid support center</a>"
278
  msgstr ""
279
 
280
  msgid "Store ID"
421
  msgid "New features available, reconnect to be in touch with our updates"
422
  msgstr ""
423
 
424
+ msgid "Questions? Visit <a href=\"http://help.ecwid.com/?source=wporg\">Ecwid support center</a>"
425
  msgstr ""
426
 
427
  msgid "Store settings"
456
 
457
  msgid "Demo Store"
458
  msgstr ""
459
+
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: ecwid
3
  Tags: ecwid, shopping cart, ecommerce, wordpress ecommerce, wp e-commerce, paypal, e-commerce, online store, store, shop, cart, online shop, shopping, digital goods, downloadable products, product catalog, ecomerce, products, facebook, f-commerce
4
  Requires at least: 2.8
5
- Tested up to: 4.1
6
- Stable tag: 3.0.1
7
 
8
  Ecwid is a full-featured shopping cart that can be added to any Wordpress site in less than 5 minutes. Start using Ecwid for free today.
9
 
@@ -107,6 +107,9 @@ http://codex.wordpress.org/Managing_Plugins#Installing_Plugins
107
  * [Ecwid site](http://www.ecwid.com/?source=wporg-plugin-site "Ecwid Site")
108
 
109
  == Changelog ==
 
 
 
110
  = 3.0.1 =
111
  - Added Russian translation of the new plugin settings and registration pages
112
  - Temporary fix for low quality images in the recently viewed products sidebar widget
2
  Contributors: ecwid
3
  Tags: ecwid, shopping cart, ecommerce, wordpress ecommerce, wp e-commerce, paypal, e-commerce, online store, store, shop, cart, online shop, shopping, digital goods, downloadable products, product catalog, ecomerce, products, facebook, f-commerce
4
  Requires at least: 2.8
5
+ Tested up to: 4.2
6
+ Stable tag: 3.0.2
7
 
8
  Ecwid is a full-featured shopping cart that can be added to any Wordpress site in less than 5 minutes. Start using Ecwid for free today.
9
 
107
  * [Ecwid site](http://www.ecwid.com/?source=wporg-plugin-site "Ecwid Site")
108
 
109
  == Changelog ==
110
+ = 3.0.2 =
111
+ - Fixed a few issues in the recently viewed products widget
112
+
113
  = 3.0.1 =
114
  - Added Russian translation of the new plugin settings and registration pages
115
  - Temporary fix for low quality images in the recently viewed products sidebar widget
templates/connect.php CHANGED
@@ -34,10 +34,10 @@
34
  <?php endif; ?>
35
 
36
  <div class="create-account-link">
37
- <a href="">
38
  <?php _e( "Don't have Ecwid account? Create it here", 'ecwid-shopping-cart' ); ?>
39
  </a>
40
  </div>
41
  </div>
42
- <p><?php _e('Questions? Visit <a href="http://help.ecwid.com/?source=wporg">Ecwid support center</a>', 'ecwid-shopping-cart'); ?></p>
43
  </div>
34
  <?php endif; ?>
35
 
36
  <div class="create-account-link">
37
+ <a target="_blank" href="https://my.ecwid.com/cp/?source=wporg#register">
38
  <?php _e( "Don't have Ecwid account? Create it here", 'ecwid-shopping-cart' ); ?>
39
  </a>
40
  </div>
41
  </div>
42
+ <p><?php echo sprintf(__('Questions? Visit <a %s>Ecwid support center</a>', 'ecwid-shopping-cart'), 'target="_blank" href="http://help.ecwid.com/?source=wporg"'); ?></p>
43
  </div>
templates/dashboard.php CHANGED
@@ -41,10 +41,10 @@
41
 
42
  <ul class="greeting-links">
43
  <li>
44
- <a href="<?php echo ecwid_get_store_page_url(); ?>"><?php _e('Visit storefront', 'ecwid-shopping-cart'); ?></a>
45
  </li>
46
  <li>
47
- <a href="//my.ecwid.com/cp?source=wporg"><?php _e('Open control panel', 'ecwid-shopping-cart'); ?></a>
48
  </li>
49
  </ul>
50
 
@@ -54,5 +54,5 @@
54
  </div>
55
 
56
  </div>
57
- <p><?php _e('Questions? Visit <a href="http://help.ecwid.com/?source=wporg">Ecwid support center</a>', 'ecwid-shopping-cart'); ?></p>
58
  </div>
41
 
42
  <ul class="greeting-links">
43
  <li>
44
+ <a target="_blank" href="<?php echo ecwid_get_store_page_url(); ?>"><?php _e('Visit storefront', 'ecwid-shopping-cart'); ?></a>
45
  </li>
46
  <li>
47
+ <a target="_blank" href="//my.ecwid.com/cp?source=wporg"><?php _e('Open control panel', 'ecwid-shopping-cart'); ?></a>
48
  </li>
49
  </ul>
50
 
54
  </div>
55
 
56
  </div>
57
+ <p><?php echo sprintf(__('Questions? Visit <a %s>Ecwid support center</a>', 'ecwid-shopping-cart'), 'target="_blank" href="http://help.ecwid.com/?source=wporg"'); ?></p>
58
  </div>