Ecwid Ecommerce Shopping Cart - Version 5.0

Version Description

  • SEO friendly clean URLs. This is major new feature that we recommend everyone to enable. We made store pages URLs clean and SEO friendly. The new URLs do not contain hash sign ("#"), which makes your store better indexed by Google. There are less extra characters like '/', '~' or'!', so the page address looks cleaner. As previously, the new product and category pages URLs include product/category titles to make them easily readable both for Google and for your customers. Of course, no page refresh happens when the customer browses your store: the store pages with new URLs work without page reload, as it's been always worked in Ecwid. So, you have your quickly loading store pages with new SEO friendly URLs. To enable the new URLs, navigate to the Ecwid plugin Advanced settings and tick the "SEO friendly URLs" checkbox. Note: the old URLs format is supported as well, so all your existing links will continue to work fine.

  • An improvement for the floating cart sidebar widget. Now, when you add the widget to any sidebar, the widget will displayed on every site page regardless of whether the sidebar is available on that page or not. This makes it easier for your customer to access their shopping cart and check out.

  • A few fixes for the integrated search. Recently we added a new feature that integrates your site search with your store products to list them when your customers use the site's general post/page search. We continue improving it and fixing issues you are reporting. Thank you!

  • A few improvements and fixes for the "Add product" button in the WordPress editor to make it easier for your to add your store products to your site pages.

Download this release

Release Info

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

Code changes from version 4.9.4 to 5.0

css/themes/skt-design-agency-pro.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ html#ecwid_html body#ecwid_body .header {
2
+ z-index: 9999;
3
+ }
css/themes/uncode.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .ecwid-shopping-cart input[type=checkbox]:checked:before, .ecwid-shopping-cart input[type=radio]:checked:before {
2
+ position: initial;
3
+ }
ecwid-shopping-cart.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.ecwid.com?source=wporg
5
  Description: Ecwid is a free full-featured shopping cart. It can be easily integrated with any Wordpress blog and takes less than 5 minutes to set up.
6
  Text Domain: ecwid-shopping-cart
7
  Author: Ecwid Team
8
- Version: 4.9.4
9
  Author URI: http://www.ecwid.com?source=wporg
10
  */
11
 
