Ecwid Ecommerce Shopping Cart - Version 6.8.3

Version Description

  • Jul 1, 2019 =
  • Fixed scroll issues. Ecwid adjusts the browser scroll when someone navigates to product and category pages in your shop. This is to make sure a visitor will see the product pages aligned well on the page. This didn't work well on some sites we fixed that.
  • A few bug fixes in the Ecwid ecommerce blocks in Gutenberg.
  • Several other minor bug fixes and improvements.
Download this release

Release Info

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

Code changes from version 6.8.2 to 6.8.3

css/frontend.css CHANGED
@@ -79,10 +79,6 @@ html#ecwid_html body#ecwid_body .ecwid.ecwid-SingleProduct-v2.ecwid-random-produ
79
  min-height: 42px;
80
  }
81
 
82
- #static-ecwid {
83
- opacity: 0;
84
- }
85
-
86
- #dynamic-ecwid {
87
  display: none;
88
- }
79
  min-height: 42px;
80
  }
81
 
82
+ .hide-ec-dynamic-placeholder .ecwid-shopping-cart-product-browser {
 
 
 
 
83
  display: none;
84
+ }
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 Ecommerce
8
- Version: 6.8.2
9
  Author URI: https://ecwid.to/ecwid-site
10
  */
11
 
@@ -117,6 +117,7 @@ require_once ECWID_PLUGIN_DIR . 'includes/themes.php';
117
  require_once ECWID_PLUGIN_DIR . 'includes/oembed.php';
118
  require_once ECWID_PLUGIN_DIR . 'includes/widgets.php';
119
  require_once ECWID_PLUGIN_DIR . 'includes/shortcodes.php';
 
120
 
121
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-message-manager.php';
122
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-store-editor.php';
@@ -192,7 +193,12 @@ function ecwid_init_integrations()
192
  'polylang/polylang.php' => 'polylang',
193
  );
194
 
195
- if (version_compare( phpversion(), '5.4', '>=' ) && version_compare( get_bloginfo('version'), '5.0' ) < 0 ) {
 
 
 
 
 
196
  $integrations['gutenberg/gutenberg.php'] = 'gutenberg';
197
  }
198
 
