Ecwid Ecommerce Shopping Cart - Version 5.6

Version Description

Sep 27, 2017 = - Added a new sidebar widget "Latest Products"! Add this widget to your sidebar to let your customers know what's new in your online store. You will find the widget under Appearance -> Widgets section in your Wordpress admin backend. - Added SEO optimization for single product widgets. Now, single product widgets will include SEO-friendly markup for product's title/price/availability data to let the search engines better index the page content. You can add single product widgets to your site pages using the "Add Product" button in the Wordpress page editor. - Slightly optimized loading speed. The Ecwid Online Store plugin now loads less CSS/JS files on your site to decrease number of resources the visitor browser should process and to increase loading speed. - Fixed an issue with SEO friendly clean URLs. On some sites in rare occasions, product URLs responded with 404 errors. If you encounter such behavior on your site, this update should fix that. All shop URLs should work fine now they are available for visitors and are well indexed by search engines. - Various minor fixes and improvements in random product widget, SEO functionality, store dashboard and other areas. - Ecwid 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

Download this release

Release Info

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

Code changes from version 5.5 to 5.6

css/admin.css CHANGED
@@ -276,7 +276,9 @@ body[class*="_page_ecwid"] .ecwid-message {
276
  }
277
 
278
  #available-widgets .widget-top.ecwid-widget-recentlyviewed .widget-title:before,
279
- #available-widgets .widget-top.ecwid-widget-randomproduct .widget-title:before
 
 
280
  {
281
  content: "\e600";
282
  }
@@ -358,12 +360,6 @@ body[class*="_page_ecwid"] .ecwid-message {
358
  margin-top: 25px;
359
  }
360
 
361
- #ecwid-frame {
362
- border-top: 1px solid #e5e5e5;
363
- border-bottom: 1px solid #e5e5e5;
364
- max-width: 1440px;
365
- }
366
-
367
  /* Remove left padding for integrated admin */
368
  .ecwid-admin-superwrap {
369
  position:relative;
276
  }
277
 
278
  #available-widgets .widget-top.ecwid-widget-recentlyviewed .widget-title:before,
279
+ #available-widgets .widget-top.ecwid-widget-randomproduct .widget-title:before,
280
+ #available-widgets .widget-top.ecwid-widget-latestproducts .widget-title:before
281
+
282
  {
283
  content: "\e600";
284
  }
360
  margin-top: 25px;
361
  }
362
 
 
 
 
 
 
 
363
  /* Remove left padding for integrated admin */
364
  .ecwid-admin-superwrap {
365
  position:relative;
css/page-editor.css CHANGED
@@ -31,6 +31,7 @@
31
  cursor: pointer;
32
  color: #FFF;
33
  font-size: 30px;
 
34
  }
35
 
36
 
@@ -40,7 +41,8 @@
40
  height: 30px;
41
  line-height: 28px;
42
 
43
- font-size: 12px;
 
44
 
45
  background: #2EA2CC;
46
  color: #FFF;
31
  cursor: pointer;
32
  color: #FFF;
33
  font-size: 30px;
34
+ line-height: 1;
35
  }
36
 
37
 
41
  height: 30px;
42
  line-height: 28px;
43
 
44
+ font-size: 14px;
45
+ font-family: "Open Sans", helvetica, arial, sans-serif;
46
 
47
  background: #2EA2CC;
48
  color: #FFF;
css/store-popup.css CHANGED
@@ -140,6 +140,14 @@ body[class*=branch-3] #ecwid-store-popup-content .media-frame-title span.dashico
140
  }
141
  }
142
 
 
 
 
 
 
 
 
 
143
  html:not(.ie8) #ecwid-store-popup-content .store-settings-wrapper {
144
  position: absolute;
145
  top: 50%;
@@ -162,7 +170,6 @@ html:not(.ie8) #ecwid-store-popup-content .store-settings-wrapper {
162
  #ecwid-store-popup-content label {
163
  font-size: 14px;
164
  font-weight: 400;
165
- display: inline-block;
166
  width: 270px;
167
  }
168
 
@@ -242,7 +249,7 @@ html:not(.ie8) #ecwid-store-popup-content .store-settings-wrapper {
242
 
243
  #ecwid-store-popup-content .store-settings h3 {
244
  font-size: 20px;
245
- margin-bottom: 5px;
246
  }
247
 
248
  #ecwid-store-popup-content .store-settings-preview {
@@ -260,6 +267,9 @@ html:not(.ie8) #ecwid-store-popup-content .store-settings-wrapper {
260
 
261
  #ecwid-store-popup-content .store-settings .note {
262
  margin-right: 30px;
 
 
 
263
  }
264
 
265
  #ecwid-store-popup-content .note {
@@ -336,28 +346,24 @@ html:not(.ie8) #ecwid-store-popup-content .store-settings-wrapper {
336
  font-weight: 600;
337
  }
338
 
339
- #ecwid-store-popup-content .pure-control-group.default-category-id {
340
- display: table;
341
- }
342
-
343
  #ecwid-store-popup-content .pure-control-group.default-category-id label {
344
- width: 270px;
345
- min-width: 270px;
346
- max-width: 270px;
347
- display: table-cell;
348
- }
349
-
350
- #ecwid-store-popup-content .pure-control-group.default-category-id .value {
351
- display: table-cell;
352
  }
353
 
354
  #ecwid-store-popup-content .pure-control-group.default-category-id .value select,
355
  #ecwid-store-popup-content .pure-control-group.default-category-id .value input {
356
  width:100%;
 
357
  }
358
 
359
-
360
  @media only screen and (max-width: 440px) {
 
 
 
 
 
361
  #ecwid-store-popup-content .appearance .pure-control-group.params-list {
362
  margin: 35px 0px;
363
  position: relative;
@@ -381,7 +387,8 @@ html:not(.ie8) #ecwid-store-popup-content .store-settings-wrapper {
381
  }
382
 
383
  #ecwid-store-popup-content .media-frame-content .store-settings-wrapper .store-settings {
384
- padding-left: 0px;
 
385
  }
386
 
387
 
@@ -413,6 +420,13 @@ html:not(.ie8) #ecwid-store-popup-content .store-settings-wrapper {
413
  transition: color .1s ease-in-out,background .1s ease-in-out;
414
  }
415
 
 
 
 
 
 
 
 
416
  #ecwid-store-popup-content .media-modal-close span.media-modal-icon {
417
  display: block;
418
  margin-top: 5px;
140
  }
141
  }
142
 
143
+ @media only screen and (max-height: 600px) {
144
+
145
+ #ecwid-store-popup-content .store-settings-wrapper {
146
+ margin-top: 40px;
147
+ margin-bottom: 40px;
148
+ }
149
+ }
150
+
151
  html:not(.ie8) #ecwid-store-popup-content .store-settings-wrapper {
152
  position: absolute;
153
  top: 50%;
170
  #ecwid-store-popup-content label {
171
  font-size: 14px;
172
  font-weight: 400;
 
173
  width: 270px;
174
  }
175
 
249
 
250
  #ecwid-store-popup-content .store-settings h3 {
251
  font-size: 20px;
252
+ margin-bottom: 7px;
253
  }
254
 
255
  #ecwid-store-popup-content .store-settings-preview {
267
 
268
  #ecwid-store-popup-content .store-settings .note {
269
  margin-right: 30px;
270
+ max-width: 340px;
271
+ line-height: 1.8em;
272
+ margin-bottom: 26px;
273
  }
274
 
275
  #ecwid-store-popup-content .note {
346
  font-weight: 600;
347
  }
348
 
 
 
 
 
349
  #ecwid-store-popup-content .pure-control-group.default-category-id label {
350
+ margin-bottom: 5px;
351
+ display: block;
352
+ width: auto;
 
 
 
 
 
353
  }
354
 
355
  #ecwid-store-popup-content .pure-control-group.default-category-id .value select,
356
  #ecwid-store-popup-content .pure-control-group.default-category-id .value input {
357
  width:100%;
358
+ margin-left: -1px;
359
  }
360
 
 
361
  @media only screen and (max-width: 440px) {
362
+
363
+ #ecwid-store-popup-content .media-frame-content.store-settings {
364
+ padding-left: 0;
365
+ }
366
+
367
  #ecwid-store-popup-content .appearance .pure-control-group.params-list {
368
  margin: 35px 0px;
369
  position: relative;
387
  }
388
 
389
  #ecwid-store-popup-content .media-frame-content .store-settings-wrapper .store-settings {
390
+ padding-left: 16px;
391
+ padding-right: 16px;
392
  }
393
 
394
 
420
  transition: color .1s ease-in-out,background .1s ease-in-out;
421
  }
422
 
423
+ @media only screen and (max-width: 480px) {
424
+ #ecwid-store-popup-content .media-modal-close {
425
+ top: 5px;
426
+ right: 5px;
427
+ }
428
+ }
429
+
430
  #ecwid-store-popup-content .media-modal-close span.media-modal-icon {
431
  display: block;
432
  margin-top: 5px;
css/themes/2017.css CHANGED
@@ -4,7 +4,7 @@
4
  background: transparent;
5
  }
6
 
7
- html#ecwid_html body#ecwid_body .ecwid-recently-viewed-products li a:hover {
8
  -webkit-box-shadow: none;
9
  -moz-box-shadow: none;
10
  box-shadow: none;
4
  background: transparent;
5
  }
6
 
7
+ html#ecwid_html body#ecwid_body .ecwid-productsList li a:hover {
8
  -webkit-box-shadow: none;
9
  -moz-box-shadow: none;
10
  box-shadow: none;
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.5
9
  Author URI: http://www.ecwid.com?source=wporg
10
  */
11
 
@@ -321,13 +321,8 @@ function ecwid_enqueue_frontend() {
321
  wp_enqueue_script('jquery-ui-widget', includes_url() . 'js/jquery/ui/widget.min.js', array('jquery'));
322
  }
323
 