@@ -88,7 +88,7 @@ if ( is_admin() ){
88
  add_action('wp_head', 'ecwid_meta');
89
  add_action('wp_head', 'ecwid_canonical');
90
  add_action('wp_head', 'ecwid_seo_compatibility_restore', 1000);
91
- add_action('wp_head', 'ecwid_add_chameleon');
92
  add_action('wp_head', 'ecwid_product_browser_url_in_head');
93
  add_filter( 'widget_meta_poweredby', 'ecwid_add_credits');
94
  add_filter('the_content', 'ecwid_content_started', 0);
@@ -119,6 +119,9 @@ if (is_admin()) {
119
  }
120
 
121
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-nav-menus.php';
 
 
 
122
 
123
  require_once ECWID_PLUGIN_DIR . 'lib/ecwid_platform.php';
124
  require_once ECWID_PLUGIN_DIR . 'lib/ecwid_api_v3.php';
@@ -268,9 +271,23 @@ HTML;
268
  add_action('wp_ajax_ecwid_get_product_info', 'ecwid_ajax_get_product_info' );
269
  add_action('wp_ajax_nopriv_ecwid_get_product_info', 'ecwid_ajax_get_product_info' );
270
 
 
 
 
 
 
 
 
 
 
 
 
271
 
272
  function ecwid_enqueue_frontend() {
273
 
 
 
 
274
  if (!wp_script_is('jquery-ui-widget')) {
275
  wp_enqueue_script('jquery-ui-widget', includes_url() . 'js/jquery/ui/widget.min.js', array('jquery'));
276
  }
@@ -284,14 +301,14 @@ function ecwid_enqueue_frontend() {
284
 
285
  wp_enqueue_script( 'ecwid-frontend-js', ECWID_PLUGIN_URL . 'js/frontend.js', array( 'jquery' ), get_option( 'ecwid_plugin_version' ) );
286
 
287
- if ( get_post()->post_type == Ecwid_Products::POST_TYPE_PRODUCT ) {
288
  wp_enqueue_script( 'ecwid-post-product', ECWID_PLUGIN_URL . 'js/post-product.js', array(), get_option( 'ecwid_plugin_version' ), TRUE );
289
 
290
  $meta = get_post_meta(get_the_ID(), 'ecwid_id');
291
 
292
  wp_localize_script( 'ecwid-post-product', 'ecwidPost', array(
293
  'productId' => $meta[0],
294
- 'storePageUrl' => ecwid_get_store_page_url()
295
  ) );
296
  }
297
 
@@ -313,6 +330,20 @@ function ecwid_enqueue_frontend() {
313
  }
314
  }
315
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
316
  function ecwid_add_chameleon() {
317
  if (!get_option('ecwid_use_chameleon')) {
318
  return;
@@ -351,15 +382,11 @@ function ecwid_add_chameleon() {
351
  $chameleon['font'] = $font;
352
  }
353
 
354
- echo <<<HTML
355
- <script type="text/javascript">
356
- window.ec = window.ec || Object();
357
- window.ec.config = window.ec.config || Object();
358
- window.ec.config.chameleon = window.ec.config.chameleon || Object();
359
  window.ec.config.chameleon.font = $chameleon[font];
360
  window.ec.config.chameleon.colors = $chameleon[colors];
361
  </script>
362
- HTML;
363
 
364
  }
365
 
@@ -417,6 +444,8 @@ function ecwid_503_on_store_closed() {
417
  }
418
 
419
  function ecwid_backward_compatibility() {
 
 
420
  // Backward compatibility with 1.1.2 and earlier
421
  if (isset($_GET['ecwid_product_id']) || isset($_GET['ecwid_category_id'])) {
422
 
@@ -434,12 +463,12 @@ function ecwid_build_sitemap($callback)
434
  {
435
  if (!ecwid_is_paid_account() || !ecwid_is_store_page_available()) return;
436
 
437
- $page_id = ecwid_get_current_store_page_id();
438
 
439
  if (get_post_status($page_id) == 'publish') {
440
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-sitemap-builder.php';
441
 
442
- $sitemap = new EcwidSitemapBuilder(ecwid_get_store_page_url(), $callback, ecwid_new_product_api());
443
 
444
  $sitemap->generate();
445
  }
@@ -512,6 +541,9 @@ function ecwid_check_version()
512
  }
513
 
514
  if ($fresh_install || $upgrade || @$_GET['ecwid_reinit']) {
 
 
 
515
  if (ecwid_migrations_is_original_plugin_version_older_than('4.3')) {
516
  add_option('ecwid_fetch_url_use_file_get_contents', '');
517
  add_option('ecwid_remote_get_timeout', '5');
@@ -525,14 +557,23 @@ function ecwid_check_version()
525
  add_option('ecwid_enable_sso');
526
  }
527
 
 
 
 
 
 
 
528
 
529
  add_option( Ecwid_Products::OPTION_ENABLED, Ecwid_Products::is_enabled() );
530
 
531
- add_option('ecwid_chameleon_colors_foreground', '');
532
  add_option('ecwid_chameleon_colors_background', '');
533
  add_option('ecwid_chameleon_colors_link', '');
534
  add_option('ecwid_chameleon_colors_button', '');
535
  add_option('ecwid_chameleon_colors_price', '');
 
 
 
536
 
537
  update_option('ecwid_use_new_search', 'Y');
538
  }
@@ -697,7 +738,7 @@ function add_ecwid_admin_bar_node() {
697
  return;
698
 
699
  $theme = ecwid_get_theme_name();
700
- $store_url = ecwid_get_store_page_url();
701
 
702
 
703
  if (!is_admin()) {
@@ -745,7 +786,7 @@ TEXT;
745
  "id" => "ecwid-go-to-page",
746
  "title" => __("Visit storefront", 'ecwid-shopping-cart'),
747
  "parent" => "ecwid-main",
748
- 'href' => ecwid_get_store_page_url()
749
  )
750
  );
751
 
@@ -836,7 +877,7 @@ function ecwid_meta() {
836
  echo '<link rel="dns-prefetch" href="//app.ecwid.com/">' . PHP_EOL;
837
 
838
  if (!ecwid_page_has_productbrowser() && ecwid_is_store_page_available()) {
839
- $page_url = ecwid_get_store_page_url();
840
  echo '<link rel="prefetch" href="' . $page_url . '" />' . PHP_EOL;
841
  echo '<link rel="prerender" href="' . $page_url . '" />' . PHP_EOL;
842
  }
@@ -1099,6 +1140,10 @@ function ecwid_get_scriptjs_code($force_lang = null) {
1099
  if ( Ecwid_Products::is_enabled() ) {
1100
  $params .= '&data_sync_products=1';
1101
  }
 
 
 
 
1102
  $s = '<script data-cfasync="false" type="text/javascript" src="https://' . APP_ECWID_COM . '/script.js?' . $store_id . $params . '"></script>';
1103
  $s = $s . ecwid_sso();
1104
  $s .= '<script type="text/javascript">if (jQuery && jQuery.mobile) { jQuery.mobile.hashListeningEnabled = false; jQuery.mobile.pushStateEnabled=false; }</script>';
@@ -1503,7 +1548,7 @@ function ecwid_is_old_cats_widget_used()
1503
  return true;
1504
  }
1505
 
1506
- $post = get_post(ecwid_get_current_store_page_id());
1507
  if ($post && !is_wp_error($post)) {
1508
  $shortcodes = ecwid_find_shortcodes( $post->post_content, 'ecwid_categories');
1509
 
@@ -1518,7 +1563,7 @@ function ecwid_get_store_shortcode_widgets()
1518
  {
1519
  if (get_option('ecwid_use_new_horizontal_categories')) return false;
1520
 
1521
- $page_contents = get_post(ecwid_get_current_store_page_id())->post_content;
1522
  $shortcodes = ecwid_find_shortcodes($page_contents, 'ecwid');
1523
  if (!$shortcodes) {
1524
  return null;
@@ -1752,6 +1797,7 @@ function ecwid_settings_api_init() {
1752
  register_setting( 'ecwid_options_page', 'ecwid_use_chameleon' );
1753
  register_setting( 'ecwid_options_page', 'ecwid_use_new_horizontal_categories' );
1754
  register_setting( 'ecwid_options_page', 'ecwid_is_sso_enabled' );
 
1755
  break;
1756
  }
1757
 
@@ -1761,6 +1807,13 @@ function ecwid_settings_api_init() {
1761
  Ecwid_Products::disable();
1762
  }
1763
 
 
 
 
 
 
 
 
1764
  if ($_POST['settings_section'] == 'advanced' && !@$_POST['ecwid_is_sso_enabled']) {
1765
  update_option('ecwid_sso_secret_key', '');
1766
  }
@@ -2138,6 +2191,23 @@ function ecwid_get_categories_for_selector() {
2138
  return $result;
2139
  }
2140
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2141
  function ecwid_advanced_settings_do_page() {
2142
  $categories = ecwid_get_categories_for_selector();
2143
 
@@ -2383,6 +2453,7 @@ function ecwid_add_dashboard_widgets() {
2383
 
2384
  function ecwid_save_post($post_id)
2385
  {
 
2386
  // If primary or auto store page gets updated
2387
  if ($post_id == get_option('ecwid_store_page_id') || $post_id == get_option('ecwid_store_page_id_auto')) {
2388
  $new_status = get_post_status($post_id);
@@ -2403,32 +2474,16 @@ function ecwid_save_post($post_id)
2403
  }
2404
 
2405
  // if there is no current store page and this new page has a product browser
2406
- if (ecwid_page_has_productbrowser($post_id) && !ecwid_get_current_store_page_id()) {
2407
  // then this page becomes a new store page
2408
  update_option('ecwid_store_page_id_auto', $post_id);
2409
  }
2410
  }
2411
 
2412
- function ecwid_get_current_store_page_id()
2413
- {
2414
- static $page_id = null;
2415
-
2416
- if (is_null($page_id)) {
2417
- $page_id = false;
2418
- foreach(array('ecwid_store_page_id', 'ecwid_store_page_id_auto') as $option) {
2419
- $id = get_option($option);
2420
- if ($id) {
2421
- $status = get_post_status($id);
2422
-
2423
- if ($status == 'publish' || $status == 'private') {
2424
- $page_id = $id;
2425
- break;
2426
- }
2427
- }
2428
- }
2429
- }
2430
 
2431
- return $page_id;
 
2432
  }
2433
 
2434
  function ecwid_get_store_page_url()
@@ -2436,7 +2491,7 @@ function ecwid_get_store_page_url()
2436
  static $link = null;
2437
 
2438
  if (is_null($link)) {
2439
- $link = get_page_link(ecwid_get_current_store_page_id());
2440
  }
2441
 
2442
  return $link;
@@ -2444,7 +2499,7 @@ function ecwid_get_store_page_url()
2444
 
2445
  function ecwid_is_store_page_available()
2446
  {
2447
- return ecwid_get_current_store_page_id() != false;
2448
  }
2449
 
2450
  function ecwid_get_product_url($product)
@@ -2459,7 +2514,7 @@ function ecwid_get_category_url($category)
2459
 
2460
  function ecwid_get_entity_url($entity, $type) {
2461
 
2462
- $link = ecwid_get_store_page_url();
2463
 
2464
  if (is_numeric($entity)) {
2465
  return $link . '#!/' . $type . '/' . $entity;
@@ -2473,9 +2528,14 @@ function ecwid_get_entity_url($entity, $type) {
2473
 
2474
  function ecwid_get_product_browser_url_script()
2475
  {
 
 
 
 
2476
  $str = '';
2477
  if (ecwid_is_store_page_available()) {
2478
- $url = ecwid_get_store_page_url();
 
2479
 
2480
  $str = '<script data-cfasync="false" type="text/javascript">var ecwid_ProductBrowserURL = "' . esc_js($url) . '";</script>';
2481
  }
@@ -2539,8 +2599,8 @@ function ecwid_sso() {
2539
 
2540
  $current_user = wp_get_current_user();
2541
 
2542
- $signin_url = wp_login_url(ecwid_get_store_page_url());
2543
- $signout_url = wp_logout_url(ecwid_get_store_page_url());
2544
  $sign_in_out_urls = <<<JS
2545
  window.EcwidSignInUrl = '$signin_url';
2546
  window.EcwidSignOutUrl = '$signout_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.0
9
  Author URI: http://www.ecwid.com?source=wporg
10
  */
11
 
88
  add_action('wp_head', 'ecwid_meta');
89
  add_action('wp_head', 'ecwid_canonical');
90
  add_action('wp_head', 'ecwid_seo_compatibility_restore', 1000);
91
+ add_action('wp_head', 'ecwid_print_inline_js_config');
92
  add_action('wp_head', 'ecwid_product_browser_url_in_head');
93
  add_filter( 'widget_meta_poweredby', 'ecwid_add_credits');
94
  add_filter('the_content', 'ecwid_content_started', 0);
119
  }
120
 
121
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-nav-menus.php';
122
+ require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-seo-links.php';
123
+ require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-store-page.php';
124
+
125
 
126
  require_once ECWID_PLUGIN_DIR . 'lib/ecwid_platform.php';
127
  require_once ECWID_PLUGIN_DIR . 'lib/ecwid_api_v3.php';
271
  add_action('wp_ajax_ecwid_get_product_info', 'ecwid_ajax_get_product_info' );
272
  add_action('wp_ajax_nopriv_ecwid_get_product_info', 'ecwid_ajax_get_product_info' );
273
 
274
+ add_filter('redirect_canonical', 'ecwid_redirect_canonical2', 10, 3);
275
+
276
+ function ecwid_redirect_canonical2($redir, $req) {
277
+ global $wp_query;
278
+
279
+ if ($wp_query->get('page_id') == Ecwid_Store_Page::get_current_store_page_id() && $req . '/' == $redir) {
280
+ return false;
281
+ }
282
+
283
+ return $redir;
284
+ }
285
 
286
  function ecwid_enqueue_frontend() {
287
 
288
+
289
+ global $wp_query;
290
+
291
  if (!wp_script_is('jquery-ui-widget')) {
292
  wp_enqueue_script('jquery-ui-widget', includes_url() . 'js/jquery/ui/widget.min.js', array('jquery'));
293
  }
301
 
302
  wp_enqueue_script( 'ecwid-frontend-js', ECWID_PLUGIN_URL . 'js/frontend.js', array( 'jquery' ), get_option( 'ecwid_plugin_version' ) );
303
 
304
+ if ( get_post() && get_post()->post_type == Ecwid_Products::POST_TYPE_PRODUCT ) {
305
  wp_enqueue_script( 'ecwid-post-product', ECWID_PLUGIN_URL . 'js/post-product.js', array(), get_option( 'ecwid_plugin_version' ), TRUE );
306
 
307
  $meta = get_post_meta(get_the_ID(), 'ecwid_id');
308
 
309
  wp_localize_script( 'ecwid-post-product', 'ecwidPost', array(
310
  'productId' => $meta[0],
311
+ 'storePageUrl' => Ecwid_Store_Page::get_store_url()
312
  ) );
313
  }
314
 
330
  }
331
  }
332
 
333
+ function ecwid_print_inline_js_config() {
334
+ echo <<<HTML
335
+ <script type="text/javascript">
336
+ window.ec = window.ec || Object();
337
+ window.ec.config = window.ec.config || Object();
338
+ window.ec.config.chameleon = window.ec.config.chameleon || Object();
339
+ window.ec.config.storefrontUrls = window.ec.config.storefrontUrls || {};
340
+ HTML;
341
+
342
+ do_action('ecwid_print_inline_js_config');
343
+ echo '</script>';
344
+ }
345
+
346
+ add_action( 'ecwid_print_inline_js_config', 'ecwid_add_chameleon' );
347
  function ecwid_add_chameleon() {
348
  if (!get_option('ecwid_use_chameleon')) {
349
  return;
382
  $chameleon['font'] = $font;
383
  }
384
 
385
+ echo <<<JS
 
 
 
 
386
  window.ec.config.chameleon.font = $chameleon[font];
387
  window.ec.config.chameleon.colors = $chameleon[colors];
388
  </script>
389
+ JS;
390
 
391
  }
392
 
444
  }
445
 
446
  function ecwid_backward_compatibility() {
447
+
448
+
449
  // Backward compatibility with 1.1.2 and earlier
450
  if (isset($_GET['ecwid_product_id']) || isset($_GET['ecwid_category_id'])) {
451
 
463
  {
464
  if (!ecwid_is_paid_account() || !ecwid_is_store_page_available()) return;
465
 
466
+ $page_id = Ecwid_Store_Page::get_current_store_page_id();
467
 
468
  if (get_post_status($page_id) == 'publish') {
469
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-sitemap-builder.php';
470
 
471
+ $sitemap = new EcwidSitemapBuilder(Ecwid_Store_Page::get_store_url(), $callback, ecwid_new_product_api());
472
 
473
  $sitemap->generate();
474
  }
541
  }
542
 
543
  if ($fresh_install || $upgrade || @$_GET['ecwid_reinit']) {
544
+
545
+ add_option( Ecwid_Seo_Links::OPTION_ENABLED, true );
546
+
547
  if (ecwid_migrations_is_original_plugin_version_older_than('4.3')) {
548
  add_option('ecwid_fetch_url_use_file_get_contents', '');
549
  add_option('ecwid_remote_get_timeout', '5');
557
  add_option('ecwid_enable_sso');
558
  }
559
 
560
+ if ( ecwid_migrations_is_original_plugin_version_older_than( '5' ) ) {
561
+ update_option( Ecwid_Seo_Links::OPTION_ENABLED, 0 );
562
+ } else {
563
+ Ecwid_Seo_Links::enable();
564
+ }
565
+
566
 
567
  add_option( Ecwid_Products::OPTION_ENABLED, Ecwid_Products::is_enabled() );
568
 
569
+ add_option('ecwid_chameleon_colors_foreground', '');
570
  add_option('ecwid_chameleon_colors_background', '');
571
  add_option('ecwid_chameleon_colors_link', '');
572
  add_option('ecwid_chameleon_colors_button', '');
573
  add_option('ecwid_chameleon_colors_price', '');
574
+ add_option('ecwid_disable_pb_url', false );
575
+
576
+ add_option(Ecwid_Widget_Floating_Shopping_Cart::OPTION_DISPLAY_POSITION, '');
577
 
578
  update_option('ecwid_use_new_search', 'Y');
579
  }
738
  return;
739
 
740
  $theme = ecwid_get_theme_name();
741
+ $store_url = Ecwid_Store_Page::get_store_url();
742
 
743
 
744
  if (!is_admin()) {
786
  "id" => "ecwid-go-to-page",
787
  "title" => __("Visit storefront", 'ecwid-shopping-cart'),
788
  "parent" => "ecwid-main",
789
+ 'href' => Ecwid_Store_Page::get_store_url()
790
  )
791
  );
792
 
877
  echo '<link rel="dns-prefetch" href="//app.ecwid.com/">' . PHP_EOL;
878
 
879
  if (!ecwid_page_has_productbrowser() && ecwid_is_store_page_available()) {
880
+ $page_url = Ecwid_Store_Page::get_store_url();
881
  echo '<link rel="prefetch" href="' . $page_url . '" />' . PHP_EOL;
882
  echo '<link rel="prerender" href="' . $page_url . '" />' . PHP_EOL;
883
  }
1140
  if ( Ecwid_Products::is_enabled() ) {
1141
  $params .= '&data_sync_products=1';
1142
  }
1143
+
1144
+ if ( Ecwid_Seo_Links::is_enabled() ) {
1145
+ $params .= '&data_clean_urls=1';
1146
+ }
1147
  $s = '<script data-cfasync="false" type="text/javascript" src="https://' . APP_ECWID_COM . '/script.js?' . $store_id . $params . '"></script>';
1148
  $s = $s . ecwid_sso();
1149
  $s .= '<script type="text/javascript">if (jQuery && jQuery.mobile) { jQuery.mobile.hashListeningEnabled = false; jQuery.mobile.pushStateEnabled=false; }</script>';
1548
  return true;
1549
  }
1550
 
1551
+ $post = get_post(Ecwid_Store_Page::get_current_store_page_id());
1552
  if ($post && !is_wp_error($post)) {
1553
  $shortcodes = ecwid_find_shortcodes( $post->post_content, 'ecwid_categories');
1554
 
1563
  {
1564
  if (get_option('ecwid_use_new_horizontal_categories')) return false;
1565
 
1566
+ $page_contents = get_post(Ecwid_Store_Page::get_current_store_page_id())->post_content;
1567
  $shortcodes = ecwid_find_shortcodes($page_contents, 'ecwid');
1568
  if (!$shortcodes) {
1569
  return null;
1797
  register_setting( 'ecwid_options_page', 'ecwid_use_chameleon' );
1798
  register_setting( 'ecwid_options_page', 'ecwid_use_new_horizontal_categories' );
1799
  register_setting( 'ecwid_options_page', 'ecwid_is_sso_enabled' );
1800
+ register_setting( 'ecwid_options_page', Ecwid_Seo_Links::OPTION_ENABLED );
1801
  break;
1802
  }
1803
 
1807
  Ecwid_Products::disable();
1808
  }
1809
 
1810
+
1811
+ if ($_POST['settings_section'] == 'advanced' && isset($_POST[Ecwid_Seo_Links::OPTION_ENABLED]) && !Ecwid_Seo_Links::is_enabled()) {
1812
+ Ecwid_Seo_Links::enable();
1813
+ } else if ($_POST['settings_section'] == 'advanced' && !isset($_POST[Ecwid_Seo_Links::OPTION_ENABLED]) && Ecwid_Seo_Links::is_enabled()) {
1814
+ Ecwid_Seo_Links::disable();
1815
+ }
1816
+
1817
  if ($_POST['settings_section'] == 'advanced' && !@$_POST['ecwid_is_sso_enabled']) {
1818
  update_option('ecwid_sso_secret_key', '');
1819
  }
2191
  return $result;
2192
  }
2193
 
2194
+ function ecwid_get_product_seo_url( $product_id ) {
2195
+ if ( Ecwid_Products::is_enabled() ) {
2196
+ global $ecwid_products;
2197
+
2198
+ return $ecwid_products->get_product_link( $product_id );
2199
+ } else {
2200
+ $api = new Ecwid_Api_V3();
2201
+ if ( $api->is_api_available() ) {
2202
+ $product = $api->get_product( $product_id );
2203
+
2204
+ return $product->url;
2205
+ }
2206
+ }
2207
+
2208
+ return Ecwid_Store_Page::get_store_url() . '#!/p/' . $product_id;
2209
+ }
2210
+
2211
  function ecwid_advanced_settings_do_page() {
2212
  $categories = ecwid_get_categories_for_selector();
2213
 
2453
 
2454
  function ecwid_save_post($post_id)
2455
  {
2456
+
2457
  // If primary or auto store page gets updated
2458
  if ($post_id == get_option('ecwid_store_page_id') || $post_id == get_option('ecwid_store_page_id_auto')) {
2459
  $new_status = get_post_status($post_id);
2474
  }
2475
 
2476
  // if there is no current store page and this new page has a product browser
2477
+ if ( ecwid_page_has_productbrowser($post_id) && !Ecwid_Store_Page::get_current_store_page_id() ) {
2478
  // then this page becomes a new store page
2479
  update_option('ecwid_store_page_id_auto', $post_id);
2480
  }
2481
  }
2482
 
2483
+ function ecwid_get_store_page_base_url( $page = 0 ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2484
 
2485
+ $url = parse_url( get_permalink( $page ) );
2486
+ return $url['path'];
2487
  }
2488
 
2489
  function ecwid_get_store_page_url()
2491
  static $link = null;
2492
 
2493
  if (is_null($link)) {
2494
+ $link = get_page_link( Ecwid_Store_Page::get_current_store_page_id() );
2495
  }
2496
 
2497
  return $link;
2499
 
2500
  function ecwid_is_store_page_available()
2501
  {
2502
+ return Ecwid_Store_Page::get_current_store_page_id() != false;
2503
  }
2504
 
2505
  function ecwid_get_product_url($product)
2514
 
2515
  function ecwid_get_entity_url($entity, $type) {
2516
 
2517
+ $link = Ecwid_Store_Page::get_store_url();
2518
 
2519
  if (is_numeric($entity)) {
2520
  return $link . '#!/' . $type . '/' . $entity;
2528
 
2529
  function ecwid_get_product_browser_url_script()
2530
  {
2531
+ if ( get_option('ecwid_disable_pb_url' ) ) {
2532
+ return;
2533
+ }
2534
+
2535
  $str = '';
2536
  if (ecwid_is_store_page_available()) {
2537
+
2538
+ $url = Ecwid_Store_Page::get_store_url();
2539
 
2540
  $str = '<script data-cfasync="false" type="text/javascript">var ecwid_ProductBrowserURL = "' . esc_js($url) . '";</script>';
2541
  }
2599
 
2600
  $current_user = wp_get_current_user();
2601
 
2602
+ $signin_url = wp_login_url(Ecwid_Store_Page::get_store_url());
2603
+ $signout_url = wp_logout_url(Ecwid_Store_Page::get_store_url());
2604
  $sign_in_out_urls = <<<JS
2605
  window.EcwidSignInUrl = '$signin_url';
2606
  window.EcwidSignOutUrl = '$signout_url';
includes/class-ecwid-help-page.php CHANGED
@@ -25,7 +25,7 @@ class Ecwid_Help_Page {
25
  if ( get_ecwid_store_id() != ECWID_DEMO_STORE_ID ) {
26
  $body_lines[] = 'Store ID: ' . get_ecwid_store_id();
27
  }
28
- $body_lines[] = 'Store URL: ' . ecwid_get_store_page_url();
29
  $body_lines[] = 'Wp theme: ' . ecwid_get_theme_name();
30
  $body_lines[] = 'Ecwid plugin version: ' . get_option('ecwid_plugin_version');
31
  $body_lines[] = 'Wordpress version: ' . get_bloginfo('version');
25
  if ( get_ecwid_store_id() != ECWID_DEMO_STORE_ID ) {
26
  $body_lines[] = 'Store ID: ' . get_ecwid_store_id();
27
  }
28
+ $body_lines[] = 'Store URL: ' . Ecwid_Store_Page::get_store_page_url();
29
  $body_lines[] = 'Wp theme: ' . ecwid_get_theme_name();
30
  $body_lines[] = 'Ecwid plugin version: ' . get_option('ecwid_plugin_version');
31
  $body_lines[] = 'Wordpress version: ' . get_bloginfo('version');
includes/class-ecwid-integration-wpseo.php CHANGED
@@ -86,10 +86,10 @@ XML;
86
  {
87
  $url = htmlspecialchars($url);
88
  $imageCode = '';
89
- $image = @$obj['originalImageUrl'];
90
  if ($image) {
91
  $image = htmlspecialchars($image);
92
- $title = htmlspecialchars($obj['name']);
93
  $imageCode = <<<XML
94
  <image:image>
95
  <image:title>$title</image:title>
@@ -98,6 +98,7 @@ XML;
98
  </image:image>
99
  XML;
100
  }
 
101
  $this->sitemap .= <<<XML
102
  <url>
103
  <loc>$url</loc>
86
  {
87
  $url = htmlspecialchars($url);
88
  $imageCode = '';
89
+ $image = @$obj->originalImageUrl;
90
  if ($image) {
91
  $image = htmlspecialchars($image);
92
+ $title = htmlspecialchars($obj->name);
93
  $imageCode = <<<XML
94
  <image:image>
95
  <image:title>$title</image:title>
98
  </image:image>
99
  XML;
100
  }
101
+
102
  $this->sitemap .= <<<XML
103
  <url>
104
  <loc>$url</loc>
includes/class-ecwid-message-manager.php CHANGED
@@ -37,8 +37,8 @@ TXT
37
  ),
38
  'href="mailto:wordpress@ecwid.com"',
39
  'target="_blank" href="http://my.ecwid.com"',
40
- 'href="' . ecwid_get_store_page_url() . '" target="_blank"',
41
- ecwid_get_store_page_url()
42
  );
43
  } else {
44
  $message = sprintf(
@@ -46,8 +46,8 @@ TXT
46
  $wp_remote_post_error,
47
  'href="mailto:wordpress@ecwid.com"',
48
  'target="_blank" href="http://my.ecwid.com"',
49
- 'href="' . ecwid_get_store_page_url() . '" target="_blank"',
50
- ecwid_get_store_page_url()
51
  );
52
  }
53
 
@@ -170,8 +170,8 @@ TXT
170
  }
171
 
172
  if ($name == 'on_storeid_set') {
173
- $params['primary_url'] = ecwid_get_store_page_url();
174
- $params['secondary_url'] = 'post.php?post=' . ecwid_get_current_store_page_id() . '&action=edit&show-ecwid=true';
175
  }
176
 
177
  if ($name == 'on_appearance_widgets') {
@@ -285,7 +285,7 @@ TXT
285
  $is_newbie = get_ecwid_store_id() == ECWID_DEMO_STORE_ID;
286
 
287
  $is_ecwid_settings = in_array($admin_page, array('ecwid-store_page_ecwid-advanced', 'ecwid-store_page_ecwid-appearance'));
288
- $is_store_page = $admin_page == 'post' && isset($_GET['post']) && $_GET['post'] == ecwid_get_current_store_page_id();
289
 
290
  return $is_newbie && ($is_ecwid_settings || $is_store_page);
291
 
37
  ),
38
  'href="mailto:wordpress@ecwid.com"',
39
  'target="_blank" href="http://my.ecwid.com"',
40
+ 'href="' . Ecwid_Store_Page::get_store_url() . '" target="_blank"',
41
+ Ecwid_Store_Page::get_store_url()
42
  );
43
  } else {
44
  $message = sprintf(
46
  $wp_remote_post_error,
47
  'href="mailto:wordpress@ecwid.com"',
48
  'target="_blank" href="http://my.ecwid.com"',
49
+ 'href="' . Ecwid_Store_Page::get_store_url() . '" target="_blank"',
50
+ Ecwid_Store_Page::get_store_url()
51
  );
52
  }
53
 
170
  }
171
 
172
  if ($name == 'on_storeid_set') {
173
+ $params['primary_url'] = Ecwid_Store_Page::get_store_url();
174
+ $params['secondary_url'] = 'post.php?post=' . Ecwid_Store_Page::get_current_store_page_id() . '&action=edit&show-ecwid=true';
175
  }
176
 
177
  if ($name == 'on_appearance_widgets') {
285
  $is_newbie = get_ecwid_store_id() == ECWID_DEMO_STORE_ID;
286
 
287
  $is_ecwid_settings = in_array($admin_page, array('ecwid-store_page_ecwid-advanced', 'ecwid-store_page_ecwid-appearance'));
288
+ $is_store_page = $admin_page == 'post' && isset($_GET['post']) && $_GET['post'] == Ecwid_Store_Page::get_current_store_page_id();
289
 
290
  return $is_newbie && ($is_ecwid_settings || $is_store_page);
291
 
includes/class-ecwid-nav-menus.php CHANGED
@@ -94,7 +94,7 @@ class Ecwid_Nav_Menus {
94
  if (empty($items)) return null;
95
 
96
  foreach ($items as $item) {
97
- if ( $item->object == 'page' && $item->object_id == ecwid_get_current_store_page_id() )
98
  return $item;
99
 
100
  if ($item->object == 'ecwid-store-with-categories' || $item->object == 'ecwid-store') {
@@ -112,7 +112,7 @@ class Ecwid_Nav_Menus {
112
  }
113
 
114
  public function enqueue_frontend_assets() {
115
- if (ecwid_get_current_store_page_id() != get_the_ID()) {
116
  return;
117
  }
118
 
@@ -166,12 +166,12 @@ class Ecwid_Nav_Menus {
166
 
167
  $ecwid_menu_type = isset($types[$item->object]) ? $types[$item->object] : null;
168
 
169
- if ($ecwid_menu_type) {
170
- $item->url = ecwid_get_store_page_url() . '#!/~/' . $ecwid_menu_type['url'];
171
  }
172
 
173
  if ($item->object == 'ecwid-store-with-categories' || $item->object == 'ecwid-store') {
174
- $item->url = ecwid_get_store_page_url();
175
  }
176
  if ($item->object == 'ecwid-store-with-categories') {
177
  $categories = ecwid_get_categories();
@@ -179,7 +179,7 @@ class Ecwid_Nav_Menus {
179
  foreach ($categories as $category) {
180
  $counter++;
181
  $post = new stdClass;
182
- $post->ID = 0;
183
  $post->post_author = '';
184
  $post->post_date = '';
185
  $post->post_date_gmt = '';
@@ -192,7 +192,7 @@ class Ecwid_Nav_Menus {
192
  $post->post_parent = 0;
193
  $post->menu_order = $item->menu_order + $counter;
194
  $post->menu_item_parent = $item->ID;
195
- $post->url = ecwid_get_store_page_url() . $category->link;
196
  $post->classes = '';
197
  $post->type = 'post';
198
  $post->db_id = 0;
@@ -230,7 +230,7 @@ class Ecwid_Nav_Menus {
230
  <input type="hidden" class="menu-item-object" name="menu-item[<?php echo esc_attr($i); ?>][menu-item-object]" value="<?php echo $value['classes']; ?>" />
231
  <input type="hidden" class="menu-item-type" name="menu-item[<?php echo esc_attr($i); ?>][menu-item-type]" value="ecwid_menu_item" />
232
  <input type="hidden" class="menu-item-title" name="menu-item[<?php echo esc_attr($i); ?>][menu-item-title]" value="<?php echo esc_html($value['label'] ); ?>" />
233
- <input type="hidden" class="menu-item-url" name="menu-item[<?php echo esc_attr($i); ?>][menu-item-url]" value="<?php echo esc_url(ecwid_get_store_page_url() . '#!/~/' . $value['url']); ?>" />
234
  </li>
235
  <?php
236
  $i--;
@@ -263,35 +263,40 @@ class Ecwid_Nav_Menus {
263
  'classes' => 'ecwid-cart',
264
  'url' => 'cart',
265
  'label' => __('Shopping Cart', 'ecwid-shopping-cart'),
266
- 'name' => 'cart'
 
267
  ),
268
  'ecwid-product-search' => array(
269
  'list-name' => __('Product Search', 'ecwid-shopping-cart'),
270
  'classes' => 'ecwid-product-search',
271
  'url' => 'search',
272
  'label' => __('Product Search', 'ecwid-shopping-cart'),
273
- 'name' => 'search'
 
274
  ),
275
  'ecwid-my-account' => array(
276
  'list-name' => __('My Account', 'ecwid-shopping-cart'),
277
  'classes' => 'ecwid-my-account',
278
  'url' => 'accountSettings',
279
  'label' => __('My Account', 'ecwid-shopping-cart'),
280
- 'name' => 'account'
 
281
  ),
282
  'ecwid-store' => array(
283
  'list-name' => __('Store', 'ecwid-shopping-cart'),
284
  'classes' => 'ecwid-store',
285
  'url' => '',
286
  'label' => __('Store', 'ecwid-shopping-cart'),
287
- 'name' => 'store'
 
288
  ),
289
  'ecwid-store-with-categories' => array(
290
  'list-name' => __('Store with Categories Menu', 'ecwid-shopping-cart'),
291
  'classes' => 'ecwid-store-with-categories',
292
  'url' => '',
293
  'label' => __('Store', 'ecwid-shopping-cart'),
294
- 'name' => 'store-with-categories'
 
295
  )
296
  );
297
 
94
  if (empty($items)) return null;
95
 
96
  foreach ($items as $item) {
97
+ if ( $item->object == 'page' && $item->object_id == Ecwid_Store_Page::get_current_store_page_id() )
98
  return $item;
99
 
100
  if ($item->object == 'ecwid-store-with-categories' || $item->object == 'ecwid-store') {
112
  }
113
 
114
  public function enqueue_frontend_assets() {
115
+ if ( Ecwid_Store_Page::get_current_store_page_id() != get_the_ID() ) {
116
  return;
117
  }
118
 
166
 
167
  $ecwid_menu_type = isset($types[$item->object]) ? $types[$item->object] : null;
168
 
169
+ if ( $ecwid_menu_type ) {
170
+ $item->url = Ecwid_Store_Page::get_menu_item_url($ecwid_menu_type);
171
  }
172
 
173
  if ($item->object == 'ecwid-store-with-categories' || $item->object == 'ecwid-store') {
174
+ $item->url = Ecwid_Store_Page::get_store_url();
175
  }
176
  if ($item->object == 'ecwid-store-with-categories') {
177
  $categories = ecwid_get_categories();
179
  foreach ($categories as $category) {
180
  $counter++;
181
  $post = new stdClass;
182
+ $post->ID = -1;
183
  $post->post_author = '';
184
  $post->post_date = '';
185
  $post->post_date_gmt = '';
192
  $post->post_parent = 0;
193
  $post->menu_order = $item->menu_order + $counter;
194
  $post->menu_item_parent = $item->ID;
195
+ $post->url = Ecwid_Store_Page::get_category_url( $category->id );
196
  $post->classes = '';
197
  $post->type = 'post';
198
  $post->db_id = 0;
230
  <input type="hidden" class="menu-item-object" name="menu-item[<?php echo esc_attr($i); ?>][menu-item-object]" value="<?php echo $value['classes']; ?>" />
231
  <input type="hidden" class="menu-item-type" name="menu-item[<?php echo esc_attr($i); ?>][menu-item-type]" value="ecwid_menu_item" />
232
  <input type="hidden" class="menu-item-title" name="menu-item[<?php echo esc_attr($i); ?>][menu-item-title]" value="<?php echo esc_html($value['label'] ); ?>" />
233
+ <input type="hidden" class="menu-item-url" name="menu-item[<?php echo esc_attr($i); ?>][menu-item-url]" value="<?php echo esc_url(Ecwid_Store_Page::get_store_url() . '#!/~/' . $value['url']); ?>" />
234
  </li>
235
  <?php
236
  $i--;
263
  'classes' => 'ecwid-cart',
264
  'url' => 'cart',
265
  'label' => __('Shopping Cart', 'ecwid-shopping-cart'),
266
+ 'name' => 'cart',
267
+ 'clean-url' => 'cart'
268
  ),
269
  'ecwid-product-search' => array(
270
  'list-name' => __('Product Search', 'ecwid-shopping-cart'),
271
  'classes' => 'ecwid-product-search',
272
  'url' => 'search',
273
  'label' => __('Product Search', 'ecwid-shopping-cart'),
274
+ 'name' => 'search',
275
+ 'clean-url' => 'search'
276
  ),
277
  'ecwid-my-account' => array(
278
  'list-name' => __('My Account', 'ecwid-shopping-cart'),
279
  'classes' => 'ecwid-my-account',
280
  'url' => 'accountSettings',
281
  'label' => __('My Account', 'ecwid-shopping-cart'),
282
+ 'name' => 'account',
283
+ 'clean-url' => 'account/orders'
284
  ),
285
  'ecwid-store' => array(
286
  'list-name' => __('Store', 'ecwid-shopping-cart'),
287
  'classes' => 'ecwid-store',
288
  'url' => '',
289
  'label' => __('Store', 'ecwid-shopping-cart'),
290
+ 'name' => 'store',
291
+ 'clean-url' => ''
292
  ),
293
  'ecwid-store-with-categories' => array(
294
  'list-name' => __('Store with Categories Menu', 'ecwid-shopping-cart'),
295
  'classes' => 'ecwid-store-with-categories',
296
  'url' => '',
297
  'label' => __('Store', 'ecwid-shopping-cart'),
298
+ 'name' => 'store-with-categories',
299
+ 'clean-url' => ''
300
  )
301
  );
302
 
includes/class-ecwid-products.php CHANGED
@@ -51,7 +51,7 @@ class Ecwid_Products {
51
  }
52
 
53
  public function replace_product_page_url_on_search( $url, $post, $leavename = false ) {
54
- if ( $post->post_type == self::POST_TYPE_PRODUCT && is_search() ) {
55
  $new_url = $this->_get_post_link( $post->ID );
56
 
57
  if ($new_url) {
@@ -65,11 +65,11 @@ class Ecwid_Products {
65
  public function redirect_to_store_page() {
66
  $post = get_post();
67
 
68
- if ( $post->post_type == self::POST_TYPE_PRODUCT && is_single() ) {
69
  $url = $this->_get_post_link($post->ID);
70
 
71
  if ($url) {
72
- wp_redirect($url);
73
  exit();
74
  }
75
  }
@@ -113,33 +113,47 @@ class Ecwid_Products {
113
 
114
  $product_id = intval( @$_REQUEST['product_id'] );
115
 
 
 
 
 
 
 
 
 
 
 
116
  $post_id = $this->_find_post_by_product_id( $product_id );
117
 
118
  if ($post_id) {
119
- echo json_encode( $this->_get_post_link( $post_id ) );
120
  }
121
 
122
- exit();
123
  }
124
 
125
  protected function _get_post_link( $post_id ) {
126
 
127
- $store_page_url = ecwid_get_store_page_url();
128
 
129
  if (! $store_page_url) {
130
  return '';
131
  }
132
 
133
- $url = get_post_meta( $post_id, '_ecwid_url', true );
134
 
135
- if ( strpos( $url, '#!' ) === false ) {
136
- $ecwid_product_id = get_post_meta( $post_id, 'ecwid_id', true );
137
- $url = '#!/p/' . $ecwid_product_id;
138
  }
139
 
140
- $url = ecwid_get_store_page_url() . $url;
141
 
142
- return $url;
 
 
 
 
 
143
  }
144
 
145
 
@@ -215,7 +229,10 @@ class Ecwid_Products {
215
  'exclude_from_search' => FALSE,
216
  'hierarchical' => FALSE,
217
  'show_in_nav_menus' => TRUE,
218
- 'show_ui' => false
 
 
 
219
  )
220
  );
221
  }
@@ -294,6 +311,7 @@ class Ecwid_Products {
294
  }
295
 
296
  if (!$settings || $settings['one_at_a_time'] && !$did_something) {
 
297
  $did_something = $this->_process_products($settings);
298
  }
299
 
@@ -460,6 +478,10 @@ class Ecwid_Products {
460
  '_updatedTimestamp' => $product->updateTimestamp,
461
  );
462
 
 
 
 
 
463
  $post_id = wp_insert_post(
464
  array(
465
  'ID' => $existing_post_id,
@@ -685,4 +707,4 @@ class Ecwid_Products_Sync_Status {
685
  }
686
  }
687
 
688
- $p = new Ecwid_Products();
51
  }
52
 
53
  public function replace_product_page_url_on_search( $url, $post, $leavename = false ) {
54
+ if ( $post->post_type == self::POST_TYPE_PRODUCT ) {
55
  $new_url = $this->_get_post_link( $post->ID );
56
 
57
  if ($new_url) {
65
  public function redirect_to_store_page() {
66
  $post = get_post();
67
 
68
+ if ( $post && $post->post_type == self::POST_TYPE_PRODUCT && is_single() ) {
69
  $url = $this->_get_post_link($post->ID);
70
 
71
  if ($url) {
72
+ wp_redirect($url, 301);
73
  exit();
74
  }
75
  }
113
 
114
  $product_id = intval( @$_REQUEST['product_id'] );
115
 
116
+ $link = $this->get_product_link( $product_id );
117
+
118
+ if ( $link ) {
119
+ echo json_encode($link);
120
+ }
121
+
122
+ exit();
123
+ }
124
+
125
+ public function get_product_link( $product_id ) {
126
  $post_id = $this->_find_post_by_product_id( $product_id );
127
 
128
  if ($post_id) {
129
+ return $this->_get_post_link( $post_id );
130
  }
131
 
132
+ return '';
133
  }
134
 
135
  protected function _get_post_link( $post_id ) {
136
 
137
+ $store_page_url = Ecwid_Store_Page::get_store_url();
138
 
139
  if (! $store_page_url) {
140
  return '';
141
  }
142
 
143
+ $url = get_post_meta( $post_id, '_ecwid_seo_url', true );
144
 
145
+ if ( $url ) {
146
+ return $url;
 
147
  }
148
 
149
+ $ecwid_product_id = get_post_meta( $post_id, 'ecwid_id', true );
150
 
151
+ $url = Ecwid_Store_Page::get_product_url_from_api( $ecwid_product_id );
152
+ if ( $url ) {
153
+ return $url;
154
+ }
155
+
156
+ return Ecwid_Store_Page::get_product_url_default_fallback( $ecwid_product_id );
157
  }
158
 
159
 
229
  'exclude_from_search' => FALSE,
230
  'hierarchical' => FALSE,
231
  'show_in_nav_menus' => TRUE,
232
+ 'show_ui' => false,
233
+ 'labels' => array(
234
+ 'name' => __( 'Products', 'ecwid-shopping-cart' )
235
+ )
236
  )
237
  );
238
  }
311
  }
312
 
313
  if (!$settings || $settings['one_at_a_time'] && !$did_something) {
314
+
315
  $did_something = $this->_process_products($settings);
316
  }
317
 
478
  '_updatedTimestamp' => $product->updateTimestamp,
479
  );
480
 
481
+ if ( Ecwid_Seo_Links::is_enabled() ) {
482
+ $meta['_ecwid_seo_url'] = $product->url;
483
+ }
484
+
485
  $post_id = wp_insert_post(
486
  array(
487
  'ID' => $existing_post_id,
707
  }
708
  }
709
 
710
+ $ecwid_products = new Ecwid_Products();
includes/class-ecwid-seo-links.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Ecwid_Seo_Links {
5
+
6
+ const OPTION_ENABLED = 'ecwid_seo_links_enabled';
7
+
8
+ public function __construct()
9
+ {
10
+ // Should always run, check for enabled inside: once the option is turned on, it should rebuild the rules right away,
11
+ // therefore the action must me registered
12
+ add_action( 'rewrite_rules_array', array( $this, 'build_rewrite_rules' ), 1, 1 );
13
+
14
+ if ( self::is_enabled() ) {
15
+
16
+ add_filter( 'redirect_canonical', array( $this, 'redirect_canonical' ), 10, 2 );
17
+ add_action( 'template_redirect', array( $this, 'redirect_escaped_fragment' ) );
18
+
19
+ add_action( 'ecwid_print_inline_js_config', array( $this, 'add_js_config') );
20
+ }
21
+ }
22
+
23
+ public function redirect_canonical( $redir, $req ) {
24
+ global $wp_query;
25
+
26
+ $page_id = $wp_query->get( 'page_id' );
27
+
28
+ if ( $page_id && ecwid_page_has_productbrowser( $page_id ) && $req . '/' == $redir ) {
29
+ return false;
30
+ }
31
+
32
+ return $redir;
33
+ }
34
+
35
+ public function redirect_escaped_fragment() {
36
+ if ( ecwid_can_display_html_catalog() ) {
37
+ $params = ecwid_parse_escaped_fragment( $_GET['_escaped_fragment_'] );
38
+
39
+ if ( !isset( $params['mode'] ) ) {
40
+ return;
41
+ }
42
+
43
+ if ( $params['mode'] == 'product' ) {
44
+ $redirect = Ecwid_Store_Page::get_product_url( $params['id'] );
45
+ } else if ($params['mode'] == 'category') {
46
+ $redirect = Ecwid_Store_Page::get_category_url( $params['id'] );
47
+ }
48
+
49
+ if ($redirect) {
50
+ wp_redirect( $redirect, 301 );
51
+ }
52
+ }
53
+ }
54
+
55
+ public function add_js_config() {
56
+
57
+ global $wp_query;
58
+ $page_id = $wp_query->get( 'page_id' );
59
+
60
+ $has_store = ecwid_page_has_productbrowser( $page_id ) ;
61
+
62
+ if ( !$has_store ) return;
63
+
64
+ $url = esc_js( ecwid_get_store_page_base_url() );
65
+
66
+ echo <<<JS
67
+ window.ec.config.storefrontUrls.cleanUrls = true;
68
+ window.ec.config.baseUrl = '$url';
69
+ JS;
70
+ }
71
+
72
+ public function build_rewrite_rules( $original_rules ) {
73
+
74
+ if ( !self::is_enabled() ) return;
75
+
76
+ $page_id = get_option( 'ecwid_store_page_id' );
77
+
78
+ if ( ecwid_page_has_productbrowser( $page_id ) ) {
79
+ $link = get_page_uri( $page_id );
80
+
81
+ $rules['^' . $link . '/.*'] = 'index.php?page_id=' . $page_id;
82
+ }
83
+
84
+ return array_merge( $rules, $original_rules );
85
+ }
86
+
87
+ public static function is_enabled() {
88
+
89
+ return self::is_feature_available() && get_option( self::OPTION_ENABLED );
90
+ }
91
+
92
+ public static function enable() {
93
+ update_option( self::OPTION_ENABLED, true );
94
+ flush_rewrite_rules();
95
+ }
96
+
97
+ public static function disable() {
98
+ update_option( self::OPTION_ENABLED, false );
99
+ flush_rewrite_rules();
100
+ }
101
+
102
+ public static function is_feature_available() {
103
+ $permalink = get_option( 'permalink_structure' );
104
+
105
+ return $permalink != '';
106
+ }
107
+ }
108
+
109
+ $ecwid_seo_links = new Ecwid_Seo_Links();
includes/class-ecwid-sitemap-builder.php CHANGED
@@ -1,17 +1,13 @@
1
  <?php
2
 
3
- require_once dirname(__FILE__) . '/../lib/JSONStreamingParser/Listener.php';
4
- require_once dirname(__FILE__) . '/../lib/JSONStreamingParser/Parser.php';
5
 
6
-
7
- class EcwidSitemapBuilder implements JsonStreamingParser_Listener {
8
- var $_stack;
9
- var $_key;
10
  var $callback;
11
- var $base_url;
12
- var $api;
13
  var $type;
14
 
 
 
 
15
  public function __construct($base_url, $callback, $api) {
16
  $this->callback = $callback;
17
  $this->base_url = $base_url;
@@ -20,70 +16,70 @@ class EcwidSitemapBuilder implements JsonStreamingParser_Listener {
20
 
21
  public function generate() {
22
 
23
- foreach (array('products', 'categories') as $type) {
24
- $this->type = $type;
25
- $stream = $this->api->get_method_response_stream($type);
26
- if (!is_null($stream)) {
27
- try {
28
- $parser = new JsonStreamingParser_Parser($stream, $this);
29
- $parser->parse();
30
- } catch (Exception $e) {
31
- fclose($stream);
32
- }
33
- }
34
- }
35
-
36
- return true;
37
- }
38
 
39
- public function file_position($line, $char) {
 
 
 
 
 
 
 
 
40
 
41
- }
42
 
43
- public function start_document() {
44
- $this->_stack = array();
45
 
46
- $this->_key = null;
47
- }
48
 
49
- public function end_document() {
50
- }
51
 
52
- public function start_object() {
53
- array_push($this->_stack, array());
54
- }
 
 
 
 
 
 
55
 
56
- public function end_object() {
57
 
58
- $obj = array_pop($this->_stack);
59
- if (is_array($obj) && array_key_exists('url', $obj)) {
60
- $callback = $this->callback;
61
 
62
- call_user_func(
63
- $callback,
64
- ecwid_get_entity_url($obj, $this->type == 'products' ? 'p' : 'c'),
65
- $this->type == 'products' ? 0.6 : 0.5,
66
- 'weekly',
67
- $obj
 
68
  );
69
- }
70
- }
71
 
72
- public function start_array() {
73
- }
74
 
75
- public function end_array() {
76
- }
77
 
78
- public function key($key) {
79
- $this->_key = $key;
80
- }
81
 
82
- public function value($value) {
83
- $params = array('url', 'originalImageUrl', 'name');
 
 
 
 
 
 
 
 
 
 
84
 
85
- if (in_array($this->_key, $params)) {
86
- $this->_stack[0][$this->_key] = $value;
87
- }
88
  }
89
  }
1
  <?php
2
 
 
 
3
 
4
+ class EcwidSitemapBuilder {
 
 
 
5
  var $callback;
 
 
6
  var $type;
7
 
8
+ const PRIORITY_PRODUCT = 0.6;
9
+ const PRIORITY_CATEGORY = 0.5;
10
+
11
  public function __construct($base_url, $callback, $api) {
12
  $this->callback = $callback;
13
  $this->base_url = $base_url;
16
 
17
  public function generate() {
18
 
19
+ $api = new Ecwid_Api_V3();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
+ $offset = 0;
22
+ $limit = 100;
23
+ do {
24
+ $categories = $api->get_categories(
25
+ array(
26
+ 'offset' => $offset,
27
+ 'limit' => $limit
28
+ )
29
+ );
30
 
 
31
 
32
+ if ($categories->items) {
 
33
 
34
+ foreach ($categories->items as $item) {
 
35
 
36
+ $url = $item->url;
 
37
 
38
+ call_user_func(
39
+ $this->callback,
40
+ $url,
41
+ self::PRIORITY_CATEGORY,
42
+ 'weekly',
43
+ $item
44
+ );
45
+ }
46
+ }
47
 
48
+ $offset += $limit;
49
 
50
+ } while ($categories->count > 0);
 
 
51
 
52
+ $offset = 0;
53
+ do {
54
+ $products = $api->search_products(
55
+ array(
56
+ 'offset' => $offset,
57
+ 'limit' => $limit
58
+ )
59
  );
 
 
60
 
61
+ if ($products->items) {
 
62
 
63
+ foreach ($products->items as $item) {
64
+ if ( $item->enabled ) {
65
 
66
+ $url = $item->url;
 
 
67
 
68
+ call_user_func(
69
+ $this->callback,
70
+ $url,
71
+ self::PRIORITY_PRODUCT,
72
+ 'weekly',
73
+ $item
74
+ );
75
+ }
76
+ }
77
+ }
78
+
79
+ $offset += $limit;
80
 
81
+ } while ($products->count > 0);
82
+
83
+ return true;
84
  }
85
  }
includes/class-ecwid-store-page.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ecwid_Store_Page {
4
+ public static function get_product_url( $id )
5
+ {
6
+ if ( Ecwid_Products::is_enabled() ) {
7
+ global $ecwid_products;
8
+
9
+ $url = $ecwid_products->get_product_link( $id );
10
+
11
+ if ( $url ) {
12
+ return $url;
13
+ }
14
+ }
15
+
16
+ $url = self::get_product_url_from_api( $id );
17
+ if ( $url ) {
18
+ return $url;
19
+ }
20
+
21
+ return self::get_product_url_default_fallback( $id );
22
+ }
23
+
24
+ public static function get_product_url_from_api( $id ) {
25
+ $api = new Ecwid_Api_V3();
26
+
27
+ if ( $api->is_available() ) {
28
+
29
+ $product = $api->get_product( $id );
30
+
31
+ if ( $product ) {
32
+
33
+ return $product->url;
34
+ }
35
+ }
36
+
37
+ return '';
38
+ }
39
+
40
+ public static function get_product_url_default_fallback( $id ) {
41
+ return self::get_store_url() . '#!/p/' . $id;
42
+ }
43
+
44
+ public static function get_category_url( $id )
45
+ {
46
+ if ( $id == 0 ) {
47
+ return self::get_store_url();
48
+ }
49
+
50
+ $api = new Ecwid_Api_V3();
51
+ if ( $api->is_available() ) {
52
+
53
+ $category = $api->get_category( $id );
54
+
55
+ if ( $category ) {
56
+ $url = $category->url;
57
+ }
58
+
59
+ return $url;
60
+ }
61
+
62
+ return self::get_store_url() . '#!/c/' . $id;
63
+ }
64
+
65
+ public static function get_menu_item_url( $menu_item )
66
+ {
67
+ $suffix = '';
68
+ if ( Ecwid_Seo_Links::is_enabled() ) {
69
+ $suffix = $menu_item['clean-url'];
70
+ } else {
71
+ $suffix = '#!' . $menu_item['url'];
72
+ }
73
+ return self::get_store_url() . $suffix;
74
+ }
75
+
76
+ public static function get_cart_url()
77
+ {
78
+ if ( Ecwid_Seo_Links::is_enabled() ) {
79
+ return untrailingslashit( self::get_store_url() ) . '/cart';
80
+ } else {
81
+ return self::get_store_url() . '#!/cart';
82
+ }
83
+ }
84
+
85
+ public static function get_store_url()
86
+ {
87
+ static $link = null;
88
+
89
+ if ( is_null( $link ) ) {
90
+ $link = get_page_link( self::get_current_store_page_id() );
91
+ }
92
+
93
+ return $link;
94
+ }
95
+
96
+ public static function get_current_store_page_id()
97
+ {
98
+ static $page_id = null;
99
+
100
+ if ( is_null( $page_id ) ) {
101
+ $page_id = false;
102
+ foreach( array( 'ecwid_store_page_id', 'ecwid_store_page_id_auto' ) as $option ) {
103
+ $id = get_option( $option );
104
+ if ( $id ) {
105
+ $status = get_post_status( $id );
106
+
107
+ if ( $status == 'publish' || $status == 'private' ) {
108
+ $page_id = $id;
109
+ break;
110
+ }
111
+ }
112
+ }
113
+ }
114
+
115
+ return $page_id;
116
+ }
117
+
118
+ }
includes/shortcodes/class-ecwid-shortcode-product.php CHANGED
@@ -62,7 +62,7 @@ class Ecwid_Shortcode_Product extends Ecwid_Shortcode_Base {
62
  if (is_array($items) && count($items) > 0) foreach ($items as $item) {
63
  if (array_key_exists($item, $display_items)) {
64
  if ($this->params['link'] == 'yes' && in_array($item, array('title', 'picture'))) {
65
- $product_link = ecwid_get_store_page_url() . '#!/~/product/id=' . $this->params['id'];
66
  $result .= '<a href="' . esc_url($product_link) . '">' . $display_items[$item] . '</a>';
67
  } else {
68
  $result .= $display_items[$item];
@@ -72,6 +72,8 @@ class Ecwid_Shortcode_Product extends Ecwid_Shortcode_Base {
72
 
73
  $result .= '</div>';
74
 
 
 
75
  update_option('ecwid_single_product_used', time());
76
 
77
  return $result;
62
  if (is_array($items) && count($items) > 0) foreach ($items as $item) {
63
  if (array_key_exists($item, $display_items)) {
64
  if ($this->params['link'] == 'yes' && in_array($item, array('title', 'picture'))) {
65
+ $product_link = Ecwid_Store_Page::get_product_url( $this->params['id'] );
66
  $result .= '<a href="' . esc_url($product_link) . '">' . $display_items[$item] . '</a>';
67
  } else {
68
  $result .= $display_items[$item];
72
 
73
  $result .= '</div>';
74
 
75
+ $result .= ' '; // APPS-892, otherwise there is no space between consecutive widgets
76
+
77
  update_option('ecwid_single_product_used', time());
78
 
79
  return $result;
includes/shortcodes/class-ecwid-shortcode-productbrowser.php CHANGED
@@ -44,10 +44,10 @@ class Ecwid_Shortcode_ProductBrowser extends Ecwid_Shortcode_Base {
44
  if (isset($params['mode']) && !empty($params['mode'])) {
45
  if ($params['mode'] == 'product') {
46
  $plain_content = $catalog->get_product($params['id']);
47
- $url = ecwid_get_product_url(ecwid_new_product_api()->get_product($params['id']));
48
  } elseif ($params['mode'] == 'category') {
49
- $plain_content = $catalog->get_category($params['id']);
50
- $url = ecwid_get_category_url(ecwid_new_product_api()->get_category($params['id']));
51
  }
52
 
53
  } else {
@@ -56,13 +56,18 @@ class Ecwid_Shortcode_ProductBrowser extends Ecwid_Shortcode_Base {
56
  if (empty($plain_content)) {
57
  $plain_content = $catalog->get_category(0);
58
  } else {
59
- $url = ecwid_get_category_url(ecwid_new_product_api()->get_category($params['id']));
60
  }
61
  }
62
 
63
  if ($url) {
64
  $parsed = parse_url($url);
65
- $plain_content .= '<script data-cfasync="false" type="text/javascript"> if (!document.location.hash) document.location.hash = "'. $parsed['fragment'] . '";</script>';
 
 
 
 
 
66
  }
67
  }
68
 
44
  if (isset($params['mode']) && !empty($params['mode'])) {
45
  if ($params['mode'] == 'product') {
46
  $plain_content = $catalog->get_product($params['id']);
47
+ $url = Ecwid_Store_Page::get_product_url( $params['id'] );
48
  } elseif ($params['mode'] == 'category') {
49
+ $plain_content = $catalog->get_category( $params['id'] );
50
+ $url = Ecwid_Store_Page::get_category_url( $params[ 'id' ] );
51
  }
52
 
53
  } else {
56
  if (empty($plain_content)) {
57
  $plain_content = $catalog->get_category(0);
58
  } else {
59
+ $url = Ecwid_Store_Page::get_category_url( $params['id'] );
60
  }
61
  }
62
 
63
  if ($url) {
64
  $parsed = parse_url($url);
65
+
66
+ if ( $parsed['fragment'] ) {
67
+ $plain_content .= '<script data-cfasync="false" type="text/javascript"> if (!document.location.hash) document.location.hash = "'. $parsed['fragment'] . '";</script>';
68
+ } else {
69
+ $plain_content .= '<script data-cfasync="false" type="text/javascript"> document.location = "' . esc_js($url) . '";</script>';
70
+ }
71
  }
72
  }
73
 
includes/themes.php CHANGED
@@ -38,24 +38,26 @@ function ecwid_get_theme_identification()
38
  function ecwid_apply_theme($theme_name = null)
39
  {
40
  $generic_themes = array(
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' ),
48
- 'pagelines' => array( 'js', 'scroll' ),
49
- 'responsiveboat' => array( 'css' ),
50
- 'twentyfourteen' => array( 'css', 'scroll' ),
51
- 'twentytwelve' => array( 'js', 'scroll' ),
52
- 'sliding-door' => array( 'css-no-parent' ),
53
- 'zerif-lite' => array( 'css-no-parent' ),
54
- 'storefront' => array( 'css' ),
55
- 'salient' => array( 'css-no-parent'),
56
- 'flora' => array( 'js' ),
57
- 'thevoux-wp' => array( 'js' ),
58
- 'zerogravity' => array( 'css' )
 
 
59
  );
60
  $generic_themes = apply_filters('ecwid_generic_themes', $generic_themes);
61
 
@@ -85,6 +87,10 @@ function ecwid_apply_theme($theme_name = null)
85
  $theme_name = 'responsiveboat';
86
  }
87
 
 
 
 
 
88
  if ( in_array($theme_name, $custom_themes) ) {
89
  $theme_file = ECWID_THEMES_DIR . '/class-ecwid-theme-' . $theme_name . '.php';
90
  $theme_file = apply_filters( 'ecwid_get_theme_file', $theme_file );
38
  function ecwid_apply_theme($theme_name = null)
39
  {
40
  $generic_themes = array(
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' ),
48
+ 'pagelines' => array( 'js', 'scroll' ),
49
+ 'responsiveboat' => array( 'css' ),
50
+ 'twentyfourteen' => array( 'css', 'scroll' ),
51
+ 'twentytwelve' => array( 'js', 'scroll' ),
52
+ 'sliding-door' => array( 'css-no-parent' ),
53
+ 'zerif-lite' => array( 'css-no-parent' ),
54
+ 'storefront' => array( 'css' ),
55
+ 'salient' => array( 'css-no-parent'),
56
+ 'flora' => array( 'js' ),
57
+ 'thevoux-wp' => array( 'js' ),
58
+ 'zerogravity' => array( 'css' ),
59
+ 'skt-design-agency-pro' => array( 'css-no-parent' ),
60
+ 'uncode' => array( 'css-no-parent' )
61
  );
62
  $generic_themes = apply_filters('ecwid_generic_themes', $generic_themes);
63
 
87
  $theme_name = 'responsiveboat';
88
  }
89
 
90
+ if (!$theme_name) {
91
+ return;
92
+ }
93
+
94
  if ( in_array($theme_name, $custom_themes) ) {
95
  $theme_file = ECWID_THEMES_DIR . '/class-ecwid-theme-' . $theme_name . '.php';
96
  $theme_file = apply_filters( 'ecwid_get_theme_file', $theme_file );
includes/themes/class-ecwid-theme-trend.php CHANGED
@@ -12,6 +12,12 @@ class Ecwid_Theme_Trend extends Ecwid_Theme_Base
12
  {
13
  parent::__construct();
14
 
 
 
 
 
 
 
15
  // That actually means that ajax loading is disabled. Really ambigious naming
16
  if (class_exists('BW') && method_exists('BW', 'get_option') && !@BW::get_option('disable_ajax_loading')) {
17
  return;
12
  {
13
  parent::__construct();
14
 
15
+ add_option('ecwid_defer_rendering', true);
16
+
17
+ if ( !get_option( 'ecwid_defer_rendering' ) ) {
18
+ return;
19
+ }
20
+
21
  // That actually means that ajax loading is disabled. Really ambigious naming
22
  if (class_exists('BW') && method_exists('BW', 'get_option') && !@BW::get_option('disable_ajax_loading')) {
23
  return;
includes/widgets/class-ecwid-widget-floating-shopping-cart.php CHANGED
@@ -7,6 +7,8 @@ class Ecwid_Widget_Floating_Shopping_Cart extends WP_Widget {
7
  'bottomright'
8
  );
9
 
 
 
10
  static protected $default_position = 'bottomright';
11
 
12
  public function __construct() {
@@ -17,9 +19,10 @@ class Ecwid_Widget_Floating_Shopping_Cart extends WP_Widget {
17
  }
18
 
19
  public function init() {
20
- if ( is_active_widget(false, false, $this->id_base, true ) ) {
21
  add_filter( 'body_class', array($this, 'body_class' ) );
22
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
 
23
  }
24
  }
25
 
@@ -37,18 +40,43 @@ class Ecwid_Widget_Floating_Shopping_Cart extends WP_Widget {
37
  }
38
 
39
  public function widget($args, $instance) {
 
 
 
 
 
 
 
 
40
 
41
- $position = @$instance['position'];
42
- if (!in_array($position, self::$positions)) {
43
- $position = self::$default_position;
 
 
 
 
 
44
  }
 
 
 
 
 
 
 
 
 
 
 
 
45
  echo '<!-- noptimize -->';
46
  echo ecwid_get_scriptjs_code();
47
  echo
48
- <<<HTML
49
- <div class="ecwid-float-icons position-$position" ondragstart="return false">
50
  <div class="ecwid-cart-icon off">
51
- <a href="#!/~/cart" data-count="0">
52
  <svg width="20" height="26" viewBox="0 0 20 26" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="M.5 6.5v14.81c0 2.255 1.79 4.084 4 4.084h11c2.21 0 4-1.83 4-4.085V6.5H.5zM6 10.585c.552 0 1-.457 1-1.02C7 9 6.552 8.542 6 8.542S5 9 5 9.563c0 .565.448 1.022 1 1.022zm8 0c.552 0 1-.457 1-1.02 0-.565-.448-1.022-1-1.022S13 9 13 9.563c0 .565.448 1.022 1 1.022z" stroke="#439CA0"/><path d="M14.5 6h-1V4.582c0-1.97-1.57-3.575-3.5-3.575S6.5 2.61 6.5 4.582V6h-1V4.582C5.5 2.048 7.52-.014 10-.014c2.482 0 4.5 2.062 4.5 4.596V6z" fill="#439CA0"/></g></svg>
53
  <div id="ecwid-cart"><script type="text/javascript"> xMinicart("style="); </script></div>
54
  </a>
7
  'bottomright'
8
  );
9
 
10
+ const OPTION_DISPLAY_POSITION = 'ecwid_floating_shopping_cart_mode';
11
+
12
  static protected $default_position = 'bottomright';
13
 
14
  public function __construct() {
19
  }
20
 
21
  public function init() {
22
+ if ( is_active_widget(false, false, $this->id_base, true ) || get_option(self::OPTION_DISPLAY_POSITION) ) {
23
  add_filter( 'body_class', array($this, 'body_class' ) );
24
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
25
+ add_action( 'wp_footer', array( $this, 'render' ) );
26
  }
27
  }
28
 
40
  }
41
 
42
  public function widget($args, $instance) {
43
+ }
44
+
45
+ public function render() {
46
+
47
+ $position = get_option(self::OPTION_DISPLAY_POSITION);
48
+
49
+ if (!$position) {
50
+ $options = get_option('widget_ecwidfloatingshoppingcart');
51
 
52
+ if ( is_array( $options ) ) {
53
+ foreach ( $options as $key => $option ) {
54
+ if (is_array($option) && isset($option['position'])) {
55
+ $position = $option['position'];
56
+ break;
57
+ }
58
+ }
59
+ }
60
  }
61
+
62
+ if (!$position) {
63
+ return;
64
+ }
65
+ $position = in_array($position, self::$positions) ? $position : self::$default_position;
66
+
67
+ if ( ecwid_page_has_productbrowser() ) {
68
+ $cart_url = '#!/~/cart';
69
+ } else {
70
+ $cart_url = Ecwid_Store_Page::get_cart_url();
71
+ }
72
+
73
  echo '<!-- noptimize -->';
74
  echo ecwid_get_scriptjs_code();
75
  echo
76
+ <<<HTML
77
+ <div class="ecwid-float-icons position-$position" ondragstart="return false">
78
  <div class="ecwid-cart-icon off">
79
+ <a href="$cart_url" data-count="0">
80
  <svg width="20" height="26" viewBox="0 0 20 26" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="M.5 6.5v14.81c0 2.255 1.79 4.084 4 4.084h11c2.21 0 4-1.83 4-4.085V6.5H.5zM6 10.585c.552 0 1-.457 1-1.02C7 9 6.552 8.542 6 8.542S5 9 5 9.563c0 .565.448 1.022 1 1.022zm8 0c.552 0 1-.457 1-1.02 0-.565-.448-1.022-1-1.022S13 9 13 9.563c0 .565.448 1.022 1 1.022z" stroke="#439CA0"/><path d="M14.5 6h-1V4.582c0-1.97-1.57-3.575-3.5-3.575S6.5 2.61 6.5 4.582V6h-1V4.582C5.5 2.048 7.52-.014 10-.014c2.482 0 4.5 2.062 4.5 4.596V6z" fill="#439CA0"/></g></svg>
81
  <div id="ecwid-cart"><script type="text/javascript"> xMinicart("style="); </script></div>
82
  </a>
includes/widgets/class-ecwid-widget-recently-viewed.php CHANGED
@@ -16,13 +16,20 @@ 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
 
21
  function widget($args, $instance) {
22
 
23
- wp_enqueue_script('ecwid-recently-viewed-js', ECWID_PLUGIN_URL . 'js/recently-viewed.js', array('ecwid-products-list-js'), get_option('ecwid_plugin_version'));
24
- wp_enqueue_style('ecwid-products-list-css');
25
- wp_enqueue_style('ecwid-recently-viewed-css', ECWID_PLUGIN_URL . 'css/recently-viewed.css', array(), get_option('ecwid_plugin_version'));
26
  extract($args);
27
 
28
  $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title']);
@@ -116,11 +123,11 @@ HTML;
116
 
117
  $store_link_message = empty($instance['store_link_title']) ? __('You have not viewed any product yet. Open store.', 'ecwid-shopping-cart') : $instance['store_link_title'];
118
 
119
- $page_id = ecwid_get_current_store_page_id();
120
  $post = get_post($page_id);
121
 
122
  if (empty($recently_viewed->products)) {
123
- echo '<a class="show-if-empty" href="' . ecwid_get_store_page_url() . '">' . $store_link_message . '</a>';
124
  }
125
 
126
  echo $after_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']);
123
 
124
  $store_link_message = empty($instance['store_link_title']) ? __('You have not viewed any product yet. Open store.', 'ecwid-shopping-cart') : $instance['store_link_title'];
125
 
126
+ $page_id = Ecwid_Store_Page::get_current_store_page_id();
127
  $post = get_post($page_id);
128
 
129
  if (empty($recently_viewed->products)) {
130
+ echo '<a class="show-if-empty" href="' . Ecwid_Store_Page::get_store_url() . '">' . $store_link_message . '</a>';
131
  }
132
 
133
  echo $after_widget;
includes/widgets/class-ecwid-widget-store-link.php CHANGED
@@ -12,7 +12,7 @@ class Ecwid_Widget_Store_Link extends WP_Widget {
12
 
13
  echo '<div>';
14
 
15
- echo '<a href="' . ecwid_get_store_page_url() . '">' . $instance['label'] . '</a>';
16
  echo '</div>';
17
 
18
  echo $after_widget;
12
 
13
  echo '<div>';
14
 
15
+ echo '<a href="' . Ecwid_Store_Page::get_store_url() . '">' . $instance['label'] . '</a>';
16
  echo '</div>';
17
 
18
  echo $after_widget;
includes/widgets/class-ecwid-widget-vertical-categories-list.php CHANGED
@@ -30,7 +30,7 @@ class Ecwid_Widget_Vertical_Categories_List extends WP_Widget {
30
 
31
  foreach ($categories as $category) {
32
  echo '<li>';
33
- echo '<a href="' . ecwid_get_store_page_url() . $category->link . '">' . $category->name . '</a>';
34
  echo '</li>';
35
  }
36
 
30
 
31
  foreach ($categories as $category) {
32
  echo '<li>';
33
+ echo '<a href="' . Ecwid_Store_Page::get_category_url( $category->id ) . '">' . $category->name . '</a>';
34
  echo '</li>';
35
  }
36
 
js/frontend.js CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  jQuery(document).ready(function() {
2
  jQuery('.ecwid-store-with-categories a').click(function() {jQuery(':focus').blur()});
3
  })
1
+ window.ec = window.ec || {};
2
+ 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
  })
js/product-popup.js CHANGED
@@ -93,7 +93,6 @@ jQuery(document).ready(function() {
93
 
94
  if (tinymce.activeEditor && !tinymce.activeEditor.isHidden()) {
95
  tinymce.activeEditor.execCommand('mceInsertContent', false, shortcode);
96
- tinymce.activeEditor.execCommand('mceSetContent', false, tinymce.activeEditor.getBody().innerHTML);
97
  } else {
98
 
99
  getCursorPosition = function(el) {
93
 
94
  if (tinymce.activeEditor && !tinymce.activeEditor.isHidden()) {
95
  tinymce.activeEditor.execCommand('mceInsertContent', false, shortcode);
 
96
  } else {
97
 
98
  getCursorPosition = function(el) {
js/products-list.js CHANGED
@@ -107,6 +107,15 @@ jQuery.widget('ecwid.productsList', {
107
  var container = jQuery('.'+ this._getProductClass(product.id), this.el);
108
 
109
  if (product.link != '') {
 
 
 
 
 
 
 
 
 
110
  jQuery('a', container)
111
  .attr('href', product.link)
112
  .attr('title', product.name);
107
  var container = jQuery('.'+ this._getProductClass(product.id), this.el);
108
 
109
  if (product.link != '') {
110
+
111
+ if ( window.ec && window.ec.config && window.ec.config.baseUrl ) {
112
+ var match = product.link.match(/([^-^\/]*)-p([0-9]*)$/);
113
+ if (match && match.length == 3) {
114
+ product.link = '#!/' + match[1] + '/p/' + match[2];
115
+ }
116
+ }
117
+
118
+ console.log(product.link);
119
  jQuery('a', container)
120
  .attr('href', product.link)
121
  .attr('title', product.name);
languages/ecwid-shopping-cart-ru_RU.mo CHANGED
Binary file
languages/ecwid-shopping-cart-ru_RU.po CHANGED
@@ -843,4 +843,16 @@ msgid "To enable this feature, the plugin needs a permission to read your store
843
  msgstr "Чтобы включить интеграцию с поиском, нужно дать плагину доступ до данных товаров в магазине."
844
 
845
  msgid "Provide access."
846
- msgstr "Перейдите по этой ссылке, чтобы предоставить доступ."
 
 
 
 
 
 
 
 
 
 
 
 
843
  msgstr "Чтобы включить интеграцию с поиском, нужно дать плагину доступ до данных товаров в магазине."
844
 
845
  msgid "Provide access."
846
+ msgstr "Перейдите по этой ссылке, чтобы предоставить доступ."
847
+
848
+ msgid "SEO friendly clean URLs"
849
+ msgstr "SEO URLs"
850
+
851
+ msgid "This enables new clean URLs format in your store. The new urls do not contain hash sign ('#'), so they look nicer and are better indexed by Google."
852
+ msgstr "Включает новый \"чистый\" формат ссылок на товары и категории в магазине. Новые ссылки не содержат символа \"#\" и лучше индексируются поисковыми системами."
853
+
854
+ msgid "Note: the new URLs will be automatically enabled for every store in one of upcoming updates so please make sure to check how the new URLs work in your store and <a %s>let us know</a> if you face any trouble with them"
855
+ msgstr "Новые SEO URLs магазина будут включены по умолчанию в одной из будущих версий плагина. Поэтому мы рекомендуем вам включить эту опцию и попробовать SEO URLs на своём сайте. Если вы заметите какие-либо проблемы, пожалуйста, <a %s>дайте нам знать</a>, мы поможем."
856
+
857
+ msgid "To enable clean URLs in your store, you will need to enable pretty permalinks in your WordPress site settings. Navigate to <a%s>Settings->Permalink</a> and enable the \"Post name\" permalink type."
858
+ msgstr "Чтобы включить SEO URLs в магазине, вам потребуется для начала включить улучшенную структуру постоянных ссылок в настройках Wordpress. Для этого в меню \"<a%s>Настройки -> Постоянные ссылки</a>\" выберите тип ссылок \"Название записи\"."
lib/ecwid_api_v3.php CHANGED
@@ -21,12 +21,14 @@ class Ecwid_Api_V3
21
  $this->_products_api_url = $this->_api_url . $this->store_id . '/products';
22
  }
23
 
24
- public function is_api_available()
25
  {
26
  $token = $this->_load_token();
27
  if ( $token ) {
28
  return true;
29
  }
 
 
30
  }
31
 
32
  public static function save_token($token)
@@ -45,6 +47,20 @@ class Ecwid_Api_V3
45
  if (array_key_exists('parent', $input_params)) {
46
  $params['parent'] = $input_params['parent'];
47
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  $result = EcwidPlatform::fetch_url(
50
  $this->build_request_url(
@@ -59,7 +75,7 @@ class Ecwid_Api_V3
59
 
60
  $result = json_decode($result['data']);
61
 
62
- return $result->items;
63
  }
64
 
65
  public function get_category($categoryId)
@@ -70,6 +86,15 @@ class Ecwid_Api_V3
70
 
71
  $params = array('token');
72
 
 
 
 
 
 
 
 
 
 
73
  $result = EcwidPlatform::fetch_url(
74
  $this->build_request_url(
75
  $this->_categories_api_url . '/' . $categoryId,
@@ -86,20 +111,58 @@ class Ecwid_Api_V3
86
  return $result;
87
  }
88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  public function search_products($input_params) {
90
  $params = array('token');
91
- $passthru = array( 'updatedFrom', 'offset', 'limit', 'sortBy', 'keyword' );
92
  foreach ($passthru as $name) {
93
  if ( array_key_exists( $name, $input_params ) ) {
94
  $params[$name] = $input_params[$name];
95
  }
96
  }
 
 
 
 
 
 
 
 
 
97
  $result = EcwidPlatform::fetch_url(
98
  $this->build_request_url(
99
  $this->_products_api_url,
100
  $params
101
  )
102
  );
 
103
  if ($result['code'] != '200') {
104
  return false;
105
  }
@@ -276,7 +339,7 @@ class Ecwid_Api_V3
276
  }
277
  $admin_name = "$admin_first $admin_last";
278
  $admin_nickname = $current_user->display_name;
279
- $store_url = ecwid_get_store_page_url();
280
  $site_name = get_bloginfo('name');
281
  $site_email = get_option('admin_email');
282
  $timezone = get_option('timezone_string', 'UTC+0');
21
  $this->_products_api_url = $this->_api_url . $this->store_id . '/products';
22
  }
23
 
24
+ public function is_available()
25
  {
26
  $token = $this->_load_token();
27
  if ( $token ) {
28
  return true;
29
  }
30
+
31
+ return false;
32
  }
33
 
34
  public static function save_token($token)
47
  if (array_key_exists('parent', $input_params)) {
48
  $params['parent'] = $input_params['parent'];
49
  }
50
+ $passthru = array( 'offset', 'limit', 'parent', 'baseUrl', 'cleanUrls' );
51
+ foreach ($passthru as $name) {
52
+ if ( array_key_exists( $name, $input_params ) ) {
53
+ $params[$name] = $input_params[$name];
54
+ }
55
+ }
56
+
57
+ if ( !isset( $params['baseUrl'] ) ) {
58
+ $params['baseUrl'] = Ecwid_Store_Page::get_store_url();
59
+ }
60
+
61
+ if ( Ecwid_Seo_Links::is_enabled() ) {
62
+ $params['cleanUrls'] = 'true';
63
+ }
64
 
65
  $result = EcwidPlatform::fetch_url(
66
  $this->build_request_url(
75
 
76
  $result = json_decode($result['data']);
77
 
78
+ return $result;
79
  }
80
 
81
  public function get_category($categoryId)
86
 
87
  $params = array('token');
88
 
89
+
90
+ if ( !isset( $params['baseUrl'] ) ) {
91
+ $params['baseUrl'] = Ecwid_Store_Page::get_store_url();
92
+ }
93
+
94
+ if ( Ecwid_Seo_Links::is_enabled() ) {
95
+ $params['cleanUrls'] = 'true';
96
+ }
97
+
98
  $result = EcwidPlatform::fetch_url(
99
  $this->build_request_url(
100
  $this->_categories_api_url . '/' . $categoryId,
111
  return $result;
112
  }
113
 
114
+ public function get_product( $product_id ) {
115
+ $params = array('token');
116
+
117
+ if ( !isset( $params['baseUrl'] ) ) {
118
+ $params['baseUrl'] = Ecwid_Store_Page::get_store_url();
119
+ }
120
+
121
+ if ( Ecwid_Seo_Links::is_enabled() ) {
122
+ $params['cleanUrls'] = 'true';
123
+ }
124
+
125
+ $result = EcwidPlatform::fetch_url(
126
+ $this->build_request_url(
127
+ $this->_products_api_url . '/' . $product_id,
128
+ $params
129
+ )
130
+ );
131
+
132
+
133
+ if ($result['code'] != '200') {
134
+ return false;
135
+ }
136
+
137
+ $result = json_decode($result['data']);
138
+
139
+ return $result;
140
+ }
141
+
142
  public function search_products($input_params) {
143
  $params = array('token');
144
+ $passthru = array( 'updatedFrom', 'offset', 'limit', 'sortBy', 'keyword', 'baseUrl', 'cleanUrls' );
145
  foreach ($passthru as $name) {
146
  if ( array_key_exists( $name, $input_params ) ) {
147
  $params[$name] = $input_params[$name];
148
  }
149
  }
150
+
151
+ if ( !isset( $params['baseUrl'] ) ) {
152
+ $params['baseUrl'] = Ecwid_Store_Page::get_store_url();
153
+ }
154
+
155
+ if ( Ecwid_Seo_Links::is_enabled() ) {
156
+ $params['cleanUrls'] = 'true';
157
+ }
158
+
159
  $result = EcwidPlatform::fetch_url(
160
  $this->build_request_url(
161
  $this->_products_api_url,
162
  $params
163
  )
164
  );
165
+
166
  if ($result['code'] != '200') {
167
  return false;
168
  }
339
  }
340
  $admin_name = "$admin_first $admin_last";
341
  $admin_nickname = $current_user->display_name;
342
+ $store_url = Ecwid_Store_Page::get_store_url();
343
  $site_name = get_bloginfo('name');
344
  $site_email = get_option('admin_email');
345
  $timezone = get_option('timezone_string', 'UTC+0');
lib/ecwid_catalog.php CHANGED
@@ -212,7 +212,7 @@ class EcwidCatalog
212
  {
213
  foreach ($categories as $category)
214
  {
215
- $category_url = $this->get_category_url($category);
216
 
217
  $category_name = $category["name"];
218
  $return .= $this->_l('<div class="ecwid_catalog_category_name">', 1);
@@ -226,7 +226,7 @@ class EcwidCatalog
226
  foreach ($products as $product)
227
  {
228
 
229
- $product_url = $this->get_product_url($product);
230
 
231
  $product_name = $product['name'];
232
  $product_price = $product['price'] . ' ' . $profile['currency'];
212
  {
213
  foreach ($categories as $category)
214
  {
215
+ $category_url = Ecwid_Store_Page::get_category_url( $category['id'] );
216
 
217
  $category_name = $category["name"];
218
  $return .= $this->_l('<div class="ecwid_catalog_category_name">', 1);
226
  foreach ($products as $product)
227
  {
228
 
229
+ $product_url = Ecwid_Store_Page::get_product_url( $product['id'] );
230
 
231
  $product_name = $product['name'];
232
  $product_price = $product['price'] . ' ' . $profile['currency'];
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.7
6
- Stable tag: 4.9.4
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,16 @@ 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
  = 4.9.4 =
153
  - **The new search widget is now enabled for every site.** We released the new search widget in the version 4.2 — it is mobile friendly and looks great with any wordpress ecommerce theme. We made it possible to turn on/off the new widget temporarily to make sure every site would have time to try it before it’s enabled for everyone. Now it’s enabled. If you have it enabled previously, nothing will change for you — your search widget is already updated. If you have the old search widget displayed on your site, this update will replace it with the new one. Please let us know if you have any trouble with the new widget.
154
  - **Fixed a minor issue with displaying store control panel on the Ecwid Dashboard page in Wordpress admin backend**. The control panel previously might be displayed with a horizontal scrolling. We fixed that — it should look 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.7
6
+ Stable tag: 5.0
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.0 =
153
+ - **SEO friendly clean URLs.** This is major new feature that we recommend everyone to enable. We made store pages URLs clean and SEO friendly. The new URLs do not contain hash sign ("#"), which makes your store better indexed by Google. There are less extra characters like '/', '~' or'!', so the page address looks cleaner. As previously, the new product and category pages URLs include product/category titles to make them easily readable both for Google and for your customers. Of course, no page refresh happens when the customer browses your store: the store pages with new URLs work without page reload, as it's been always worked in Ecwid. So, you have your quickly loading store pages with new SEO friendly URLs. To enable the new URLs, navigate to the Ecwid plugin Advanced settings and tick the "SEO friendly URLs" checkbox. Note: the old URLs format is supported as well, so all your existing links will continue to work fine.
154
+
155
+ - **An improvement for the floating cart sidebar widget.** Now, when you add the widget to any sidebar, the widget will displayed on every site page regardless of whether the sidebar is available on that page or not. This makes it easier for your customer to access their shopping cart and check out.
156
+
157
+ - **A few fixes for the integrated search.** Recently we added a new feature that integrates your site search with your store products to list them when your customers use the site's general post/page search. We continue improving it and fixing issues you are reporting. Thank you!
158
+
159
+ - **A few improvements and fixes for the "Add product" button in the WordPress editor** to make it easier for your to add your store products to your site pages.
160
+
161
+
162
  = 4.9.4 =
163
  - **The new search widget is now enabled for every site.** We released the new search widget in the version 4.2 — it is mobile friendly and looks great with any wordpress ecommerce theme. We made it possible to turn on/off the new widget temporarily to make sure every site would have time to try it before it’s enabled for everyone. Now it’s enabled. If you have it enabled previously, nothing will change for you — your search widget is already updated. If you have the old search widget displayed on your site, this update will replace it with the new one. Please let us know if you have any trouble with the new widget.
164
  - **Fixed a minor issue with displaying store control panel on the Ecwid Dashboard page in Wordpress admin backend**. The control panel previously might be displayed with a horizontal scrolling. We fixed that — it should look fine now.
templates/advanced-settings.php CHANGED
@@ -8,6 +8,46 @@
8
  <input type="hidden" name="settings_section" value="advanced" />
9
 
10
  <fieldset>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  <?php if (get_option('ecwid_hide_appearance_menu') != 'Y'): ?>
13
  <div class="pure-control-group bottom-border">
@@ -135,44 +175,44 @@
135
  <div class="note">
136
  <?php echo sprintf(
137
  __('The new category menu looks better and is more mobile-friendly. If you haven\'t yet added category menu to your store page, you can do that in the <a %s>store page editor</a> (enable the "Show categories" option)', 'ecwid-shopping-cart'),
138
- 'href="post.php?post=' . ecwid_get_current_store_page_id() . '&action=edit&show-ecwid=true"'
139
  ); ?>
140
  </div>
141
  </div>
142
  </div>
143
 
144
- <hr />
145
-
146
- <div class="pure-control-group checkbox">
147
- <div class="label">
148
- <label for="<?php echo Ecwid_Products::OPTION_ENABLED; ?>">
149
-
150
- <input
151
- id="<?php echo Ecwid_Products::OPTION_ENABLED; ?>"
152
- name="<?php echo Ecwid_Products::OPTION_ENABLED; ?>"
153
- type="checkbox"
154
- <?php if ( Ecwid_Products::is_enabled() ): ?>
155
- checked="checked"
156
- <?php endif; ?>
157
- value="Y"
158
- <?php if ( !Ecwid_Products::is_feature_available() ): ?>
159
- disabled="disabled"
160
- <?php endif; ?>
161
- />
162
- <?php _e('Integration with search on your site <sup>beta</sup>', 'ecwid-shopping-cart'); ?>
163
- </label>
164
-
165
- <div class="note">
166
- <?php _e( 'Ecwid stores your products data in a secure cloud storage. The product pages are displayed on the fly when a customer browses your store. So, basically, the products are not stored on the site, that\'s why the site search doesn\'t find product pages while looking through site pages and posts. This option enables a local storage mode: the products will be stored both in the cloud and on your site. The site search results will list product pages as well as regular pages/posts of your site.', 'ecwid-shopping-cart' ); ?>
167
- </div>
168
- </div>
169
- </div>
170
-
171
- <?php ecwid_sync_do_page(); ?>
172
-
173
- <div class="note grayed-links">
174
- <?php echo sprintf(__('Please note this functionality is in beta. So if you run into difficulties or find problems with it, please <a %s>let us know</a>.', 'ecwid-shopping-cart'), ' target="_blank" href="' . __('https://support.ecwid.com/hc/en-us/requests/new', 'ecwid-shopping-cart') . '"'); ?>
175
- </div>
176
 
177
  </fieldset>
178
 
8
  <input type="hidden" name="settings_section" value="advanced" />
9
 
10
  <fieldset>
11
+ <?php if (ecwid_migrations_is_original_plugin_version_older_than( '5' ) ): ?>
12
+
13
+ <div class="pure-control-group checkbox">
14
+ <div class="label">
15
+ <label for="<?php echo Ecwid_Seo_Links::OPTION_ENABLED; ?>">
16
+
17
+ <input
18
+ id="<?php echo Ecwid_Seo_Links::OPTION_ENABLED; ?>"
19
+ name="<?php echo Ecwid_Seo_Links::OPTION_ENABLED; ?>"
20
+ type="checkbox"
21
+ <?php if ( Ecwid_Seo_Links::is_enabled() ): ?>
22
+ checked="checked"
23
+ <?php endif; ?>
24
+ value="Y"
25
+ <?php if ( !Ecwid_Seo_Links::is_feature_available() ): ?>
26
+ disabled="disabled"
27
+ <?php endif; ?>
28
+ />
29
+ <?php _e('SEO friendly clean URLs', 'ecwid-shopping-cart'); ?>
30
+ </label>
31
+
32
+ <?php if ( Ecwid_Seo_Links::is_feature_available() ): ?>
33
+ <div class="note">
34
+ <?php _e( 'This enables new clean URLs format in your store. The new urls do not contain hash sign (\'#\'), so they look nicer and are better indexed by Google.', 'ecwid-shopping-cart' ); ?>
35
+ </div>
36
+ <?php else: ?>
37
+ <div class="note">
38
+ <?php printf( __( 'To enable clean URLs in your store, you will need to enable pretty permalinks in your WordPress site settings. Navigate to <a%s>Settings->Permalink</a> and enable the "Post name" permalink type.', 'ecwid-shopping-cart' ), ' href="' . admin_url( 'options-permalink.php' ) . '"'); ?>
39
+ </div>
40
+ <?php endif; ?>
41
+
42
+
43
+ <div class="note grayed-links">
44
+ <?php echo sprintf(__('Note: the new URLs will be automatically enabled for every store in one of upcoming updates so please make sure to check how the new URLs work in your store and <a %s>let us know</a> if you face any trouble with them', 'ecwid-shopping-cart'), ' target="_blank" href="' . __('https://support.ecwid.com/hc/en-us/requests/new', 'ecwid-shopping-cart') . '"'); ?>
45
+ </div>
46
+ </div>
47
+ </div>
48
+
49
+ <hr />
50
+ <?php endif; ?>
51
 
52
  <?php if (get_option('ecwid_hide_appearance_menu') != 'Y'): ?>
53
  <div class="pure-control-group bottom-border">
175
  <div class="note">
176
  <?php echo sprintf(
177
  __('The new category menu looks better and is more mobile-friendly. If you haven\'t yet added category menu to your store page, you can do that in the <a %s>store page editor</a> (enable the "Show categories" option)', 'ecwid-shopping-cart'),
178
+ 'href="post.php?post=' . Ecwid_Store_Page::get_current_store_page_id() . '&action=edit&show-ecwid=true"'
179
  ); ?>
180
  </div>
181
  </div>
182
  </div>
183
 
184
+ <hr />
185
+
186
+ <div class="pure-control-group checkbox">
187
+ <div class="label">
188
+ <label for="<?php echo Ecwid_Products::OPTION_ENABLED; ?>">
189
+
190
+ <input
191
+ id="<?php echo Ecwid_Products::OPTION_ENABLED; ?>"
192
+ name="<?php echo Ecwid_Products::OPTION_ENABLED; ?>"
193
+ type="checkbox"
194
+ <?php if ( Ecwid_Products::is_enabled() ): ?>
195
+ checked="checked"
196
+ <?php endif; ?>
197
+ value="Y"
198
+ <?php if ( !Ecwid_Products::is_feature_available() ): ?>
199
+ disabled="disabled"
200
+ <?php endif; ?>
201
+ />
202
+ <?php _e('Integration with search on your site <sup>beta</sup>', 'ecwid-shopping-cart'); ?>
203
+ </label>
204
+
205
+ <div class="note">
206
+ <?php _e( 'Ecwid stores your products data in a secure cloud storage. The product pages are displayed on the fly when a customer browses your store. So, basically, the products are not stored on the site, that\'s why the site search doesn\'t find product pages while looking through site pages and posts. This option enables a local storage mode: the products will be stored both in the cloud and on your site. The site search results will list product pages as well as regular pages/posts of your site.', 'ecwid-shopping-cart' ); ?>
207
+ </div>
208
+ </div>
209
+ </div>
210
+
211
+ <?php ecwid_sync_do_page(); ?>
212
+
213
+ <div class="note grayed-links">
214
+ <?php echo sprintf(__('Please note this functionality is in beta. So if you run into difficulties or find problems with it, please <a %s>let us know</a>.', 'ecwid-shopping-cart'), ' target="_blank" href="' . __('https://support.ecwid.com/hc/en-us/requests/new', 'ecwid-shopping-cart') . '"'); ?>
215
+ </div>
216
 
217
  </fieldset>
218
 
templates/dashboard.php CHANGED
@@ -53,7 +53,7 @@ if ($message) {
53
 
54
  <ul class="greeting-links">
55
  <li>
56
- <a target="_blank" href="<?php echo ecwid_get_store_page_url(); ?>"><?php _e('Visit storefront', 'ecwid-shopping-cart'); ?></a>
57
  </li>
58
  <li>
59
  <a target="_blank" href="//my.ecwid.com/cp?source=wporg"><?php _e('Open control panel', 'ecwid-shopping-cart'); ?></a>
53
 
54
  <ul class="greeting-links">
55
  <li>
56
+ <a target="_blank" href="<?php echo Ecwid_Store_Page::get_store_url(); ?>"><?php _e('Visit storefront', 'ecwid-shopping-cart'); ?></a>
57
  </li>
58
  <li>
59
  <a target="_blank" href="//my.ecwid.com/cp?source=wporg"><?php _e('Open control panel', 'ecwid-shopping-cart'); ?></a>
templates/sync.php CHANGED
@@ -178,7 +178,7 @@ jQuery('#sync-button-slow').click(function() {
178
  <div class="sync-block" id="update-progress">
179
  <?php echo sprintf(__( 'Products synchronized: %s out of %s', 'ecwid-shopping-cart' ),
180
  '<span id="count_updated">0</span>',
181
- '<span id="total_updated">' . ($estimation['total_updated'] + $estimation['total_deleted']) . '</span>'
182
  );
183
  ?>
184
  </div>
178
  <div class="sync-block" id="update-progress">
179
  <?php echo sprintf(__( 'Products synchronized: %s out of %s', 'ecwid-shopping-cart' ),
180
  '<span id="count_updated">0</span>',
181
+ '<span id="total_updated">' . ($estimation['total_updated']) . '</span>'
182
  );
183
  ?>
184
  </div>