@@ -437,7 +443,7 @@ function ecwid_enqueue_frontend() {
437
 
438
  function ecwid_print_inline_js_config() {
439
 
440
- echo '<script type="text/javascript">';
441
 
442
  $js = <<<HTML
443
  window.ec = window.ec || Object();
@@ -1352,28 +1358,6 @@ function ecwid_get_scriptjs_params( $force_lang = null ) {
1352
  $store_id = get_ecwid_store_id();
1353
  $force_lang_str = !empty( $force_lang ) ? "&lang=$force_lang" : '';
1354
  $params = '&data_platform=wporg' . $force_lang_str;
1355
- if ( Ecwid_Products::is_enabled() ) {
1356
- $params .= '&data_sync_products=1';
1357
- }
1358
-
1359
- if (is_active_widget(false, false, 'ecwidrandomproduct')) {
1360
- $params .= '&data_rpw=1';
1361
- }
1362
-
1363
- if ( Ecwid_Api_V3::get_api_status() == Ecwid_Api_V3::API_STATUS_ERROR_TLS ) {
1364
- $params .= '&data_api_disabled_tls=1';
1365
- }
1366
-
1367
-
1368
- if ( Ecwid_Api_V3::get_api_status() == Ecwid_Api_V3::API_STATUS_ERROR_OTHER ) {
1369
- $params .= '&data_api_disabled=1';
1370
- }
1371
- if (version_compare( phpversion(), '5.6', '>=' ) ) {
1372
- require_once ECWID_PLUGIN_DIR . '/includes/importer/importer.php';
1373
- if ( class_exists( 'Ecwid_Importer' ) && get_option( Ecwid_Importer::OPTION_WOO_CATALOG_IMPORTED ) ) {
1374
- $params .= '&data_imported=1';
1375
- }
1376
- }
1377
 
1378
  if ( Ecwid_Static_Page::is_enabled_static_home_page() ) {
1379
  $params .= '&data_static_home=1';
@@ -1594,7 +1578,7 @@ function ecwid_store_activate() {
1594
  $shortcode = Ecwid_Shortcode_Base::get_current_store_shortcode_name();
1595
 
1596
  $content = <<<EOT
1597
- [$shortcode widgets="productbrowser" default_category_id=""]
1598
  EOT;
1599
 
1600
  $content = <<<EOT
@@ -1902,7 +1886,7 @@ function ecwid_get_update_params_options() {
1902
  '',
1903
  'Y'
1904
  )
1905
- )
1906
  );
1907
 
1908
  return $options;
@@ -1937,7 +1921,11 @@ function ecwid_update_plugin_params()
1937
  $options4update = array();
1938
 
1939
  foreach ( $options as $key => $option ) {
1940
- $options4update[$key] = @$_POST['option'][$key];
 
 
 
 
1941
  }
1942
 
1943
  foreach ($options4update as $name => $value) {
@@ -2226,53 +2214,6 @@ function ecwid_create_store() {
2226
  }
2227
  }
2228
 
2229
- function ecwid_general_settings_do_page() {
2230
-
2231
- return;
2232
- $store_id = get_option( 'ecwid_store_id' );
2233
-
2234
- $connection_error = isset( $_GET['connection_error'] );
2235
-
2236
- if ( ecwid_is_demo_store() && !Ecwid_Config::overrides_token() ) {
2237
- $no_oauth = @$_GET['oauth'] == 'no';
2238
-
2239
- $there_was_oauth_error = isset( $connection_error ) && $no_oauth;
2240
-
2241
- $no_reg_wl = Ecwid_Config::is_no_reg_wl();
2242
-
2243
- global $current_user;
2244
- $api = new Ecwid_Api_V3();
2245
-
2246
- if ( $there_was_oauth_error || $no_reg_wl || $api->does_store_exist( $current_user->user_email ) ) {
2247
- require_once ECWID_PLUGIN_DIR . 'templates/connect.php';
2248
- } else {
2249
- $register = ! $connection_error && ! isset( $_GET['connect'] );
2250
-
2251
- require_once( ECWID_PLUGIN_DIR . '/templates/landing.php' );
2252
- }
2253
- } else {
2254
- global $ecwid_oauth;
2255
-
2256
-
2257
- if ( Ecwid_Admin::disable_dashboard() ) {
2258
- require_once ECWID_PLUGIN_DIR . 'templates/dashboard.php';
2259
- } else if ( !$ecwid_oauth->has_scope( 'allow_sso' ) && !isset($_GET['reconnect']) ) {
2260
- if ( ecwid_test_oauth(true) ) {
2261
- require_once ECWID_PLUGIN_DIR . 'templates/reconnect-sso.php';
2262
- } else {
2263
- require_once ECWID_PLUGIN_DIR . 'templates/dashboard.php';
2264
- }
2265
- } else {
2266
- if ($connection_error || isset($_GET['reconnect'])) {
2267
- require_once ECWID_PLUGIN_DIR . 'templates/reconnect-sso.php';
2268
- } else {
2269
- ecwid_admin_do_page( 'dashboard' );
2270
- }
2271
- }
2272
- }
2273
- }
2274
-
2275
-
2276
  add_action('admin_post_ecwid-do-sso', 'ecwid_do_sso_redirect');
2277
  function ecwid_do_sso_redirect() {
2278
 
@@ -3065,7 +3006,7 @@ function ecwid_should_display_escaped_fragment_catalog()
3065
 
3066
  function ecwid_get_default_pb_size() {
3067
  return array(
3068
- 'grid_rows' => 10,
3069
  'grid_columns' => 3,
3070
  'list_rows' => 60,
3071
  'table_rows' => 60
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 Ecommerce
8
+ Version: 6.8.3
9
  Author URI: https://ecwid.to/ecwid-site
10
  */
11
 
117
  require_once ECWID_PLUGIN_DIR . 'includes/oembed.php';
118
  require_once ECWID_PLUGIN_DIR . 'includes/widgets.php';
119
  require_once ECWID_PLUGIN_DIR . 'includes/shortcodes.php';
120
+ require_once ECWID_PLUGIN_DIR . 'includes/kliken.php';
121
 
122
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-message-manager.php';
123
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-store-editor.php';
193
  'polylang/polylang.php' => 'polylang',
194
  );
195
 
196
+ $old_wordpress = version_compare( get_bloginfo( 'version' ), '5.0', '<' );
197
+ $old_php = version_compare( phpversion(), '5.4', '<' );
198
+
199
+ // that integration did not work well with older php
200
+ // and it is not needed for newer wordpress since blocks are a part of its core
201
+ if ( !$old_php && $old_wordpress ) {
202
  $integrations['gutenberg/gutenberg.php'] = 'gutenberg';
203
  }
204
 
443
 
444
  function ecwid_print_inline_js_config() {
445
 
446
+ echo '<script data-cfasync="false" type="text/javascript">';
447
 
448
  $js = <<<HTML
449
  window.ec = window.ec || Object();
1358
  $store_id = get_ecwid_store_id();
1359
  $force_lang_str = !empty( $force_lang ) ? "&lang=$force_lang" : '';
1360
  $params = '&data_platform=wporg' . $force_lang_str;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1361
 
1362
  if ( Ecwid_Static_Page::is_enabled_static_home_page() ) {
1363
  $params .= '&data_static_home=1';
1578
  $shortcode = Ecwid_Shortcode_Base::get_current_store_shortcode_name();
1579
 
1580
  $content = <<<EOT
1581
+ [$shortcode widgets="productbrowser" default_category_id="0"]
1582
  EOT;
1583
 
1584
  $content = <<<EOT
1886
  '',
1887
  'Y'
1888
  )
1889
+ ),
1890
  );
1891
 
1892
  return $options;
1921
  $options4update = array();
1922
 
1923
  foreach ( $options as $key => $option ) {
1924
+ if ( $option['type'] == 'html' ) {
1925
+ $options4update[$key] = html_entity_decode( @$_POST['option'][$key] );
1926
+ } else {
1927
+ $options4update[$key] = @$_POST['option'][$key];
1928
+ }
1929
  }
1930
 
1931
  foreach ($options4update as $name => $value) {
2214
  }
2215
  }
2216
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2217
  add_action('admin_post_ecwid-do-sso', 'ecwid_do_sso_redirect');
2218
  function ecwid_do_sso_redirect() {
2219
 
3006
 
3007
  function ecwid_get_default_pb_size() {
3008
  return array(
3009
+ 'grid_rows' => 20,
3010
  'grid_columns' => 3,
3011
  'list_rows' => 60,
3012
  'table_rows' => 60
includes/class-ecwid-oauth.php CHANGED
@@ -33,12 +33,6 @@ class Ecwid_OAuth {
33
  $this->api = new Ecwid_Api_V3();
34
  }
35
 
36
- public function show_reconnect()
37
- {
38
- $ecwid_oauth = $this;
39
- require_once(ECWID_PLUGIN_DIR . 'templates/reconnect.php');
40
- }
41
-
42
  public function test_post()
43
  {
44
  $return = EcwidPlatform::http_post_request($this->get_test_post_url());
33
  $this->api = new Ecwid_Api_V3();
34
  }
35
 
 
 
 
 
 
 
36
  public function test_post()
37
  {
38
  $return = EcwidPlatform::http_post_request($this->get_test_post_url());
includes/class-ecwid-products.php CHANGED
@@ -25,6 +25,7 @@ class Ecwid_Products {
25
  $this->_status->load();
26
 
27
  add_action( 'ecwid_update_store_id', array( $this, 'reset_dates' ) );
 
28
 
29
  if ( ! self::is_enabled() ) {
30
  return;
@@ -37,7 +38,6 @@ class Ecwid_Products {
37
  add_action( 'wp_ajax_ecwid_get_post_link', array($this, 'ajax_get_post_link' ) );
38
  add_action( 'wp_ajax_nopriv_ecwid_get_post_link', array($this, 'ajax_get_post_link' ) );
39
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_frontend' ) );
40
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin' ) );
41
  add_filter( 'post_type_link', array( $this, 'replace_product_page_url_on_search' ), 10, 3 );
42
  add_action( 'template_redirect', array( $this, 'redirect_to_store_page' ) );
43
  add_action( 'ecwid_on_plugin_update', array( $this, 'on_plugin_update' ) );
25
  $this->_status->load();
26
 
27
  add_action( 'ecwid_update_store_id', array( $this, 'reset_dates' ) );
28
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin' ) );
29
 
30
  if ( ! self::is_enabled() ) {
31
  return;
38
  add_action( 'wp_ajax_ecwid_get_post_link', array($this, 'ajax_get_post_link' ) );
39
  add_action( 'wp_ajax_nopriv_ecwid_get_post_link', array($this, 'ajax_get_post_link' ) );
40
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_frontend' ) );
 
41
  add_filter( 'post_type_link', array( $this, 'replace_product_page_url_on_search' ), 10, 3 );
42
  add_action( 'template_redirect', array( $this, 'redirect_to_store_page' ) );
43
  add_action( 'ecwid_on_plugin_update', array( $this, 'on_plugin_update' ) );
includes/class-ecwid-static-page.php CHANGED
@@ -146,7 +146,7 @@ class Ecwid_Static_Page {
146
 
147
  $url = substr( $url, 0, -1 );
148
 
149
- $cache_key = $url;
150
  $cached_data = EcwidPlatform::get_from_catalog_cache( $cache_key );
151
 
152
  if ( $cached_data ) {
@@ -179,6 +179,15 @@ class Ecwid_Static_Page {
179
  return null;
180
  }
181
 
 
 
 
 
 
 
 
 
 
182
 
183
  public static function _get_data_field( $field ) {
184
  $data = self::get_data_for_current_page();
@@ -268,6 +277,10 @@ class Ecwid_Static_Page {
268
  return true;
269
  }
270
 
 
 
 
 
271
  if ( !EcwidPlatform::is_catalog_cache_trusted() ) {
272
  return false;
273
  }
146
 
147
  $url = substr( $url, 0, -1 );
148
 
149
+ $cache_key = self::_build_cache_name( $url );
150
  $cached_data = EcwidPlatform::get_from_catalog_cache( $cache_key );
151
 
152
  if ( $cached_data ) {
179
  return null;
180
  }
181
 
182
+ protected static function _build_cache_name( $key ) {
183
+ $cache_suffix = max(
184
+ EcwidPlatform::get( EcwidPlatform::CATEGORIES_CACHE_VALID_FROM ),
185
+ EcwidPlatform::get( EcwidPlatform::PRODUCTS_CACHE_VALID_FROM ),
186
+ EcwidPlatform::get( EcwidPlatform::PROFILE_CACHE_VALID_FROM )
187
+ );
188
+
189
+ return $key . $cache_suffix;
190
+ }
191
 
192
  public static function _get_data_field( $field ) {
193
  $data = self::get_data_for_current_page();
277
  return true;
278
  }
279
 
280
+ if ( array_key_exists( 'offset', $_GET ) ) {
281
+ return false;
282
+ }
283
+
284
  if ( !EcwidPlatform::is_catalog_cache_trusted() ) {
285
  return false;
286
  }
includes/class-ecwid-store-page.php CHANGED
@@ -446,6 +446,15 @@ class Ecwid_Store_Page {
446
 
447
  return $title;
448
  }
 
 
 
 
 
 
 
 
 
449
 
450
 
451
  static public function set_store_url()
@@ -495,6 +504,7 @@ add_action( 'init', array( 'Ecwid_Store_Page', 'flush_rewrites' ) );
495
  add_action( 'save_post', array( 'Ecwid_Store_Page', 'on_save_post' ) );
496
  add_action( 'wp_ajax_' . Ecwid_Store_Page::WARMUP_ACTION, array( 'Ecwid_Store_Page', 'warmup_store' ) );
497
  add_action( 'update_option_page_on_front', array( 'Ecwid_Store_Page', 'schedule_flush_rewrites' ) );
 
498
 
499
  add_action( 'wp_enqueue_scripts', array( 'Ecwid_Store_Page', 'enqueue_original_page_title' ) );
500
  add_filter( 'the_title', array( 'Ecwid_Store_Page', 'the_title' ) );
446
 
447
  return $title;
448
  }
449
+
450
+ static public function display_post_states( $states, $post )
451
+ {
452
+ if ( in_array( $post->ID, self::get_store_pages_array() ) ) {
453
+ $states[] = sprintf( __( '%s Store Page', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand() );
454
+ }
455
+
456
+ return $states;
457
+ }
458
 
459
 
460
  static public function set_store_url()
504
  add_action( 'save_post', array( 'Ecwid_Store_Page', 'on_save_post' ) );
505
  add_action( 'wp_ajax_' . Ecwid_Store_Page::WARMUP_ACTION, array( 'Ecwid_Store_Page', 'warmup_store' ) );
506
  add_action( 'update_option_page_on_front', array( 'Ecwid_Store_Page', 'schedule_flush_rewrites' ) );
507
+ add_action( 'display_post_states', array( 'Ecwid_Store_Page', 'display_post_states'), 10, 2 );
508
 
509
  add_action( 'wp_enqueue_scripts', array( 'Ecwid_Store_Page', 'enqueue_original_page_title' ) );
510
  add_filter( 'the_title', array( 'Ecwid_Store_Page', 'the_title' ) );
includes/gutenberg/class-ecwid-gutenberg-block-store.php CHANGED
@@ -66,7 +66,7 @@ class Ecwid_Gutenberg_Block_Store extends Ecwid_Gutenberg_Block_Base {
66
  $result .= ']';
67
 
68
  $result .= <<<HTML
69
- <script type="text/javascript">
70
  window.ec = window.ec || Object();
71
  window.ec.storefront = window.ec.storefront || Object();
72
  HTML;
@@ -89,28 +89,36 @@ HTML;
89
  }
90
 
91
  if ( $name == 'show_description_under_image' ) {
92
- $attribute['is_storefront_api'] = true;
93
- $value = isset( $params[$name] ) ? !$params[$name] : true;
94
 
95
  $layout = ( isset($params['product_details_layout']) ) ? $params['product_details_layout'] : null;
96
  if ( is_null( $layout ) ) {
97
  $layout = $attributes['product_details_layout']['default'];
98
  }
99
 
100
- if ( $layout == 'TWO_COLUMNS_SIDEBAR_ON_THE_LEFT' ) {
101
- $name = 'product_details_two_columns_with_left_sidebar_show_product_description_on_sidebar';
102
- } else if ( $layout == 'TWO_COLUMNS_SIDEBAR_ON_THE_RIGHT' ) {
103
- $name = 'product_details_two_columns_with_right_sidebar_show_product_description_on_sidebar';
104
- } else {
105
- unset( $attribute['is_storefront_api'] );
 
 
 
 
 
 
 
 
106
  }
107
  }
 
108
 
109
  if ( isset($attribute['is_storefront_api']) && $attribute['is_storefront_api'] ) {
110
 
111
  if ( is_null( $value ) ) {
112
  $value = $attribute['default'];
113
  }
 
114
  $profile_default = isset( $attribute['profile_default'] )
115
  ? $attribute['profile_default']
116
  : $attribute['default'];
66
  $result .= ']';
67
 
68
  $result .= <<<HTML
69
+ <script data-cfasync="false" type="text/javascript">
70
  window.ec = window.ec || Object();
71
  window.ec.storefront = window.ec.storefront || Object();
72
  HTML;
89
  }
90
 
91
  if ( $name == 'show_description_under_image' ) {
 
 
92
 
93
  $layout = ( isset($params['product_details_layout']) ) ? $params['product_details_layout'] : null;
94
  if ( is_null( $layout ) ) {
95
  $layout = $attributes['product_details_layout']['default'];
96
  }
97
 
98
+ $applicableLayouts = array( 'TWO_COLUMNS_SIDEBAR_ON_THE_LEFT', 'TWO_COLUMNS_SIDEBAR_ON_THE_RIGHT' );
99
+ if ( in_array( $layout, $applicableLayouts ) ) {
100
+ if ( $layout == 'TWO_COLUMNS_SIDEBAR_ON_THE_LEFT' ) {
101
+ $name = 'product_details_two_columns_with_left_sidebar_show_product_description_on_sidebar';
102
+ } else if ( $layout == 'TWO_COLUMNS_SIDEBAR_ON_THE_RIGHT' ) {
103
+ $name = 'product_details_two_columns_with_right_sidebar_show_product_description_on_sidebar';
104
+ }
105
+
106
+ $attribute['is_storefront_api'] = true;
107
+
108
+ $api = new Ecwid_Api_V3();
109
+ $settings = $api->get_store_profile()->designSettings;
110
+ $value = isset( $params['show_description_under_image'] ) ? !$params['show_description_under_image'] : $settings->$name;
111
+ $attribute['profile_default'] = $settings->$name;
112
  }
113
  }
114
+
115
 
116
  if ( isset($attribute['is_storefront_api']) && $attribute['is_storefront_api'] ) {
117
 
118
  if ( is_null( $value ) ) {
119
  $value = $attribute['default'];
120
  }
121
+
122
  $profile_default = isset( $attribute['profile_default'] )
123
  ? $attribute['profile_default']
124
  : $attribute['default'];
includes/integrations/class-ecwid-integration-polylang.php CHANGED
@@ -64,7 +64,7 @@ class Ecwid_Integration_Polylang
64
  return;
65
  }
66
 
67
- $js = '<script type="text/javascript">';
68
 
69
  $js .= 'window.ec = window.ec || Object();';
70
  $js .= 'window.ec.config = window.ec.config || Object();';
64
  return;
65
  }
66
 
67
+ $js = '<script data-cfasync="false" type="text/javascript">';
68
 
69
  $js .= 'window.ec = window.ec || Object();';
70
  $js .= 'window.ec.config = window.ec.config || Object();';
includes/kliken.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Google-Site-Verification' ) ) {
4
+
5
+ add_action( 'wp_head', 'ecwid_add_kliken_code' );
6
+
7
+ function ecwid_add_kliken_code() {
8
+ $api = new Ecwid_Api_V3();
9
+
10
+ $info = $api->get_starter_site_info();
11
+
12
+ if ( !$info || !isset( $info->customHeaderHtmlCode ) ) return;
13
+
14
+ $pattern = "%" .
15
+ "(<!--Kliken Google Site Verification Token Tag-->\s*" .
16
+ "<meta name='google-site-verification' content='(.*)' />\s*" .
17
+ "<!--Kliken Google Site Verification Token Tag-->)%s";
18
+
19
+
20
+ $matches = [];
21
+ if ( preg_match( $pattern, $info->customHeaderHtmlCode, $matches ) ) {
22
+ echo $matches[1];
23
+ }
24
+ }
25
+ }
includes/shortcodes/class-ecwid-shortcode-base.php CHANGED
@@ -149,6 +149,8 @@ HTML;
149
  $params = $this->_params;
150
  }
151
 
 
 
152
  $pieces = array();
153
  if ( !empty ( $params ) ) {
154
  foreach ( $params as $key => $value ) {
149
  $params = $this->_params;
150
  }
151
 
152
+ unset( $params['noHTMLCatalog'] );
153
+
154
  $pieces = array();
155
  if ( !empty ( $params ) ) {
156
  foreach ( $params as $key => $value ) {
includes/shortcodes/class-ecwid-shortcode-minicart.php CHANGED
@@ -49,6 +49,21 @@ class Ecwid_Shortcode_Minicart extends Ecwid_Shortcode_Base {
49
  return 'xMinicart';
50
  }
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  public function build_params_string($params = null) {
53
  if (!is_null($params) && array_key_exists('id', $params) && isset($params['layout']) && $params['layout'] == 'MiniAttachToProductBrowser') {
54
  unset($params['id']);
49
  return 'xMinicart';
50
  }
51
 
52
+ public function render() {
53
+
54
+ $default_render = parent::render();
55
+
56
+ if ( !isset($this->_params['layout']) || $this->_params['layout'] != 'MiniAttachToProductBrowser' ) {
57
+ return $default_render;
58
+ }
59
+
60
+ if ( Ecwid_Static_Page::is_enabled_static_home_page() && Ecwid_Static_Page::is_feature_available() ) {
61
+ $default_render .= '<style>#static-ec-store { padding-top: 40px; }</style>';
62
+ }
63
+
64
+ return $default_render;
65
+ }
66
+
67
  public function build_params_string($params = null) {
68
  if (!is_null($params) && array_key_exists('id', $params) && isset($params['layout']) && $params['layout'] == 'MiniAttachToProductBrowser') {
69
  unset($params['id']);
includes/shortcodes/class-ecwid-shortcode-productbrowser.php CHANGED
@@ -55,44 +55,45 @@ if( typeof document.body.id == 'undefined' || document.body.id === '' ) {
55
  HTML;
56
  }
57
 
 
 
58
  if ( Ecwid_Static_Page::is_enabled_static_home_page() && Ecwid_Static_Page::is_feature_available() ) {
59
  $code .= self::_get_js_switch_dynamic('static-ec-store', 'dynamic-ec-store');
 
60
  } else {
61
  $code .= self::_get_js_hide_static('#static-ec-store');
62
  }
63
 
 
 
 
64
  $static_html_code = Ecwid_Static_Page::get_html_code();
65
- $code .= '<div id="static-ec-store">' . htmlspecialchars_decode( $static_html_code ) . '</div>';
66
 
67
  $js_code = Ecwid_Static_Page::get_js_code();
68
  if( !empty( $js_code ) ) {
69
- $code .= sprintf('<script>%s</script>', $js_code);
70
  }
71
 
72
- $code .= '<div id="dynamic-ec-store">' . $default_render . '</div>';
73
-
74
-
75
  return $code;
76
  }
77
 
78
- protected function _get_js_switch_dynamic( $static_container_id, $dynamic_container_id )
79
- {
80
  return <<<HTML
81
- <script language="JavaScript">
82
  window.ec.storefront.staticPages = window.ec.storefront.staticPages || Object();
83
-
84
  ec.storefront.staticPages.staticStorefrontEnabled = true;
85
  ec.storefront.staticPages.staticContainerID = '$static_container_id';
86
  ec.storefront.staticPages.dynamicContainerID = '$dynamic_container_id';
87
  ec.storefront.staticPages.autoSwitchStaticToDynamicWhenReady = true;
88
  </script>
 
89
  HTML;
90
  }
91
 
92
- protected function _get_js_hide_static( $html_selector )
93
- {
94
  return <<<HTML
95
- <script>
96
  function createClass(name,rules){
97
  var style = document.createElement('style');
98
  style.type = 'text/css';
@@ -104,6 +105,7 @@ HTML;
104
  }
105
  createClass('$html_selector','display:none;');
106
  </script>
 
107
  HTML;
108
  }
109
 
@@ -198,22 +200,29 @@ HTML;
198
  }
199
 
200
  $input_params = array(
201
- 'categoriesPerRow' => $cats_per_row,
202
- 'views' => "grid($products_per_column_in_grid,$products_per_row_in_grid) list($products_in_list) table($products_in_table)",
203
- 'categoryView' => $default_view,
204
- 'searchView' => $search_view,
205
- 'id' => "ecwid-store-$store_id"
206
  );
207
 
 
 
 
 
 
 
 
 
 
 
208
  if ($ecwid_default_category_id) {
209
  $input_params['defaultCategoryId'] = $ecwid_default_category_id;
210
  }
211
 
212
- if (isset($shortcode_params['default_product_id'])) {
213
  $input_params['defaultProductId'] = $shortcode_params['default_product_id'];
214
  }
215
 
216
- if (isset($shortcode_params['no_html_catalog'])) {
217
  $input_params['noHTMLCatalog'] = $shortcode_params['no_html_catalog'];
218
  }
219
 
55
  HTML;
56
  }
57
 
58
+ $classname = '';
59
+
60
  if ( Ecwid_Static_Page::is_enabled_static_home_page() && Ecwid_Static_Page::is_feature_available() ) {
61
  $code .= self::_get_js_switch_dynamic('static-ec-store', 'dynamic-ec-store');
62
+ $classname = 'hide-ec-dynamic-placeholder';
63
  } else {
64
  $code .= self::_get_js_hide_static('#static-ec-store');
65
  }
66
 
67
+
68
+ $code .= '<div id="dynamic-ec-store" class="' . $classname . '">' . $default_render . '</div>' . PHP_EOL;
69
+
70
  $static_html_code = Ecwid_Static_Page::get_html_code();
71
+ $code .= '<div id="static-ec-store">' . htmlspecialchars_decode( $static_html_code ) . '</div>' . PHP_EOL;
72
 
73
  $js_code = Ecwid_Static_Page::get_js_code();
74
  if( !empty( $js_code ) ) {
75
+ $code .= sprintf('<script data-cfasync="false" type="text/javascript">%s</script>', $js_code) . PHP_EOL;
76
  }
77
 
 
 
 
78
  return $code;
79
  }
80
 
81
+ protected function _get_js_switch_dynamic( $static_container_id, $dynamic_container_id ) {
 
82
  return <<<HTML
83
+ <script data-cfasync="false" type="text/javascript">
84
  window.ec.storefront.staticPages = window.ec.storefront.staticPages || Object();
 
85
  ec.storefront.staticPages.staticStorefrontEnabled = true;
86
  ec.storefront.staticPages.staticContainerID = '$static_container_id';
87
  ec.storefront.staticPages.dynamicContainerID = '$dynamic_container_id';
88
  ec.storefront.staticPages.autoSwitchStaticToDynamicWhenReady = true;
89
  </script>
90
+
91
  HTML;
92
  }
93
 
94
+ protected function _get_js_hide_static( $html_selector ) {
 
95
  return <<<HTML
96
+ <script data-cfasync="false" type="text/javascript">
97
  function createClass(name,rules){
98
  var style = document.createElement('style');
99
  style.type = 'text/css';
105
  }
106
  createClass('$html_selector','display:none;');
107
  </script>
108
+
109
  HTML;
110
  }
111
 
200
  }
201
 
202
  $input_params = array(
203
+ 'id' => "ecwid-store-$store_id",
204
+ 'views' => "grid($products_per_column_in_grid,$products_per_row_in_grid) list($products_in_list) table($products_in_table)"
 
 
 
205
  );
206
 
207
+ if ( ecwid_is_legacy_appearance_used() ) {
208
+ $legacy_input_params = array(
209
+ 'categoriesPerRow' => $cats_per_row,
210
+ 'categoryView' => $default_view,
211
+ 'searchView' => $search_view,
212
+ );
213
+
214
+ $input_params = array_merge($input_params, $legacy_input_params);
215
+ }
216
+
217
  if ($ecwid_default_category_id) {
218
  $input_params['defaultCategoryId'] = $ecwid_default_category_id;
219
  }
220
 
221
+ if ( isset($shortcode_params['default_product_id']) && $shortcode_params['default_product_id'] > 0 ) {
222
  $input_params['defaultProductId'] = $shortcode_params['default_product_id'];
223
  }
224
 
225
+ if ( isset($shortcode_params['no_html_catalog']) ) {
226
  $input_params['noHTMLCatalog'] = $shortcode_params['no_html_catalog'];
227
  }
228
 
js/frontend.js CHANGED
@@ -38,11 +38,15 @@ jQuery(document).ready(function() {
38
 
39
  ecwidShoppingCartMakeStoreLinksUseApiCall(jQuery("a[data-ecwid-page]"));
40
 
41
-
42
  if ( typeof Ecwid != 'undefined' ) {
43
  Ecwid.OnAPILoaded.add(function() {
44
- var font = window.ec.config.chameleonDefaults.font['font-family'] || '';
 
 
 
45
  document.cookie = "ec_store_chameleon_font=" + font;
 
46
  });
47
  }
 
48
  });
38
 
39
  ecwidShoppingCartMakeStoreLinksUseApiCall(jQuery("a[data-ecwid-page]"));
40
 
 
41
  if ( typeof Ecwid != 'undefined' ) {
42
  Ecwid.OnAPILoaded.add(function() {
43
+
44
+ var font = window.ec.config.chameleonDefaults
45
+ && window.ec.config.chameleonDefaults.font
46
+ && window.ec.config.chameleonDefaults.font['font-family'] || '';
47
  document.cookie = "ec_store_chameleon_font=" + font;
48
+
49
  });
50
  }
51
+
52
  });
js/gutenberg/product.jsx CHANGED
@@ -49,7 +49,7 @@ const {
49
  * registered; otherwise `undefined`.
50
  */
51
  registerBlockType( 'ecwid/product-block', {
52
- title: __( 'Product card small', 'ecwid-shopping-cart' ), // Block title.
53
  icon: EcwidIcons.product,
54
  category: 'ec-store', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
55
  attributes: {
49
  * registered; otherwise `undefined`.
50
  */
51
  registerBlockType( 'ecwid/product-block', {
52
+ title: __( 'Product Card Small', 'ecwid-shopping-cart' ), // Block title.
53
  icon: EcwidIcons.product,
54
  category: 'ec-store', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
55
  attributes: {
languages/ecwid-shopping-cart-ru_RU-ecwid-gutenberg-store.json CHANGED
@@ -41,7 +41,7 @@
41
  "Set manually": ["Выставить вручную"],
42
  "Shopping Cart Icon": ["Иконка корзины"],
43
  "Display shopping bag link and summary": ["Ссылка на корзину и количество товаров в корзине"],
44
- "Product card small": ["Карточка товара"],
45
  "Display product with a buy button": ["Товар с кнопкой \"Купить\""],
46
  "Displayed product": ["Выбранный товар"],
47
  "gutenberg-product-block\u0004Content": ["Элементы виджета"],
41
  "Set manually": ["Выставить вручную"],
42
  "Shopping Cart Icon": ["Иконка корзины"],
43
  "Display shopping bag link and summary": ["Ссылка на корзину и количество товаров в корзине"],
44
+ "Product Card Small": ["Карточка товара"],
45
  "Display product with a buy button": ["Товар с кнопкой \"Купить\""],
46
  "Displayed product": ["Выбранный товар"],
47
  "gutenberg-product-block\u0004Content": ["Элементы виджета"],
languages/ecwid-shopping-cart-ru_RU.mo CHANGED
Binary file
languages/ecwid-shopping-cart-ru_RU.po CHANGED
@@ -1690,8 +1690,11 @@ msgstr "Тема моего сайта: %s"
1690
  msgid "To improve the look and feel of your product page and manage your its appearance here, please enable the “Next-gen look and feel of the product page on the storefront” option in your store dashboard (<a href=\"admin.php?page=ec-store-admin-whatsnew\">Settings → What’s New</a>)."
1691
  msgstr "Чтобы обновить дизайн страницы товара и управлять настройками вида в редакторе, включите опцию “Обновленный внешний вид страницы товара” в панели управления магазина (<a href=\"admin.php?page=ec-store-admin-whatsnew\">Настройки → Обновления</a>)"
1692
 
1693
- msgid "To use this functionality, please enable the "Next-gen look and feel of the product list on the storefront" option in your store dashboard ("<a%s>Settings → What's New</a>")."
1694
- msgstr "Чтобы использовать этот функционал, включите опцию “Обновленный внешний вид каталога товаров на витрине” в панели управления магазина ("<a%s>Настройки → Обновления</a>")"
 
 
 
1695
 
1696
  #. Plugin URI of the plugin/theme
1697
  #. Author URI of the plugin/theme
1690
  msgid "To improve the look and feel of your product page and manage your its appearance here, please enable the “Next-gen look and feel of the product page on the storefront” option in your store dashboard (<a href=\"admin.php?page=ec-store-admin-whatsnew\">Settings → What’s New</a>)."
1691
  msgstr "Чтобы обновить дизайн страницы товара и управлять настройками вида в редакторе, включите опцию “Обновленный внешний вид страницы товара” в панели управления магазина (<a href=\"admin.php?page=ec-store-admin-whatsnew\">Настройки → Обновления</a>)"
1692
 
1693
+ msgid "To use this functionality, please enable the Next-gen look and feel of the product list on the storefront option in your store dashboard (<a%s>Settings → What's New</a>)."
1694
+ msgstr "Чтобы использовать этот функционал, включите опцию “Обновленный внешний вид каталога товаров на витрине” в панели управления магазина (<a%s>Настройки → Обновления</a>)"
1695
+
1696
+ msgid "%s Store Page"
1697
+ msgstr "Страница %s-магазина"
1698
 
1699
  #. Plugin URI of the plugin/theme
1700
  #. Author URI of the plugin/theme
lib/ecwid_api_v3.php CHANGED
@@ -39,15 +39,23 @@ class Ecwid_Api_V3
39
 
40
  protected static $profile = null;
41
 
 
 
 
 
 
 
 
42
  public function __construct() {
43
 
44
  $this->store_id = EcwidPlatform::get_store_id();
45
  $this->_api_url = 'https://' . Ecwid_Config::get_api_domain() . '/api/v3/';
46
  $this->_stores_api_url = $this->_api_url . 'stores';
47
-
48
  $this->_categories_api_url = $this->_api_url . $this->store_id . '/categories';
49
  $this->_products_api_url = $this->_api_url . $this->store_id . '/products';
50
  $this->_profile_api_url = $this->_api_url . $this->store_id . '/profile';
 
51
 
52
  add_option( self::OPTION_API_STATUS, self::API_STATUS_UNDEFINED );
53
  }
@@ -552,8 +560,7 @@ class Ecwid_Api_V3
552
 
553
  return $profile;
554
  }
555
-
556
-
557
  public function update_store_profile( $params ) {
558
  $request_params = array(
559
  'token'
@@ -883,6 +890,25 @@ class Ecwid_Api_V3
883
  return $result;
884
  }
885
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
886
  protected function _do_post( $url, $data, $raw = false ) {
887
  $result = wp_remote_post( $url,
888
  array(
39
 
40
  protected static $profile = null;
41
 
42
+ protected $_api_url;
43
+ protected $_stores_api_url;
44
+ protected $_categories_api_url;
45
+ protected $_products_api_url;
46
+ protected $_profile_api_url;
47
+ protected $_starter_site_api_url;
48
+
49
  public function __construct() {
50
 
51
  $this->store_id = EcwidPlatform::get_store_id();
52
  $this->_api_url = 'https://' . Ecwid_Config::get_api_domain() . '/api/v3/';
53
  $this->_stores_api_url = $this->_api_url . 'stores';
54
+
55
  $this->_categories_api_url = $this->_api_url . $this->store_id . '/categories';
56
  $this->_products_api_url = $this->_api_url . $this->store_id . '/products';
57
  $this->_profile_api_url = $this->_api_url . $this->store_id . '/profile';
58
+ $this->_starter_site_api_url = $this->_api_url . $this->store_id . '/startersite';
59
 
60
  add_option( self::OPTION_API_STATUS, self::API_STATUS_UNDEFINED );
61
  }
560
 
561
  return $profile;
562
  }
563
+
 
564
  public function update_store_profile( $params ) {
565
  $request_params = array(
566
  'token'
890
  return $result;
891
  }
892
 
893
+ public function get_starter_site_info() {
894
+ $request_params = array(
895
+ 'token'
896
+ );
897
+
898
+ $url = $this->build_request_url( $this->_starter_site_api_url, $request_params );
899
+
900
+ $result = EcwidPlatform::fetch_url( $url );
901
+
902
+ if ( !isset( $result['data'] ) ) {
903
+ return null;
904
+ }
905
+
906
+ $data = json_decode( $result['data'] );
907
+
908
+ return $data;
909
+
910
+ }
911
+
912
  protected function _do_post( $url, $data, $raw = false ) {
913
  $result = wp_remote_post( $url,
914
  array(
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Ecwid
3
  Tags: ecommerce, e-commerce, storefront, online store, sell
4
  Requires at least: 3.7
5
  Tested up to: 5.2
6
- Stable tag: 6.8.2
7
 
8
  Powerful, easy to use ecommerce shopping cart. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.
9
 
@@ -153,6 +153,11 @@ You can use Ecwid’s built-in import tools to copy your store products from any
153
  * [Ecwid eCommerce Forums](https://www.ecwid.com/forums/forumdisplay.php?f=19)
154
 
155
  == Changelog ==
 
 
 
 
 
156
  = 6.8.2 - Jun 14, 2019 =
157
  - Fixed an error that happened under certain site configurations
158
 
3
  Tags: ecommerce, e-commerce, storefront, online store, sell
4
  Requires at least: 3.7
5
  Tested up to: 5.2
6
+ Stable tag: 6.8.3
7
 
8
  Powerful, easy to use ecommerce shopping cart. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.
9
 
153
  * [Ecwid eCommerce Forums](https://www.ecwid.com/forums/forumdisplay.php?f=19)
154
 
155
  == Changelog ==
156
+ = 6.8.3 - Jul 1, 2019 =
157
+ - **Fixed scroll issues.** Ecwid adjusts the browser scroll when someone navigates to product and category pages in your shop. This is to make sure a visitor will see the product pages aligned well on the page. This didn't work well on some sites — we fixed that.
158
+ - A few bug fixes in the Ecwid ecommerce blocks in Gutenberg.
159
+ - Several other minor bug fixes and improvements.
160
+
161
  = 6.8.2 - Jun 14, 2019 =
162
  - Fixed an error that happened under certain site configurations
163
 
templates/admin-params.php CHANGED
@@ -20,7 +20,9 @@
20
  </select>
21
  <?php elseif ( @$option['type'] == 'string'): ?>
22
  <input type="text" name="option[<?php echo $key; ?>]" value="<?php echo get_option( $key ); ?>">
23
- <?php elseif ( @$option['values'] ): ?>
 
 
24
  <select name="option[<?php echo $key; ?>]">
25
  <?php foreach ( @$option['values'] as $value ): ?>
26
  <option value="<?php echo $value; ?>"<?php if ( $value == get_option($key)): ?> selected="selected"<?php endif; ?>><?php echo $value; ?></option>
20
  </select>
21
  <?php elseif ( @$option['type'] == 'string'): ?>
22
  <input type="text" name="option[<?php echo $key; ?>]" value="<?php echo get_option( $key ); ?>">
23
+ <?php elseif ( @$option['type'] == 'html'): ?>
24
+ <textarea name="option[<?php echo $key; ?>]" style="width:500px"><?php echo htmlentities( get_option( $key ) ); ?></textarea>
25
+ <?php elseif ( @$option['values'] ): ?>
26
  <select name="option[<?php echo $key; ?>]">
27
  <?php foreach ( @$option['values'] as $value ): ?>
28
  <option value="<?php echo $value; ?>"<?php if ( $value == get_option($key)): ?> selected="selected"<?php endif; ?>><?php echo $value; ?></option>