324
- wp_register_script('ecwid-products-list-js', ECWID_PLUGIN_URL . 'js/products-list.js', array('jquery-ui-widget'), get_option('ecwid_plugin_version'));
325
- wp_enqueue_script('ecwid-products-list-js');
326
-
327
- wp_register_style('ecwid-products-list-css', ECWID_PLUGIN_URL . 'css/products-list.css', array(), get_option('ecwid_plugin_version'));
328
  wp_enqueue_style('ecwid-css', ECWID_PLUGIN_URL . 'css/frontend.css',array(), get_option('ecwid_plugin_version'));
329
- wp_enqueue_style('ecwid-fonts-css', ECWID_PLUGIN_URL . 'css/fonts.css', array(), get_option('ecwid_plugin_version'));
330
-
331
  wp_enqueue_script( 'ecwid-frontend-js', ECWID_PLUGIN_URL . 'js/frontend.js', array( 'jquery' ), get_option( 'ecwid_plugin_version' ) );
332
 
333
  if ( get_post() && get_post()->post_type == Ecwid_Products::POST_TYPE_PRODUCT ) {
@@ -357,6 +352,10 @@ function ecwid_enqueue_frontend() {
357
  if (is_plugin_active('contact-form-7-designer/cf7-styles.php')) {
358
  wp_enqueue_script('ecwid-cf7designer', ECWID_PLUGIN_URL . 'js/cf7designer.js', array(), get_option('ecwid-plugin-version'), true);
359
  }
 
 
 
 
360
  }
361
 
362
  function ecwid_print_inline_js_config() {
@@ -433,16 +432,19 @@ function ecwid_load_textdomain() {
433
  }
434
 
435
  function ecwid_404_on_broken_escaped_fragment() {
436
- if (!isset($_GET['_escaped_fragment_'])) {
437
- return;
438
- }
439
 
440
  if ( !Ecwid_Api_V3::is_available() && !ecwid_is_apiv1_enabled() ) {
441
  return;
442
  }
443
 
444
- $params = ecwid_parse_escaped_fragment($_GET['_escaped_fragment_']);
445
-
 
 
 
 
 
 
446
  if (isset($params['mode']) && !empty($params['mode']) && isset($params['id'])) {
447
  $result = array();
448
  $is_root_cat = $params['mode'] == 'category' && $params['id'] == 0;
@@ -451,12 +453,15 @@ function ecwid_404_on_broken_escaped_fragment() {
451
  } elseif (!$is_root_cat && $params['mode'] == 'category') {
452
  $result = Ecwid_Category::get_by_id( $params['id'] );
453
  }
454
-
455
- if (!$is_root_cat && empty($result)) {
456
- global $wp_query;
457
-
458
- $wp_query->set_404();
459
- status_header(404);
 
 
 
460
  }
461
  }
462
  }
@@ -1758,8 +1763,8 @@ function ecwid_register_admin_styles($hook_suffix) {
1758
  wp_enqueue_style('ecwid-admin-css', ECWID_PLUGIN_URL . 'css/admin.css', array(), get_option('ecwid_plugin_version'));
1759
  wp_enqueue_style('ecwid-fonts-css', ECWID_PLUGIN_URL . 'css/fonts.css', array(), get_option('ecwid_plugin_version'));
1760
 
1761
- if (isset($_GET['page']) && $_GET['page'] == 'ec-store') {
1762
-
1763
  if (get_option('ecwid_store_id') == ECWID_DEMO_STORE_ID) {
1764
  // Open dashboard for the first time, ecwid store id is set to demo => need landing styles/scripts
1765
  wp_enqueue_script('ecwid-landing-js', ECWID_PLUGIN_URL . 'js/landing.js', array(), get_option('ecwid_plugin_version'));
@@ -1855,21 +1860,26 @@ function ecwid_common_admin_scripts() {
1855
 
1856
  wp_localize_script('ecwid-admin-js', 'ecwid_params', array(
1857
  'dashboard' => __('Dashboard', 'ecwid-shopping-cart'),
1858
- 'dashboard_url' => Ecwid_Admin::get_dashboard_url(),
1859
  'products' => __('Products', 'ecwid-shopping-cart'),
1860
- 'products_url' => Ecwid_Admin::get_dashboard_url() . '-admin-products',
1861
  'orders' => __('Orders', 'ecwid-shopping-cart'),
1862
- 'orders_url' => Ecwid_Admin::get_dashboard_url() . '-admin-orders',
1863
  'reset_cats_cache' => __('Refresh categories list', 'ecwid-shopping-cart'),
1864
  'cache_updated' => __('Done', 'ecwid-shopping-cart'),
1865
  'reset_cache_message' => __('The store top-level categories are automatically added to this drop-down menu', 'ecwid-shopping-cart'),
1866
  'store_shortcode' => Ecwid_Shortcode_Base::get_store_shortcode_name(),
1867
- 'product_shortcode' => Ecwid_Shortcode_Product::get_shortcode_name()
 
1868
  ));
1869
 
1870
  wp_enqueue_script('ecwid-sync', ECWID_PLUGIN_URL . 'js/sync.js', array(), get_option('ecwid_plugin_version'));
1871
  }
1872
 
 
 
 
 
1873
  function ecwid_get_register_link()
1874
  {
1875
  $link = Ecwid_Config::get_registration_url();
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.6
9
  Author URI: http://www.ecwid.com?source=wporg
10
  */
11
 
321
  wp_enqueue_script('jquery-ui-widget', includes_url() . 'js/jquery/ui/widget.min.js', array('jquery'));
322
  }
323
 
 
 
 
 
324
  wp_enqueue_style('ecwid-css', ECWID_PLUGIN_URL . 'css/frontend.css',array(), get_option('ecwid_plugin_version'));
325
+
 
326
  wp_enqueue_script( 'ecwid-frontend-js', ECWID_PLUGIN_URL . 'js/frontend.js', array( 'jquery' ), get_option( 'ecwid_plugin_version' ) );
327
 
328
  if ( get_post() && get_post()->post_type == Ecwid_Products::POST_TYPE_PRODUCT ) {
352
  if (is_plugin_active('contact-form-7-designer/cf7-styles.php')) {
353
  wp_enqueue_script('ecwid-cf7designer', ECWID_PLUGIN_URL . 'js/cf7designer.js', array(), get_option('ecwid-plugin-version'), true);
354
  }
355
+
356
+ if (current_user_can('manage_options')) {
357
+ wp_enqueue_style('ecwid-fonts-css', ECWID_PLUGIN_URL . 'css/fonts.css', array(), get_option('ecwid_plugin_version'));
358
+ }
359
  }
360
 
361
  function ecwid_print_inline_js_config() {
432
  }
433
 
434
  function ecwid_404_on_broken_escaped_fragment() {
 
 
 
435
 
436
  if ( !Ecwid_Api_V3::is_available() && !ecwid_is_apiv1_enabled() ) {
437
  return;
438
  }
439
 
440
+ $params = array();
441
+
442
+ if (isset($_GET['_escaped_fragment_'])) {
443
+ $params = ecwid_parse_escaped_fragment($_GET['_escaped_fragment_']);
444
+ } elseif (Ecwid_Seo_Links::is_product_browser_url()) {
445
+ $params = Ecwid_Seo_Links::maybe_extract_html_catalog_params();
446
+ }
447
+
448
  if (isset($params['mode']) && !empty($params['mode']) && isset($params['id'])) {
449
  $result = array();
450
  $is_root_cat = $params['mode'] == 'category' && $params['id'] == 0;
453
  } elseif (!$is_root_cat && $params['mode'] == 'category') {
454
  $result = Ecwid_Category::get_by_id( $params['id'] );
455
  }
456
+
457
+ if (!$is_root_cat && ( empty( $result ) || is_object ( $result ) && !isset($result->id) ) ) {
458
+ status_header( 404 );
459
+
460
+ if (isset($_GET['escaped_fragment'])) {
461
+ global $wp_query;
462
+
463
+ $wp_query->set_404();
464
+ }
465
  }
466
  }
467
  }
1763
  wp_enqueue_style('ecwid-admin-css', ECWID_PLUGIN_URL . 'css/admin.css', array(), get_option('ecwid_plugin_version'));
1764
  wp_enqueue_style('ecwid-fonts-css', ECWID_PLUGIN_URL . 'css/fonts.css', array(), get_option('ecwid_plugin_version'));
1765
 
1766
+ if (isset($_GET['page']) && strpos($_GET['page'], 'ec-store') === 0) {
1767
+
1768
  if (get_option('ecwid_store_id') == ECWID_DEMO_STORE_ID) {
1769
  // Open dashboard for the first time, ecwid store id is set to demo => need landing styles/scripts
1770
  wp_enqueue_script('ecwid-landing-js', ECWID_PLUGIN_URL . 'js/landing.js', array(), get_option('ecwid_plugin_version'));
1860
 
1861
  wp_localize_script('ecwid-admin-js', 'ecwid_params', array(
1862
  'dashboard' => __('Dashboard', 'ecwid-shopping-cart'),
1863
+ 'dashboard_url' => Ecwid_Admin::get_relative_dashboard_url(),
1864
  'products' => __('Products', 'ecwid-shopping-cart'),
1865
+ 'products_url' => Ecwid_Admin::get_relative_dashboard_url() . '-admin-products',
1866
  'orders' => __('Orders', 'ecwid-shopping-cart'),
1867
+ 'orders_url' => Ecwid_Admin::get_relative_dashboard_url() . '-admin-orders',
1868
  'reset_cats_cache' => __('Refresh categories list', 'ecwid-shopping-cart'),
1869
  'cache_updated' => __('Done', 'ecwid-shopping-cart'),
1870
  'reset_cache_message' => __('The store top-level categories are automatically added to this drop-down menu', 'ecwid-shopping-cart'),
1871
  'store_shortcode' => Ecwid_Shortcode_Base::get_store_shortcode_name(),
1872
+ 'product_shortcode' => Ecwid_Shortcode_Product::get_shortcode_name(),
1873
+ 'legacy_appearance' => ecwid_is_legacy_appearance_used()
1874
  ));
1875
 
1876
  wp_enqueue_script('ecwid-sync', ECWID_PLUGIN_URL . 'js/sync.js', array(), get_option('ecwid_plugin_version'));
1877
  }
1878
 
1879
+ function ecwid_is_legacy_appearance_used() {
1880
+ return ecwid_migrations_is_original_plugin_version_older_than('5.5');
1881
+ }
1882
+
1883
  function ecwid_get_register_link()
1884
  {
1885
  $link = Ecwid_Config::get_registration_url();
includes/class-ecwid-admin.php CHANGED
@@ -120,8 +120,11 @@ class Ecwid_Admin {
120
  }
121
 
122
  static public function get_dashboard_url() {
123
- return admin_url( 'admin.php?page=' . Ecwid_Admin::ADMIN_SLUG );
124
  }
125
- }
 
 
 
126
 
127
  $ecwid_admin = new Ecwid_Admin();
120
  }
121
 
122
  static public function get_dashboard_url() {
123
+ return admin_url( self::get_relative_dashboard_url() );
124
  }
125
+
126
+ static public function get_relative_dashboard_url() {
127
+ return 'admin.php?page=' . Ecwid_Admin::ADMIN_SLUG;
128
+ }}
129
 
130
  $ecwid_admin = new Ecwid_Admin();
includes/class-ecwid-ajax-defer-renderer.php CHANGED
@@ -14,7 +14,11 @@ class Ecwid_Ajax_Defer_Renderer {
14
 
15
  public static function get_instance()
16
  {
17
- return self::$instance = new Ecwid_Ajax_Defer_Renderer();
 
 
 
 
18
  }
19
 
20
  protected function __construct()
@@ -93,7 +97,7 @@ HTML;
93
 
94
  if (typeof Ecwid != 'undefined' && Ecwid.destroy) Ecwid.destroy();
95
 
96
- if (typeof ecwid_shortcodes != 'undefined') {
97
  window._xnext_initialization_scripts = ecwid_shortcodes;
98
 
99
  if (!document.getElementById('ecwid-script')) {
@@ -104,9 +108,14 @@ if (typeof ecwid_shortcodes != 'undefined') {
104
  script.id = 'ecwid-script'
105
 
106
  document.body.appendChild(script);
107
-
108
- var catalog = document.getElementById('ecwid-html-catalog-$ecwid_store_id');
109
- catalog.parentElement.removeChild(catalog);
 
 
 
 
 
110
  } else {
111
  ecwid_onBodyDone();
112
  }
@@ -117,7 +126,7 @@ HTML;
117
  return $before . $content . $after;
118
  }
119
 
120
- protected function _render_shortcode_script(Ecwid_Shortcode_Base $shortcode) {
121
 
122
  $args = $shortcode->build_params_string();
123
  $id = $shortcode->get_html_id();
@@ -138,4 +147,6 @@ ecwid_shortcodes[ecwid_shortcodes.length] = {
138
  HTML;
139
  return $code;
140
  }
141
- }
 
 
14
 
15
  public static function get_instance()
16
  {
17
+ if (!self::$instance) {
18
+ self::$instance = new Ecwid_Ajax_Defer_Renderer();
19
+ }
20
+
21
+ return self::$instance;
22
  }
23
 
24
  protected function __construct()
97
 
98
  if (typeof Ecwid != 'undefined' && Ecwid.destroy) Ecwid.destroy();
99
 
100
+ if (typeof ecwid_shortcodes != 'undefined') {
101
  window._xnext_initialization_scripts = ecwid_shortcodes;
102
 
103
  if (!document.getElementById('ecwid-script')) {
108
  script.id = 'ecwid-script'
109
 
110
  document.body.appendChild(script);
111
+ var el = document.getElementById('ecwid-html-catalog-$ecwid_store_id');
112
+ if (el) {
113
+ el.style.display = 'none';
114
+ }
115
+ Ecwid.OnPageLoad.add(function() {
116
+ var catalog = document.getElementById('ecwid-html-catalog-$ecwid_store_id');
117
+ catalog.parentElement.removeChild(catalog);
118
+ });
119
  } else {
120
  ecwid_onBodyDone();
121
  }
126
  return $before . $content . $after;
127
  }
128
 
129
+ protected function _render_shortcode_script($shortcode) {
130
 
131
  $args = $shortcode->build_params_string();
132
  $id = $shortcode->get_html_id();
147
  HTML;
148
  return $code;
149
  }
150
+ }
151
+
152
+ add_action('init', array('Ecwid_Ajax_Defer_Renderer', 'get_instance'), 0);
includes/class-ecwid-nav-menus.php CHANGED
@@ -15,6 +15,7 @@ class Ecwid_Nav_Menus {
15
  add_action('admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) );
16
  } else {
17
  add_action('wp_enqueue_scripts', array( $this, 'enqueue_frontend_assets' ) );
 
18
  }
19
  }
20
 
@@ -171,17 +172,17 @@ class Ecwid_Nav_Menus {
171
 
172
  $ecwid_menu_type = isset($types[$item->object]) ? $types[$item->object] : null;
173
 
174
- if ( $ecwid_menu_type ) {
175
  $item->url = Ecwid_Store_Page::get_menu_item_url($ecwid_menu_type);
 
176
  }
177
 
178
  if ($item->object == 'ecwid-store-with-categories' || $item->object == 'ecwid-store') {
179
  $item->url = Ecwid_Store_Page::get_store_url();
180
  }
181
  if ($item->object == 'ecwid-store-with-categories') {
182
-
183
  $posts = EcwidPlatform::cache_get( 'nav_categories_posts' );
184
-
185
  if ( !$posts ) {
186
  $posts = array();
187
  $categories = ecwid_get_categories();
@@ -209,10 +210,14 @@ class Ecwid_Nav_Menus {
209
  $post->description = '';
210
  $post->xfn = '';
211
  $post->object_id = 0;
 
 
212
 
213
  $posts[] = $post;
214
  }
215
- }
 
 
216
 
217
  foreach ( $posts as $post ) {
218
  $counter++;
@@ -220,14 +225,27 @@ class Ecwid_Nav_Menus {
220
  array_splice( $items, $i + $counter, 0, array( $post ) );
221
  }
222
  $counter++;
223
-
224
- EcwidPlatform::cache_set( 'nav_categories_posts', $posts, DAY_IN_SECONDS );
225
- }
226
  }
227
 
228
  return $items;
229
  }
230
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  public function create_menu_items() {
232
  $menu_links = $this->get_nav_menu_items();
233
  ?>
15
  add_action('admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) );
16
  } else {
17
  add_action('wp_enqueue_scripts', array( $this, 'enqueue_frontend_assets' ) );
18
+ add_filter( 'nav_menu_link_attributes', array( $this, 'nav_menu_link_attributes' ), 10, 2 );
19
  }
20
  }
21
 
172
 
173
  $ecwid_menu_type = isset($types[$item->object]) ? $types[$item->object] : null;
174
 
175
+ if ( $ecwid_menu_type && isset( $ecwid_menu_type['clean_url'] ) ) {
176
  $item->url = Ecwid_Store_Page::get_menu_item_url($ecwid_menu_type);
177
+ $item->ecwid_page_type = $ecwid_menu_type['clean_url'];
178
  }
179
 
180
  if ($item->object == 'ecwid-store-with-categories' || $item->object == 'ecwid-store') {
181
  $item->url = Ecwid_Store_Page::get_store_url();
182
  }
183
  if ($item->object == 'ecwid-store-with-categories') {
 
184
  $posts = EcwidPlatform::cache_get( 'nav_categories_posts' );
185
+
186
  if ( !$posts ) {
187
  $posts = array();
188
  $categories = ecwid_get_categories();
210
  $post->description = '';
211
  $post->xfn = '';
212
  $post->object_id = 0;
213
+ $post->ecwid_page_type = 'category';
214
+ $post->ecwid_category_id = $category->id;
215
 
216
  $posts[] = $post;
217
  }
218
+
219
+ EcwidPlatform::cache_set( 'nav_categories_posts', $posts, DAY_IN_SECONDS );
220
+ }
221
 
222
  foreach ( $posts as $post ) {
223
  $counter++;
225
  array_splice( $items, $i + $counter, 0, array( $post ) );
226
  }
227
  $counter++;
228
+ }
 
 
229
  }
230
 
231
  return $items;
232
  }
233
 
234
+ public function nav_menu_link_attributes( $attributes, $item )
235
+ {
236
+ if ( !isset( $item->ecwid_page_type ) ) {
237
+ return $attributes;
238
+ }
239
+
240
+ $attributes['data-ecwid-page'] = $item->ecwid_page_type;
241
+
242
+ if ( $item->ecwid_page_type == 'category' ) {
243
+ $attributes['data-ecwid-category-id'] = $item->ecwid_category_id;
244
+ }
245
+
246
+ return $attributes;
247
+ }
248
+
249
  public function create_menu_items() {
250
  $menu_links = $this->get_nav_menu_items();
251
  ?>
includes/class-ecwid-seo-links.php CHANGED
@@ -184,7 +184,7 @@ JS;
184
  public function build_rewrite_rules( ) {
185
 
186
  if ( !self::is_enabled() ) return;
187
-
188
  if ( $this->is_store_on_home_page() ) {
189
  $patterns = $this->get_seo_links_patterns();
190
  foreach ( $patterns as $pattern ) {
@@ -236,12 +236,12 @@ JS;
236
 
237
  public static function enable() {
238
  update_option( self::OPTION_ENABLED, true );
239
- flush_rewrite_rules();
240
  }
241
 
242
  public static function disable() {
243
  update_option( self::OPTION_ENABLED, false );
244
- flush_rewrite_rules();
245
  }
246
 
247
  public static function is_feature_available() {
184
  public function build_rewrite_rules( ) {
185
 
186
  if ( !self::is_enabled() ) return;
187
+
188
  if ( $this->is_store_on_home_page() ) {
189
  $patterns = $this->get_seo_links_patterns();
190
  foreach ( $patterns as $pattern ) {
236
 
237
  public static function enable() {
238
  update_option( self::OPTION_ENABLED, true );
239
+ Ecwid_Store_Page::schedule_flush_rewrites();
240
  }
241
 
242
  public static function disable() {
243
  update_option( self::OPTION_ENABLED, false );
244
+ Ecwid_Store_Page::schedule_flush_rewrites();
245
  }
246
 
247
  public static function is_feature_available() {
includes/widgets.php CHANGED
@@ -4,6 +4,7 @@ include_once "widgets/class-ecwid-widget-badge.php";
4
  include_once "widgets/class-ecwid-widget-minicart.php";
5
  include_once "widgets/class-ecwid-widget-minicart-miniview.php";
6
  include_once "widgets/class-ecwid-widget-recently-viewed.php";
 
7
  include_once "widgets/class-ecwid-widget-search.php";
8
  include_once "widgets/class-ecwid-widget-store-link.php";
9
  include_once "widgets/class-ecwid-widget-floating-shopping-cart.php";
@@ -33,6 +34,8 @@ function ecwid_sidebar_widgets_init() {
33
  register_widget('Ecwid_Widget_Minicart');
34
  register_widget('Ecwid_Widget_Store_Link');
35
  register_widget('Ecwid_Widget_Recently_Viewed');
 
 
36
  register_widget('Ecwid_Widget_Floating_Shopping_Cart');
37
  register_widget('Ecwid_Widget_Vertical_Categories_List');
38
  register_widget('Ecwid_Widget_Random_Product');
4
  include_once "widgets/class-ecwid-widget-minicart.php";
5
  include_once "widgets/class-ecwid-widget-minicart-miniview.php";
6
  include_once "widgets/class-ecwid-widget-recently-viewed.php";
7
+ include_once "widgets/class-ecwid-widget-latest-products.php";
8
  include_once "widgets/class-ecwid-widget-search.php";
9
  include_once "widgets/class-ecwid-widget-store-link.php";
10
  include_once "widgets/class-ecwid-widget-floating-shopping-cart.php";
34
  register_widget('Ecwid_Widget_Minicart');
35
  register_widget('Ecwid_Widget_Store_Link');
36
  register_widget('Ecwid_Widget_Recently_Viewed');
37
+ register_widget('Ecwid_Widget_Latest_Products');
38
+
39
  register_widget('Ecwid_Widget_Floating_Shopping_Cart');
40
  register_widget('Ecwid_Widget_Vertical_Categories_List');
41
  register_widget('Ecwid_Widget_Random_Product');
includes/widgets/class-ecwid-widget-latest-products.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once __DIR__ . '/class-ecwid-widget-products-base.php';
4
+
5
+ class Ecwid_Widget_Latest_Products extends Ecwid_Widget_Products_List_Base {
6
+
7
+ public function __construct() {
8
+ $this->_init(
9
+ __('Latest Products', 'ecwid-shopping-cart'),
10
+ __('Displays the latest added products from your store. Show new products to returning customers to drive repeat sales.', 'ecwid-shopping-cart'),
11
+ 'ecwidlatestproducts'
12
+ );
13
+
14
+ parent::__construct();
15
+ }
16
+
17
+ protected function _get_products() {
18
+ $api = new Ecwid_Api_V3();
19
+
20
+ $result = $api->search_products(array(
21
+ 'sortBy' => 'ADDED_TIME_DESC',
22
+ 'limit' => $this->_instance['number_of_products']
23
+ ));
24
+
25
+ return $result->items;
26
+ }
27
+ }
includes/widgets/class-ecwid-widget-products-base.php ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ecwid_Widget_Products_List_Base extends WP_Widget {
4
+
5
+ protected $_max = 10;
6
+ protected $_min = 1;
7
+ protected $_default = 3;
8
+
9
+ protected $_title;
10
+ protected $_widget_name;
11
+ protected $_class_name;
12
+ protected $_description;
13
+
14
+ protected $_instance;
15
+
16
+ protected $_widget_class = 'productsList';
17
+
18
+ public function __construct() {
19
+
20
+ $id_base = str_replace('_', '', $this->_widget_name);
21
+ $classname = 'widget_' . $this->_widget_name;
22
+
23
+ $widget_ops = array('classname' => $classname, 'description' => $this->_description);
24
+
25
+ parent::__construct($id_base, $this->_title, $widget_ops);
26
+
27
+ add_action( 'wp_enqueue_scripts', array($this, 'enqueue' ) );
28
+ }
29
+
30
+ protected function _init( $title, $description, $widget_name = null, $class_name = null )
31
+ {
32
+ $this->_title = $title;
33
+ $this->_description = $description;
34
+ if ( is_null ( $widget_name ) ) {
35
+ $widget_name = strtolower( $title );
36
+ $widget_name = preg_replace('![^a-z0-9_\s-]!', '', $widget_name);
37
+ $widget_name = preg_replace('![\s-]+!', '_', $widget_name);
38
+ $widget_name = 'ecwid_' . $widget_name;
39
+ }
40
+
41
+ $this->_widget_name = $widget_name;
42
+
43
+ if (is_null($class_name)) {
44
+ $class_name = str_replace('_', '-', $this->_widget_name);
45
+ }
46
+ $this->_class_name = $class_name;
47
+ }
48
+
49
+ public function enqueue() {
50
+ if ( is_active_widget( false, false, $this->id_base ) ) {
51
+ wp_enqueue_style('ecwid-products-list-css', ECWID_PLUGIN_URL . 'css/products-list.css', array(), get_option('ecwid_plugin_version'));
52
+ wp_enqueue_script('ecwid-products-list-js', ECWID_PLUGIN_URL . 'js/products-list.js', array('jquery-ui-widget'), get_option('ecwid_plugin_version'));
53
+ }
54
+ }
55
+
56
+ function widget($args, $instance) {
57
+
58
+ $this->_args = $args;
59
+ $this->_instance = $instance;
60
+
61
+ // for the sake of phpstorm sanity about undefined vars
62
+ $before_widget = $before_title = $after_title = $after_widget = '';
63
+ extract($args);
64
+
65
+ $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title']);
66
+
67
+ echo $before_widget;
68
+
69
+ if ( $title ) {
70
+ echo $before_title . $title . $after_title;
71
+ }
72
+
73
+ echo '<!-- noptimize -->' . ecwid_get_scriptjs_code() . '<!-- /noptimize -->';
74
+
75
+ echo '<div class="' . $this->_class_name . '" data-ecwid-max="' . $instance['number_of_products'] . '">';
76
+
77
+ $counter = 1;
78
+ $ids = array();
79
+
80
+ $this->_print_widget_content($instance);
81
+ echo '</div>';
82
+
83
+ echo $after_widget;
84
+ }
85
+
86
+ protected function _print_widget_content()
87
+ {
88
+ $products = $this->_get_products();
89
+
90
+ if ($products) {
91
+ $this->_print_products($products);
92
+ $this->_print_js_init();
93
+ }
94
+ }
95
+
96
+ protected function _print_js_init() {
97
+
98
+ $data_attr = "data-$this->_class_name-initialized";
99
+ echo <<<HTML
100
+ <script type="text/javascript">
101
+ <!--
102
+ jQuery(document).ready(function() {
103
+ jQuery('.$this->_class_name:not([$data_attr=1])').$this->_widget_class().attr('$data_attr', 1);
104
+ });
105
+ -->
106
+ </script>
107
+ HTML;
108
+ }
109
+
110
+ protected function _print_products($products)
111
+ {
112
+ $next = 1;
113
+ foreach ($products as $obj) {
114
+
115
+ $product = Ecwid_Product::get_by_id($obj->id);
116
+
117
+ if (!$product->id) {
118
+ continue;
119
+ }
120
+
121
+ $force_image = '';
122
+ if ( isset( $product->imageUrl ) && strpos( $product->imageUrl, 'https://' ) == 0 ) {
123
+ $force_image = $product->imageUrl;
124
+ }
125
+
126
+ $name = esc_html($product->name);
127
+
128
+ echo <<<HTML
129
+ <a class="product" href="$product->link" alt="$name" title="$name">
130
+ <div class="ecwid ecwid-SingleProduct ecwid-Product ecwid-Product-$product->id" data-single-product-link="$product->link" itemscope itemtype="http://schema.org/Product" data-single-product-id="$product->id">
131
+ <div itemprop="image" data-force-image="$force_image"></div>
132
+ <div class="ecwid-title" itemprop="name"></div>
133
+ <div itemtype="http://schema.org/Offer" itemscope itemprop="offers"><div class="ecwid-productBrowser-price ecwid-price" itemprop="price"></div></div>
134
+ </div>
135
+ <!-- noptimize --><script type="text/javascript">xSingleProduct();</script><!-- /noptimize -->
136
+ </a>
137
+ HTML;
138
+ $next++;
139
+ }
140
+ }
141
+
142
+ function update($new_instance, $old_instance){
143
+ $instance = $old_instance;
144
+
145
+ foreach ($this->_get_form_fields() as $field) {
146
+ $name = $field['name'];
147
+ if ( $name == 'number_of_products' ) {
148
+ $num = intval($new_instance['number_of_products']);
149
+ if ($num > $this->_max) {
150
+ $num = $this->_max;
151
+ } else if ($num < $this->_min) {
152
+ $num = $this->_default;
153
+ }
154
+ $instance[$name] = intval($num);
155
+ } else {
156
+ $instance[$name] = strip_tags(stripslashes($new_instance[$name]));
157
+ }
158
+ }
159
+
160
+ return $instance;
161
+ }
162
+
163
+ function form($instance){
164
+
165
+ $default_args = array();
166
+ foreach ( $this->_get_form_fields() as $field ) {
167
+ $default_args[$field['name']] = $field['default'];
168
+ }
169
+
170
+ $instance = wp_parse_args( (array) $instance, $default_args );
171
+
172
+ foreach ($this->_get_form_fields() as $field) {
173
+ if ($field['type'] == 'int') {
174
+ $value = intval($instance[$field['name']]);
175
+ } else {
176
+ $value = htmlspecialchars($instance[$field['name']]);
177
+ }
178
+
179
+ $template = '<p><label for="%s">%s:<input style="%s" id="%s" name="%s" type="text" value="%s" /></label></p>';
180
+
181
+ printf(
182
+ $template,
183
+ $this->get_field_name( $field['name'] ),
184
+ $field['title'],
185
+ 'width:100%',
186
+ $this->get_field_id( $field['name'] ),
187
+ $this->get_field_name( $field['name'] ),
188
+ $value
189
+ );
190
+ }
191
+ }
192
+
193
+ function is_valid_number_of_products($num) {
194
+ return is_numeric($num) && $num <= $this->max && $num >= $this->min;
195
+ }
196
+
197
+ protected function _get_form_fields()
198
+ {
199
+ return array(
200
+ array(
201
+ 'name' => 'title',
202
+ 'title' => __('Title'),
203
+ 'type' => 'text',
204
+ 'default' => $this->_title,
205
+ ),
206
+ array(
207
+ 'name' => 'number_of_products',
208
+ 'title' => __( 'Number of products to show', 'ecwid-shopping-cart' ),
209
+ 'type' => 'int',
210
+ 'default' => 3
211
+ )
212
+ );
213
+ }
214
+
215
+ }
includes/widgets/class-ecwid-widget-random-products.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ require_once __DIR__ . '/class-ecwid-widget-products-base.php';
5
+
6
+ class Ecwid_Widget_Random_Products extends Ecwid_Widget_Products_List_Base {
7
+
8
+ public function __construct() {
9
+ $this->_init(
10
+ __('Random Products', 'ecwid-shopping-cart'),
11
+ __('Displays a list of random products.', 'ecwid-shopping-cart')
12
+ );
13
+
14
+ parent::__construct();
15
+ }
16
+
17
+ protected function _get_products() {
18
+ $api = new Ecwid_Api_V3();
19
+
20
+ $sorts = array(
21
+ 'PRICE_ASC',
22
+ 'ADDED_TIME_ASC',
23
+ 'UPDATED_TIME_ASC',
24
+ 'NAME_ASC'
25
+ );
26
+
27
+ $total = EcwidPlatform::get_from_products_cache('ecwid_total_products');
28
+
29
+ $offset = 0;
30
+ if ($total > 0) {
31
+ $max = $total / 100;
32
+ $offset = rand(0, $max - 1) * 100;
33
+ }
34
+
35
+
36
+ $found = $api->search_products(array(
37
+ 'sortBy' => $sorts[rand(0, 3)],
38
+ 'offset' => $offset
39
+ ));
40
+
41
+ $items = $found->items;
42
+
43
+ $result = array();
44
+ for ($i = 0; $i < $this->_instance['number_of_products']; $i++) {
45
+
46
+ if (count($items) == 0) {
47
+ break;
48
+ }
49
+
50
+ $ind = rand(0, count($items) - 1);
51
+
52
+ $result[] = $items[$ind];
53
+ unset($items[$ind]);
54
+ $items = array_values($items);
55
+ }
56
+
57
+ return $result;
58
+ }
59
+ }
includes/widgets/class-ecwid-widget-recently-viewed.php CHANGED
@@ -1,13 +1,21 @@
1
  <?php
2
- class Ecwid_Widget_Recently_Viewed extends WP_Widget {
3
 
4
- var $max = 10;
5
- var $min = 1;
6
- var $default = 3;
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
- function __construct() {
9
- $widget_ops = array('classname' => 'widget_ecwid_recently_viewed', 'description' => __('Displays a list of products recently viewed by the customer to easily return to the products they saw in your shop.', 'ecwid-shopping-cart'));
10
- parent::__construct('ecwidrecentlyviewed', __('Recently Viewed Products', 'ecwid-shopping-cart'), $widget_ops);
11
  $recently_viewed = false;
12
  if (isset($_COOKIE['ecwid-shopping-cart-recently-viewed'])) {
13
  $recently_viewed = json_decode(stripslashes($_COOKIE['ecwid-shopping-cart-recently-viewed']));
@@ -16,31 +24,18 @@ class Ecwid_Widget_Recently_Viewed extends WP_Widget {
16
  if ($recently_viewed && $recently_viewed->store_id != get_ecwid_store_id() && !is_admin()) {
17
  setcookie('ecwid-shopping-cart-recently-viewed', null, strtotime('-1 day'));
18
  }
19
-
20
- add_action( 'wp_enqueue_scripts', array($this, 'enqueue' ) );
21
  }
22
-
23
- function enqueue() {
 
 
24
  if ( is_active_widget( false, false, $this->id_base ) ) {
25
- wp_enqueue_script('ecwid-recently-viewed-js', ECWID_PLUGIN_URL . 'js/recently-viewed.js', array('ecwid-products-list-js', 'utils'), get_option('ecwid_plugin_version'));
26
- wp_enqueue_style('ecwid-products-list-css');
27
- wp_enqueue_style('ecwid-recently-viewed-css', ECWID_PLUGIN_URL . 'css/recently-viewed.css', array(), get_option('ecwid_plugin_version'));
28
  }
29
  }
30
-
31
- function widget($args, $instance) {
32
-
33
- extract($args);
34
-
35
- $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title']);
36
-
37
- echo $before_widget;
38
-
39
- if ( $title )
40
- echo $before_title . $title . $after_title;
41
-
42
- echo '<!-- noptimize -->' . ecwid_get_scriptjs_code() . '<!-- /noptimize -->';
43
-
44
  $recently_viewed = false;
45
  if (isset($_COOKIE['ecwid-shopping-cart-recently-viewed'])) {
46
  $recently_viewed = json_decode($_COOKIE['ecwid-shopping-cart-recently-viewed']);
@@ -51,139 +46,60 @@ class Ecwid_Widget_Recently_Viewed extends WP_Widget {
51
  $recently_viewed = null;
52
  }
53
 
54
- echo '<div class="ecwid-recently-viewed-products" data-ecwid-max="' . $instance['number_of_products'] . '">';
55
-
56
- $counter = 1;
57
- $ids = array();
58
  if ($recently_viewed && isset($recently_viewed->products)) {
59
-
60
  $to_load = array();
61
-
62
- foreach( $recently_viewed->products as $product_data ) {
63
- $product = Ecwid_Product::get_without_loading( $product_data->id );
64
- if ( !@$product->imageUrl ) {
65
  $to_load[] = $product_data->id;
66
  }
67
  }
68
-
69
- if ( !empty( $to_load ) ) {
70
- Ecwid_Product::load_by_ids($to_load);
71
- }
72
-
73
- for ( $i = count($recently_viewed->products) - 1; $i >= 0; $i-- ) {
74
-
75
- if ( $counter > $instance['number_of_products'] ) {
76
- break;
77
- }
78
-
79
- $product = Ecwid_Product::get_by_id( $recently_viewed->products[$i]->id );
80
-
81
- if (!$product) {
82
- $product = Ecwid_Product::from_stdclass(
83
- $recently_viewed->products[$i]
84
- );
85
- }
86
-
87
- if (!$product->link)
88
-
89
- $counter++;
90
- if ( isset( $product->id ) && isset( $product->link ) ) {
91
- $ids[] = $product->id;
92
- $hide = $counter > $instance['number_of_products'] ? ' hidden' : '';
93
-
94
- $force_image = '';
95
- if ( isset( $product->imageUrl ) && strpos( $product->imageUrl, 'https://' ) == 0 ) {
96
- $force_image = $product->imageUrl;
97
- }
98
 
99
- $name = isset( $product->name ) ? $product->name : '';
100
-
101
- echo <<<HTML
102
- <a class="product$hide" href="$product->link" alt="$name" title="$name">
103
- <div class="ecwid ecwid-SingleProduct ecwid-Product ecwid-Product-$product->id" data-single-product-link="$product->link" itemscope itemtype="http://schema.org/Product" data-single-product-id="$product->id">
104
- <div itemprop="image" data-force-image="$force_image"></div>
105
- <div class="ecwid-title" itemprop="name"></div>
106
- <div itemtype="http://schema.org/Offer" itemscope itemprop="offers"><div class="ecwid-productBrowser-price ecwid-price" itemprop="price"></div></div>
107
- </div>
108
-
109
- <!-- noptimize --><script type="text/javascript">xSingleProduct();</script><!-- /noptimize -->
110
- </a>
111
- HTML;
112
- }
113
  }
114
  } else {
115
- echo <<<HTML
116
- <script type="text/javascript">
117
- jQuery(document).ready(function() {
118
- wpCookies.remove('ecwid-shopping-cart-recently-viewed');
119
- recently_viewed = {products: []};
120
- });
121
- </script>
122
- HTML;
123
- }
124
- $ids_string = '';
125
- if (!empty($ids)) {
126
- $ids_string = implode(',', $ids);
127
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
 
129
  echo <<<HTML
130
  <script type="text/javascript">
131
- <!--
132
  jQuery(document).ready(function() {
133
- jQuery('.ecwid-recently-viewed-products:not([data-rvp-initialized=1])').recentlyViewedProducts().attr('data-rvp-initialized', 1);
 
134
  });
135
- -->
136
  </script>
137
  HTML;
138
-
139
- echo "</div>";
140
-
141
- $store_link_message = empty($instance['store_link_title']) ? __('You have not viewed any product yet. Open store.', 'ecwid-shopping-cart') : $instance['store_link_title'];
142
-
143
- $page_id = Ecwid_Store_Page::get_current_store_page_id();
144
- $post = get_post($page_id);
145
-
146
- if (empty($recently_viewed->products)) {
147
- echo '<a class="show-if-empty" href="' . Ecwid_Store_Page::get_store_url() . '">' . $store_link_message . '</a>';
148
- }
149
-
150
- echo $after_widget;
151
  }
152
 
153
- function update($new_instance, $old_instance){
154
- $instance = $old_instance;
155
- $instance['title'] = strip_tags(stripslashes($new_instance['title']));
156
- $instance['store_link_title'] = strip_tags(stripslashes($new_instance['store_link_title']));
157
- $num = intval($new_instance['number_of_products']);
158
- if ($num > $this->max || $num < $this->min) {
159
- $num = $this->default;
160
- }
161
- $instance['number_of_products'] = intval($new_instance['number_of_products']);
162
-
163
- return $instance;
164
- }
165
-
166
- function form($instance){
167
-
168
- $instance = wp_parse_args( (array) $instance,
169
- array(
170
- 'title' => __('Recently Viewed Products', 'ecwid-shopping-cart'),
171
- 'store_link_title' => __('You have not viewed any product yet. Open store.', 'ecwid-shopping-cart'),
172
- 'number_of_products' => 3
173
- )
174
  );
175
-
176
- $title = htmlspecialchars($instance['title']);
177
- $store_link_title = htmlspecialchars($instance['store_link_title']);
178
- $number_of_products = $instance['number_of_products'];
179
- if ($number_of_products)
180
-
181
- echo '<p><label for="' . $this->get_field_name('title') . '">' . __('Title') . ': <input style="width:100%;" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . $title . '" /></label></p>';
182
- echo '<p><label for="' . $this->get_field_name('store_link_title') . '">' . __('Store Link Title', 'ecwid-shopping-cart') . ': <input style="width:100%;" id="' . $this->get_field_id('store_link_title') . '" name="' . $this->get_field_name('store_link_title') . '" type="text" value="' . $store_link_title . '" /></label></p>';
183
- echo '<p><label for="' . $this->get_field_name('number_of_products') . '">' . __( 'Number of products to show', 'ecwid-shopping-cart' ) . ': <input style="width:100%;" id="' . $this->get_field_id('number_of_products') . '" name="' . $this->get_field_name('number_of_products') . '" type="number" min="' . $this->min . '" max="' . $this->max . '" value="' . $number_of_products . '" /></label></p>';
184
- }
185
-
186
- function is_valid_number_of_products($num) {
187
- return is_numeric($num) && $num <= $this->max && $num >= $this->min;
188
  }
189
  }
1
  <?php
 
2
 
3
+ require_once __DIR__ . '/class-ecwid-widget-products-base.php';
4
+
5
+ class Ecwid_Widget_Recently_Viewed extends Ecwid_Widget_Products_List_Base {
6
+
7
+ protected $_widget_class = 'recentlyViewedProducts';
8
+
9
+ public function __construct() {
10
+ $this->_init(
11
+ __('Recently Viewed Products', 'ecwid-shopping-cart'),
12
+ __('Displays a list of products recently viewed by the customer to easily return to the products they saw in your shop.', 'ecwid-shopping-cart'),
13
+ 'ecwid_recently_viewed',
14
+ 'ecwid-recently-viewed-products'
15
+ );
16
+
17
+ parent::__construct();
18
 
 
 
 
19
  $recently_viewed = false;
20
  if (isset($_COOKIE['ecwid-shopping-cart-recently-viewed'])) {
21
  $recently_viewed = json_decode(stripslashes($_COOKIE['ecwid-shopping-cart-recently-viewed']));
24
  if ($recently_viewed && $recently_viewed->store_id != get_ecwid_store_id() && !is_admin()) {
25
  setcookie('ecwid-shopping-cart-recently-viewed', null, strtotime('-1 day'));
26
  }
 
 
27
  }
28
+
29
+ public function enqueue() {
30
+ parent::enqueue();
31
+
32
  if ( is_active_widget( false, false, $this->id_base ) ) {
33
+ wp_enqueue_script($this->_widget_name, ECWID_PLUGIN_URL . 'js/recently-viewed.js', array('ecwid-products-list-js', 'utils'), get_option('ecwid_plugin_version'));
34
+ wp_enqueue_style($this->_widget_name, ECWID_PLUGIN_URL . 'css/recently-viewed.css', array(), get_option('ecwid_plugin_version'));
 
35
  }
36
  }
37
+
38
+ protected function _get_products() {
 
 
 
 
 
 
 
 
 
 
 
 
39
  $recently_viewed = false;
40
  if (isset($_COOKIE['ecwid-shopping-cart-recently-viewed'])) {
41
  $recently_viewed = json_decode($_COOKIE['ecwid-shopping-cart-recently-viewed']);
46
  $recently_viewed = null;
47
  }
48
 
 
 
 
 
49
  if ($recently_viewed && isset($recently_viewed->products)) {
50
+
51
  $to_load = array();
52
+
53
+ foreach ($recently_viewed->products as $product_data) {
54
+ $product = Ecwid_Product::get_without_loading($product_data->id);
55
+ if (!@$product->imageUrl) {
56
  $to_load[] = $product_data->id;
57
  }
58
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
+ if (!empty($to_load)) {
61
+ Ecwid_Product::load_by_ids($to_load);
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
63
  } else {
64
+ return null;
 
 
 
 
 
 
 
 
 
 
 
65
  }
66
+
67
+ return array_reverse($recently_viewed->products);
68
+ }
69
+
70
+ protected function _print_widget_content()
71
+ {
72
+ parent::_print_widget_content();
73
+ $products = $this->_get_products();
74
+ }
75
+
76
+ protected function _print_no_products()
77
+ {
78
+ $store_link_message = empty($instance['store_link_title']) ? __('You have not viewed any product yet. Open store.', 'ecwid-shopping-cart') : $instance['store_link_title'];
79
+ echo '<a class="show-if-empty" href="' . Ecwid_Store_Page::get_store_url() . '">' . $store_link_message . '</a>';
80
 
81
  echo <<<HTML
82
  <script type="text/javascript">
 
83
  jQuery(document).ready(function() {
84
+ wpCookies.remove('ecwid-shopping-cart-recently-viewed');
85
+ recently_viewed = {products: []};
86
  });
 
87
  </script>
88
  HTML;
89
+
 
 
 
 
 
 
 
 
 
 
 
 
90
  }
91
 
92
+ protected function _get_form_fields()
93
+ {
94
+ $fields = parent::_get_form_fields();
95
+
96
+ $fields[] = array(
97
+ 'name' => 'store_link_title',
98
+ 'title' => __('Store Link Title', 'ecwid-shopping-cart'),
99
+ 'type' => 'text',
100
+ 'default' => __('You have not viewed any product yet. Open store.', 'ecwid-shopping-cart')
 
 
 
 
 
 
 
 
 
 
 
 
101
  );
102
+
103
+ return $fields;
 
 
 
 
 
 
 
 
 
 
 
104
  }
105
  }
js/admin.js CHANGED
@@ -126,8 +126,9 @@ jQuery(document).ready(function() {
126
  if (jQuery('div.update-nag').length > 0) {
127
  jQuery('#ecwid-frame').addClass('has-wp-message');
128
  }
 
129
  for (var i = 0; i < admin_pages.length; i++) {
130
- jQuery('li.toplevel_page_ec_store .wp-submenu a[href="' + admin_pages[i].url + '"]')
131
  .data('ecwid-menu', admin_pages[i])
132
  .click(function() {
133
  var ecwidMenu = jQuery(this).data('ecwid-menu');
126
  if (jQuery('div.update-nag').length > 0) {
127
  jQuery('#ecwid-frame').addClass('has-wp-message');
128
  }
129
+
130
  for (var i = 0; i < admin_pages.length; i++) {
131
+ jQuery('li.toplevel_page_ec-store .wp-submenu a[href$="' + admin_pages[i].url + '"]')
132
  .data('ecwid-menu', admin_pages[i])
133
  .click(function() {
134
  var ecwidMenu = jQuery(this).data('ecwid-menu');
js/frontend.js CHANGED
@@ -4,4 +4,8 @@ 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
  })
4
 
5
  jQuery(document).ready(function() {
6
  jQuery('.ecwid-store-with-categories a').click(function() {jQuery(':focus').blur()});
7
+
8
+ jQuery('a[data-ecwid-page]').click(function() {
9
+
10
+ });
11
  })
js/product.js CHANGED
@@ -11,7 +11,9 @@ jQuery(document).ready(function() {
11
  if ($canonical.length == 0) {
12
  $canonical = jQuery('<link rel="canonical">').appendTo('head');
13
  }
14
- $canonical.attr('href', result);
 
 
15
  }
16
  );
17
  }
11
  if ($canonical.length == 0) {
12
  $canonical = jQuery('<link rel="canonical">').appendTo('head');
13
  }
14
+ if (result) {
15
+ $canonical.attr('href', result);
16
+ }
17
  }
18
  );
19
  }
js/products-list.js CHANGED
@@ -8,7 +8,8 @@ jQuery.widget('ecwid.productsList', {
8
  this.sort = [];
9
  this.options = {
10
  max: 3,
11
- debug: false
 
12
  };
13
 
14
 
@@ -29,8 +30,10 @@ jQuery.widget('ecwid.productsList', {
29
  , 200)
30
  );
31
 
32
- this.ajax_url = wp_ecwid_products_list_vars.ajax_url;
33
- this.is_api_available = wp_ecwid_products_list_vars.is_api_available;
 
 
34
  },
35
 
36
  _render: function() {
@@ -75,10 +78,15 @@ jQuery.widget('ecwid.productsList', {
75
 
76
  this._fillProductElement(product);
77
 
78
- this._getProductElement(product.id)
79
  .addClass('show')
80
- .removeClass('hide')
81
- .prependTo(this.container);
 
 
 
 
 
82
  },
83
 
84
  _hideProduct: function(product) {
8
  this.sort = [];
9
  this.options = {
10
  max: 3,
11
+ debug: false,
12
+ prependNew: false
13
  };
14
 
15
 
30
  , 200)
31
  );
32
 
33
+ if (typeof wp_ecwid_products_list_vars != 'undefined') {
34
+ this.ajax_url = wp_ecwid_products_list_vars.ajax_url;
35
+ this.is_api_available = wp_ecwid_products_list_vars.is_api_available;
36
+ }
37
  },
38
 
39
  _render: function() {
78
 
79
  this._fillProductElement(product);
80
 
81
+ var el = this._getProductElement(product.id)
82
  .addClass('show')
83
+ .removeClass('hide');
84
+
85
+ if (this.options.prependNew) {
86
+ el.prependTo(this.container);
87
+ } else {
88
+ el.appendTo(this.container);
89
+ }
90
  },
91
 
92
  _hideProduct: function(product) {
js/recently-viewed.js CHANGED
@@ -8,6 +8,7 @@ jQuery.widget('ecwid.recentlyViewedProducts', jQuery.ecwid.productsList, {
8
 
9
  _create: function() {
10
  this._superApply(arguments);
 
11
 
12
  if (typeof Ecwid == 'undefined') return;
13
 
8
 
9
  _create: function() {
10
  this._superApply(arguments);
11
+ this.options.prependNew = true;
12
 
13
  if (typeof Ecwid == 'undefined') return;
14
 
js/store-editor-page.js CHANGED
@@ -144,7 +144,7 @@ jQuery(document).ready(function() {
144
  }
145
  button.css({
146
  'position': 'absolute',
147
- 'top': '' + (store.offset().top + 168) + 'px',
148
  'left': '' + (store.offset().left + store.outerWidth() / 2 - width / 2 - 2) + 'px'
149
  });
150
  }
@@ -237,6 +237,23 @@ jQuery(document).ready(function() {
237
  shortcode = existingShortcode;
238
  }
239
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
  for (var i in result) {
241
  shortcode.shortcode.attrs.named[i] = result[i];
242
  }
144
  }
145
  button.css({
146
  'position': 'absolute',
147
+ 'top': '' + (store.offset().top + 153) + 'px',
148
  'left': '' + (store.offset().left + store.outerWidth() / 2 - width / 2 - 2) + 'px'
149
  });
150
  }
237
  shortcode = existingShortcode;
238
  }
239
 
240
+
241
+ if (!ecwid_params.legacy_appearance) {
242
+
243
+ var legacy_appearance_properties = [
244
+ 'categories_per_row',
245
+ 'grid',
246
+ 'list',
247
+ 'table',
248
+ 'category_view',
249
+ 'search_view'
250
+ ];
251
+ for (var i = 0; i < legacy_appearance_properties.length; i++) {
252
+ delete result[legacy_appearance_properties[i]];
253
+ delete shortcode.shortcode.attrs.named[legacy_appearance_properties[i]];
254
+ }
255
+ }
256
+
257
  for (var i in result) {
258
  shortcode.shortcode.attrs.named[i] = result[i];
259
  }
languages/ecwid-shopping-cart-ru_RU.mo CHANGED
Binary file
languages/ecwid-shopping-cart-ru_RU.po CHANGED
@@ -1657,6 +1657,12 @@ msgstr "Случайный товар"
1657
  msgid "Displays a random product from your store to attract customer attention."
1658
  msgstr "Показывает случайный товар из магазина, чтобы привлечь внимание покупателя."
1659
 
 
 
 
 
 
 
1660
  #. Plugin Name of the plugin/theme
1661
  msgid "Ecwid Shopping Cart"
1662
  msgstr "Интернет-магазин Эквид"
1657
  msgid "Displays a random product from your store to attract customer attention."
1658
  msgstr "Показывает случайный товар из магазина, чтобы привлечь внимание покупателя."
1659
 
1660
+ msgid "Latest Products"
1661
+ msgstr "Новые товары"
1662
+
1663
+ msgid "Displays the latest added products from your store. Show new products to returning customers to drive repeat sales."
1664
+ msgstr "Список последних добавленных товаров из магазина."
1665
+
1666
  #. Plugin Name of the plugin/theme
1667
  msgid "Ecwid Shopping Cart"
1668
  msgstr "Интернет-магазин Эквид"
lib/ecwid_catalog_entry.php CHANGED
@@ -47,19 +47,25 @@ abstract class Ecwid_Catalog_Entry {
47
 
48
  public function get_link( $baseUrl = false )
49
  {
 
 
 
 
50
  if ( Ecwid_Seo_Links::is_enabled() ) {
51
  return $this->get_seo_link( $baseUrl );
52
  } else {
53
- if ( $this->_data->name && $this->_data->id ) {
54
- if ( !$baseUrl ) {
55
- $baseUrl = Ecwid_Store_Page::get_store_url();
56
- }
57
- $url = $baseUrl;
 
 
 
58
 
59
- $url .= '#!/' . urlencode( $this->_data->name ) . '/' . $this->_link_prefix . '/' . $this->_data->id;
60
 
61
- return $url;
62
- }
63
  }
64
 
65
  return false;
@@ -81,7 +87,7 @@ abstract class Ecwid_Catalog_Entry {
81
  $url .= '/';
82
  }
83
 
84
- $url .= urlencode( $this->_data->name ) . '-' . $this->_link_prefix . $this->_data->id;
85
 
86
  return $url;
87
  }
@@ -92,4 +98,14 @@ abstract class Ecwid_Catalog_Entry {
92
  protected function _get_cache_key_by_id( $id ) {
93
  return $this->_cache_name_prefix . $id;
94
  }
 
 
 
 
 
 
 
 
 
 
95
  }
47
 
48
  public function get_link( $baseUrl = false )
49
  {
50
+ if ( !isset( $this->_data->id ) ) {
51
+ return false;
52
+ }
53
+
54
  if ( Ecwid_Seo_Links::is_enabled() ) {
55
  return $this->get_seo_link( $baseUrl );
56
  } else {
57
+ if ( !$baseUrl ) {
58
+ $baseUrl = Ecwid_Store_Page::get_store_url();
59
+ }
60
+ $url = $baseUrl . '#!/';
61
+
62
+ if ( isset( $this->_data->name ) ) {
63
+ $url .= $this->_linkify( $this->_data->name ) . '/';
64
+ }
65
 
66
+ $url .= $this->_link_prefix . '/' . $this->_data->id;
67
 
68
+ return $url;
 
69
  }
70
 
71
  return false;
87
  $url .= '/';
88
  }
89
 
90
+ $url .= $this->_linkify( $this->_data->name ) . '-' . $this->_link_prefix . $this->_data->id;
91
 
92
  return $url;
93
  }
98
  protected function _get_cache_key_by_id( $id ) {
99
  return $this->_cache_name_prefix . $id;
100
  }
101
+
102
+ protected function _linkify( $str ) {
103
+ $match = array();
104
+ $result = preg_match_all('#[\p{L}0-9\-_]+#u', $str, $match);
105
+
106
+ if ( $result && count( @$match[0] ) > 0 )
107
+ return implode('-', $match[0] );
108
+
109
+ return urlencode($str);
110
+ }
111
  }
lib/ecwid_platform.php CHANGED
@@ -99,7 +99,7 @@ class EcwidPlatform {
99
  )
100
  );
101
 
102
- $use_file_get_contents = get_option('ecwid_fetch_url_use_file_get_contents', false);
103
 
104
  if ($use_file_get_contents) {
105
  $result = @file_get_contents($url, null, $ctx);
@@ -121,7 +121,7 @@ class EcwidPlatform {
121
  if (!is_array($result)) {
122
  $result = @file_get_contents($url, null, $ctx);
123
  if (!empty($result)) {
124
- update_option('ecwid_fetch_url_use_file_get_contents', true);
125
  }
126
  }
127
  }
@@ -298,7 +298,7 @@ class EcwidPlatform {
298
  $cache_name = self::_build_cache_name( $key, 'products' );
299
 
300
  $result = self::cache_get( $cache_name );
301
-
302
  if ( $result['time'] > EcwidPlatform::get( self::PRODUCTS_CACHE_VALID_FROM ) ) {
303
  return $result['data'];
304
  }
99
  )
100
  );
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);
121
  if (!is_array($result)) {
122
  $result = @file_get_contents($url, null, $ctx);
123
  if (!empty($result)) {
124
+ EcwidPlatform::cache_set('ecwid_fetch_url_use_file_get_contents', true, DAY_IN_SECONDS );
125
  }
126
  }
127
  }
298
  $cache_name = self::_build_cache_name( $key, 'products' );
299
 
300
  $result = self::cache_get( $cache_name );
301
+
302
  if ( $result['time'] > EcwidPlatform::get( self::PRODUCTS_CACHE_VALID_FROM ) ) {
303
  return $result['data'];
304
  }
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.5
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,14 @@ 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.5 =
153
  - **New random product widget.** A new sidebar widget allows you add a random product block to the site sidebar. Each time your customer opens or refreshes a page on your site, they will see one of your store products in the sidebar. Enable the new random product widget under Appearance→Widgets section in your Wordpress admin backend. Do not forget to add pictures to your products to bring site visitors’ attention to your store.
154
  - Minor fixes and improvements.
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.6
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.6 — Sep 27, 2017 =
153
+ - **Added a new sidebar widget — "Latest Products"!** Add this widget to your sidebar to let your customers know what's new in your online store. You will find the widget under Appearance -> Widgets section in your Wordpress admin backend.
154
+ - **Added SEO optimization for single product widgets.** Now, single product widgets will include SEO-friendly markup for product's title/price/availability data to let the search engines better index the page content. You can add single product widgets to your site pages using the "Add Product" button in the Wordpress page editor.
155
+ - **Slightly optimized loading speed.** The Ecwid Online Store plugin now loads less CSS/JS files on your site to decrease number of resources the visitor browser should process and to increase loading speed.
156
+ - **Fixed an issue with SEO friendly clean URLs.** On some sites in rare occasions, product URLs responded with 404 errors. If you encounter such behavior on your site, this update should fix that. All shop URLs should work fine now — they are available for visitors and are well indexed by search engines.
157
+ - **Various minor fixes and improvements** in random product widget, SEO functionality, store dashboard and other areas.
158
+ - Ecwid 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
159
+
160
  = 5.5 =
161
  - **New random product widget.** A new sidebar widget allows you add a random product block to the site sidebar. Each time your customer opens or refreshes a page on your site, they will see one of your store products in the sidebar. Enable the new random product widget under Appearance→Widgets section in your Wordpress admin backend. Do not forget to add pictures to your products to bring site visitors’ attention to your store.
162
  - Minor fixes and improvements.
templates/store-popup.php CHANGED
@@ -10,8 +10,10 @@
10
  <div class="media-menu">
11
  <a href="#" class="media-menu-item" data-content="add-store"><?php _e('Add Store', 'ecwid-shopping-cart'); ?></a>
12
  <a href="#" class="media-menu-item" data-content="store-settings"><?php _e('Store elements', 'ecwid-shopping-cart'); ?></a>
13
- <a href="#" class="media-menu-item" data-content="appearance"><?php _e('Appearance', 'ecwid-shopping-cart'); ?></a>
14
- </div>
 
 
15
  </div>
16
 
17
  <div class="media-frame-title add-store">
@@ -26,11 +28,13 @@
26
  </h1>
27
  </div>
28
 
 
29
  <div class="media-frame-title appearance">
30
  <h1>
31
  <?php _e('Appearance', 'ecwid-shopping-cart'); ?><span class="dashicons dashicons-arrow-down"></span>
32
  </h1>
33
  </div>
 
34
 
35
  <div class="media-frame-content ecwid-store-editor store-settings">
36
 
@@ -66,18 +70,49 @@
66
  <?php _e('Show categories', 'ecwid-shopping-cart'); ?>
67
  </label>
68
  </div>
69
- </div>
70
- <div class="note">
71
- <?php echo sprintf(
72
  __('Additionally, you can add store controls to your website\'s toolbar using <a %s>WordPress native widgets</a>', 'ecwid-shopping-cart'),
73
  ' target="_blank" href="widgets.php?from-ec-store=' . (isset($_GET['post']) ? $_GET['post'] : 'new') . '"'
74
  );
75
- ?>
76
- </div>
77
- </div>
 
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  </div>
80
 
 
81
  <div class="media-frame-content ecwid-store-editor appearance">
82
 
83
  <div class="pure-control-group pb-views">
@@ -146,35 +181,7 @@
146
  </div>
147
 
148
  <hr class="after-pb" />
149
-
150
- <div class="pure-control-group params-list default-category-id">
151
-
152
- <?php if ($categories): ?>
153
- <label for="ecwid_default_category_id">
154
- <?php _e('Category shown by default', 'ecwid-shopping-cart'); ?>
155
- </label>
156
-
157
-
158
- <div class="value">
159
-
160
- <select name="default_category_id" id="ecwid_default_category_id">
161
- <option value=""><?php _e('Store root category', 'ecwid-shopping-cart'); ?></option>
162
- <?php foreach ($categories as $category): ?>
163
- <option
164
- value="<?php echo esc_attr($category->id); ?>"
165
- <?php if ($category->id == get_option('ecwid_default_category_id')): ?>
166
- selected="selected"
167
- <?php endif; ?>
168
- >
169
- <?php echo esc_html($category->path); ?>
170
- </option>
171
- <?php endforeach; ?>
172
- </select>
173
- </div>
174
-
175
- <?php endif; ?>
176
- </div>
177
-
178
  <div class="pure-control-group params-list">
179
  <label for="ecwid_pb_categoriesperrow">
180
  <?php _e('Number of categories per row', 'ecwid-shopping-cart'); ?>
@@ -224,6 +231,8 @@
224
  </div>
225
  </div>
226
 
 
 
227
  <div class="media-frame-toolbar">
228
  <div class="media-toolbar">
229
  <div class="media-toolbar-secondary">
10
  <div class="media-menu">
11
  <a href="#" class="media-menu-item" data-content="add-store"><?php _e('Add Store', 'ecwid-shopping-cart'); ?></a>
12
  <a href="#" class="media-menu-item" data-content="store-settings"><?php _e('Store elements', 'ecwid-shopping-cart'); ?></a>
13
+ <?php if (ecwid_is_legacy_appearance_used()): ?>
14
+ <a href="#" class="media-menu-item" data-content="appearance"><?php _e('Appearance', 'ecwid-shopping-cart'); ?></a>
15
+ <?php endif; ?>
16
+ </div>
17
  </div>
18
 
19
  <div class="media-frame-title add-store">
28
  </h1>
29
  </div>
30
 
31
+ <?php if (ecwid_is_legacy_appearance_used()): ?>
32
  <div class="media-frame-title appearance">
33
  <h1>
34
  <?php _e('Appearance', 'ecwid-shopping-cart'); ?><span class="dashicons dashicons-arrow-down"></span>
35
  </h1>
36
  </div>
37
+ <?php endif; ?>
38
 
39
  <div class="media-frame-content ecwid-store-editor store-settings">
40
 
70
  <?php _e('Show categories', 'ecwid-shopping-cart'); ?>
71
  </label>
72
  </div>
73
+
74
+ <div class="note">
75
+ <?php echo sprintf(
76
  __('Additionally, you can add store controls to your website\'s toolbar using <a %s>WordPress native widgets</a>', 'ecwid-shopping-cart'),
77
  ' target="_blank" href="widgets.php?from-ec-store=' . (isset($_GET['post']) ? $_GET['post'] : 'new') . '"'
78
  );
79
+ ?>
80
+ </div>
81
+
82
+ <div class="pure-control-group params-list default-category-id">
83
 
84
+ <?php if ($categories): ?>
85
+ <label for="ecwid_default_category_id">
86
+ <?php _e('Category shown by default', 'ecwid-shopping-cart'); ?>
87
+ </label>
88
+
89
+
90
+ <div class="value">
91
+
92
+ <select name="default_category_id" id="ecwid_default_category_id">
93
+ <option value="0"<?php if (!get_option('ecwid_default_category_id')): ?> selected="selected"<?php endif; ?>>
94
+ <?php _e('Store root category', 'ecwid-shopping-cart'); ?>
95
+ </option>
96
+ <?php foreach ($categories as $category): ?>
97
+ <option
98
+ value="<?php echo esc_attr($category->id); ?>"
99
+ <?php if ($category->id == get_option('ecwid_default_category_id')): ?>
100
+ selected="selected"
101
+ <?php endif; ?>
102
+ >
103
+ <?php echo esc_html($category->path); ?>
104
+ </option>
105
+ <?php endforeach; ?>
106
+ </select>
107
+ </div>
108
+
109
+ <?php endif; ?>
110
+ </div>
111
+ </div>
112
+ </div>
113
  </div>
114
 
115
+ <?php if (ecwid_is_legacy_appearance_used()): ?>
116
  <div class="media-frame-content ecwid-store-editor appearance">
117
 
118
  <div class="pure-control-group pb-views">
181
  </div>
182
 
183
  <hr class="after-pb" />
184
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  <div class="pure-control-group params-list">
186
  <label for="ecwid_pb_categoriesperrow">
187
  <?php _e('Number of categories per row', 'ecwid-shopping-cart'); ?>
231
  </div>
232
  </div>
233
 
234
+ <?php endif; ?>
235
+
236
  <div class="media-frame-toolbar">
237
  <div class="media-toolbar">
238
  <div class="media-toolbar-secondary">
templates/store-svg.php CHANGED
@@ -7,8 +7,8 @@
7
  <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
8
  viewBox="0 0 500 220" enable-background="new 0 0 500 220" xml:space="preserve">
9
 
10
- <text x="245" y="115" text-anchor="middle" fill="#050303" font-family="Open Sans,Helvetica Neue,sans-serif" font-size="20"><?php _e('Your store will be shown here!', 'ecwid-shopping-cart'); ?></text>
11
- <text x="245" y="137" text-anchor="middle" fill="#999999" font-family="Open Sans,Helvetica Neue,sans-serif" font-size="14">
12
  <?php if (get_ecwid_store_id() == ECWID_DEMO_STORE_ID): ?>
13
  <?php _e('Demo Store', 'ecwid-shopping-cart'); ?>
14
  <?php else: ?>
@@ -16,7 +16,7 @@
16
  <?php endif; ?>
17
  </text>
18
 
19
- <g>
20
  <path fill="#77B644" d="M225.7,82.3c0-0.4,0.3-0.8,0.8-0.8h41.1c0.4,0,0.8,0.3,0.8,0.8v1.6c0,0.4-0.3,0.8-0.8,0.8h-41.1
21
  c-0.4,0-0.8-0.3-0.8-0.8V82.3z"/>
22
  <path fill="#77B644" d="M268.4,56.6c-1.6-3.3-2.4-6.5-3.3-11.9c0-0.3-0.7-1.3-1.6-1.3h-33c-0.9,0-1.6,1-1.6,1.3
7
  <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
8
  viewBox="0 0 500 220" enable-background="new 0 0 500 220" xml:space="preserve">
9
 
10
+ <text x="245" y="93" text-anchor="middle" fill="#050303" font-family="Open Sans,Helvetica Neue,sans-serif" font-size="20"><?php _e('Your store will be shown here!', 'ecwid-shopping-cart'); ?></text>
11
+ <text x="245" y="115" text-anchor="middle" fill="#999999" font-family="Open Sans,Helvetica Neue,sans-serif" font-size="14">
12
  <?php if (get_ecwid_store_id() == ECWID_DEMO_STORE_ID): ?>
13
  <?php _e('Demo Store', 'ecwid-shopping-cart'); ?>
14
  <?php else: ?>
16
  <?php endif; ?>
17
  </text>
18
 
19
+ <g transform="translate(0,-30)">
20
  <path fill="#77B644" d="M225.7,82.3c0-0.4,0.3-0.8,0.8-0.8h41.1c0.4,0,0.8,0.3,0.8,0.8v1.6c0,0.4-0.3,0.8-0.8,0.8h-41.1
21
  c-0.4,0-0.8-0.3-0.8-0.8V82.3z"/>
22
  <path fill="#77B644" d="M268.4,56.6c-1.6-3.3-2.4-6.5-3.3-11.9c0-0.3-0.7-1.3-1.6-1.3h-33c-0.9,0-1.6,1-1.6,1.3