Version Description
- Aug 15, 2018 =
- Minor fixes and improvements.
Download this release
Release Info
Developer | Ecwid |
Plugin | Ecwid Ecommerce Shopping Cart |
Version | 6.2.2 |
Comparing to | |
See all releases |
Code changes from version 6.2.1 to 6.2.2
- ecwid-shopping-cart.php +20 -24
- includes/class-ecwid-admin-main-page.php +3 -2
- includes/class-ecwid-html-meta.php +50 -27
- includes/class-ecwid-message-manager.php +28 -7
- includes/class-ecwid-nav-menus.php +10 -4
- includes/class-ecwid-seo-links.php +31 -5
- includes/class-ecwid-store-page.php +25 -4
- includes/importer/class-ecwid-import-page.php +29 -3
- includes/importer/class-ecwid-importer-task.php +72 -16
- includes/importer/class-ecwid-importer.php +44 -26
- includes/widgets/class-ecwid-widget-floating-shopping-cart.php +1 -1
- js/importer.js +60 -22
- lib/ecwid_api_v3.php +67 -7
- readme.txt +4 -2
- templates/advanced-settings.php +2 -2
- templates/importer/import-no-token.php +0 -1
- templates/importer/import-no-token.tpl.php +1 -0
- templates/importer/woo-complete.tpl.php +1 -1
- templates/importer/woo-main.tpl.php +1 -1
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: 6.2.
|
9 |
Author URI: https://ecwid.to/ecwid-site
|
10 |
*/
|
11 |
|
@@ -321,7 +321,7 @@ function ecwid_add_deactivation_popup()
|
|
321 |
|
322 |
function ecwid_enqueue_frontend() {
|
323 |
global $ecwid_current_theme;
|
324 |
-
|
325 |
if ( $ecwid_current_theme && $ecwid_current_theme->historyjs_html4mode || get_option('ecwid_historyjs_html4mode') ) {
|
326 |
wp_enqueue_script('ecwid-historyjs-wa', ECWID_PLUGIN_URL . 'js/historywa.js');
|
327 |
}
|
@@ -667,7 +667,8 @@ function ecwid_check_version()
|
|
667 |
|
668 |
Ecwid_Config::load_from_ini();
|
669 |
|
670 |
-
|
|
|
671 |
|
672 |
do_action( 'ecwid_on_plugin_update' );
|
673 |
|
@@ -856,6 +857,7 @@ function ecwid_admin_check_api_cache()
|
|
856 |
|
857 |
function ecwid_invalidate_cache( $full_reset = false)
|
858 |
{
|
|
|
859 |
|
860 |
if ( $full_reset ) {
|
861 |
EcwidPlatform::invalidate_categories_cache_from(time());
|
@@ -1423,22 +1425,17 @@ function ecwid_wrap_shortcode_content($content, $name, $attrs)
|
|
1423 |
return apply_filters('ecwid_shortcode_content', $shortcode_content);
|
1424 |
}
|
1425 |
|
1426 |
-
function ecwid_get_scriptjs_code($force_lang = null) {
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
$params = ecwid_get_scriptjs_params( $force_lang );
|
1432 |
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
$ecwid_script_rendered = true;
|
1437 |
|
1438 |
-
|
1439 |
-
} else {
|
1440 |
-
return '';
|
1441 |
-
}
|
1442 |
}
|
1443 |
|
1444 |
function ecwid_get_scriptjs_params( $force_lang = null ) {
|
@@ -1898,9 +1895,6 @@ function ecwid_get_update_params_options() {
|
|
1898 |
'ecwid_seo_links_enabled' => array(
|
1899 |
'type' => 'bool'
|
1900 |
),
|
1901 |
-
'force_scriptjs_render' => array(
|
1902 |
-
'type' => 'bool'
|
1903 |
-
),
|
1904 |
Ecwid_Admin::OPTION_ENABLE_AUTO_MENUS => array(
|
1905 |
'values' => array(
|
1906 |
Ecwid_Admin::OPTION_ENABLE_AUTO_MENUS_ON,
|
@@ -2012,6 +2006,7 @@ function ecwid_register_admin_styles($hook_suffix) {
|
|
2012 |
|
2013 |
wp_enqueue_style('ecwid-landing-css', ECWID_PLUGIN_URL . 'css/landing_old.css', array(), get_option('ecwid_plugin_version'), 'all');
|
2014 |
} else {
|
|
|
2015 |
wp_enqueue_style('ecwid-landing-css', ECWID_PLUGIN_URL . 'css/landing.css', array(), get_option('ecwid_plugin_version'), 'all');
|
2016 |
}
|
2017 |
wp_enqueue_style('ecwid-landing-fonts', 'http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,300', array(), get_option('ecwid_plugin_version'));
|
@@ -2097,7 +2092,6 @@ function ecwid_settings_api_init() {
|
|
2097 |
|
2098 |
function ecwid_common_admin_scripts() {
|
2099 |
|
2100 |
-
ecwid_get_demo_store_id();
|
2101 |
wp_enqueue_script('ecwid-admin-js', ECWID_PLUGIN_URL . 'js/admin.js', array(), get_option('ecwid_plugin_version'));
|
2102 |
wp_enqueue_script('ecwid-modernizr-js', ECWID_PLUGIN_URL . 'js/modernizr.js', array(), get_option('ecwid_plugin_version'));
|
2103 |
|
@@ -2445,13 +2439,13 @@ function ecwid_help_do_page() {
|
|
2445 |
function ecwid_process_oauth_params() {
|
2446 |
|
2447 |
if (strtoupper($_SERVER['REQUEST_METHOD']) != 'GET' || !isset($_GET['page'])) {
|
2448 |
-
return;
|
2449 |
}
|
2450 |
|
2451 |
-
$is_dashboard = $_GET['page'] ==
|
2452 |
|
2453 |
if (!$is_dashboard) {
|
2454 |
-
return;
|
2455 |
}
|
2456 |
|
2457 |
global $ecwid_oauth;
|
@@ -2477,6 +2471,8 @@ function ecwid_process_oauth_params() {
|
|
2477 |
wp_redirect( $ecwid_oauth->get_auth_dialog_url() );
|
2478 |
}
|
2479 |
}
|
|
|
|
|
2480 |
}
|
2481 |
|
2482 |
function ecwid_admin_post_connect()
|
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: 6.2.2
|
9 |
Author URI: https://ecwid.to/ecwid-site
|
10 |
*/
|
11 |
|
321 |
|
322 |
function ecwid_enqueue_frontend() {
|
323 |
global $ecwid_current_theme;
|
324 |
+
|
325 |
if ( $ecwid_current_theme && $ecwid_current_theme->historyjs_html4mode || get_option('ecwid_historyjs_html4mode') ) {
|
326 |
wp_enqueue_script('ecwid-historyjs-wa', ECWID_PLUGIN_URL . 'js/historywa.js');
|
327 |
}
|
667 |
|
668 |
Ecwid_Config::load_from_ini();
|
669 |
|
670 |
+
// Since 6.2.x
|
671 |
+
delete_option( 'force_scriptjs_render' );
|
672 |
|
673 |
do_action( 'ecwid_on_plugin_update' );
|
674 |
|
857 |
|
858 |
function ecwid_invalidate_cache( $full_reset = false)
|
859 |
{
|
860 |
+
Ecwid_Api_V3::reset_api_status();
|
861 |
|
862 |
if ( $full_reset ) {
|
863 |
EcwidPlatform::invalidate_categories_cache_from(time());
|
1425 |
return apply_filters('ecwid_shortcode_content', $shortcode_content);
|
1426 |
}
|
1427 |
|
1428 |
+
function ecwid_get_scriptjs_code( $force_lang = null ) {
|
1429 |
+
static $code = '';
|
1430 |
+
|
1431 |
+
$store_id = get_ecwid_store_id();
|
1432 |
+
$params = ecwid_get_scriptjs_params( $force_lang );
|
|
|
1433 |
|
1434 |
+
$code = '<script data-cfasync="false" type="text/javascript" src="https://' . Ecwid_Config::get_scriptjs_domain() . '/script.js?' . $store_id . $params . '"></script>';
|
1435 |
+
$code .= ecwid_sso();
|
1436 |
+
$code .= '<script type="text/javascript">if (jQuery && jQuery.mobile) { jQuery.mobile.hashListeningEnabled = false; jQuery.mobile.pushStateEnabled=false; }</script>';
|
|
|
1437 |
|
1438 |
+
return $code;
|
|
|
|
|
|
|
1439 |
}
|
1440 |
|
1441 |
function ecwid_get_scriptjs_params( $force_lang = null ) {
|
1895 |
'ecwid_seo_links_enabled' => array(
|
1896 |
'type' => 'bool'
|
1897 |
),
|
|
|
|
|
|
|
1898 |
Ecwid_Admin::OPTION_ENABLE_AUTO_MENUS => array(
|
1899 |
'values' => array(
|
1900 |
Ecwid_Admin::OPTION_ENABLE_AUTO_MENUS_ON,
|
2006 |
|
2007 |
wp_enqueue_style('ecwid-landing-css', ECWID_PLUGIN_URL . 'css/landing_old.css', array(), get_option('ecwid_plugin_version'), 'all');
|
2008 |
} else {
|
2009 |
+
|
2010 |
wp_enqueue_style('ecwid-landing-css', ECWID_PLUGIN_URL . 'css/landing.css', array(), get_option('ecwid_plugin_version'), 'all');
|
2011 |
}
|
2012 |
wp_enqueue_style('ecwid-landing-fonts', 'http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,300', array(), get_option('ecwid_plugin_version'));
|
2092 |
|
2093 |
function ecwid_common_admin_scripts() {
|
2094 |
|
|
|
2095 |
wp_enqueue_script('ecwid-admin-js', ECWID_PLUGIN_URL . 'js/admin.js', array(), get_option('ecwid_plugin_version'));
|
2096 |
wp_enqueue_script('ecwid-modernizr-js', ECWID_PLUGIN_URL . 'js/modernizr.js', array(), get_option('ecwid_plugin_version'));
|
2097 |
|
2439 |
function ecwid_process_oauth_params() {
|
2440 |
|
2441 |
if (strtoupper($_SERVER['REQUEST_METHOD']) != 'GET' || !isset($_GET['page'])) {
|
2442 |
+
return false;
|
2443 |
}
|
2444 |
|
2445 |
+
$is_dashboard = $_GET['page'] == Ecwid_Admin::ADMIN_SLUG;
|
2446 |
|
2447 |
if (!$is_dashboard) {
|
2448 |
+
return false;
|
2449 |
}
|
2450 |
|
2451 |
global $ecwid_oauth;
|
2471 |
wp_redirect( $ecwid_oauth->get_auth_dialog_url() );
|
2472 |
}
|
2473 |
}
|
2474 |
+
|
2475 |
+
return true;
|
2476 |
}
|
2477 |
|
2478 |
function ecwid_admin_post_connect()
|
includes/class-ecwid-admin-main-page.php
CHANGED
@@ -13,8 +13,9 @@ class Ecwid_Admin_Main_Page
|
|
13 |
{
|
14 |
if ( $this->_is_forced_reconnect() ) {
|
15 |
ecwid_update_store_id(0);
|
16 |
-
|
17 |
-
|
|
|
18 |
}
|
19 |
|
20 |
$is_demo = ecwid_is_demo_store();
|
13 |
{
|
14 |
if ( $this->_is_forced_reconnect() ) {
|
15 |
ecwid_update_store_id(0);
|
16 |
+
if (! ecwid_process_oauth_params() ) {
|
17 |
+
wp_redirect( 'admin.php?page=' . Ecwid_Admin::ADMIN_SLUG );
|
18 |
+
}
|
19 |
}
|
20 |
|
21 |
$is_demo = ecwid_is_demo_store();
|
includes/class-ecwid-html-meta.php
CHANGED
@@ -2,36 +2,52 @@
|
|
2 |
|
3 |
abstract class Ecwid_HTML_Meta
|
4 |
{
|
5 |
-
|
6 |
-
protected $id;
|
7 |
-
|
8 |
-
protected function __construct($id)
|
9 |
{
|
10 |
-
$this->id = $id;
|
11 |
$this->_init();
|
12 |
}
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
public static function maybe_create()
|
15 |
{
|
16 |
$params = Ecwid_Seo_Links::maybe_extract_html_catalog_params();
|
17 |
-
|
18 |
-
if ( empty( $params ) ) return null;
|
19 |
-
|
20 |
$obj = null;
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
27 |
}
|
28 |
-
|
|
|
|
|
|
|
|
|
29 |
return $obj;
|
30 |
}
|
|
|
31 |
|
32 |
-
|
|
|
|
|
|
|
|
|
33 |
{
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
|
37 |
public function wp_head()
|
@@ -51,9 +67,9 @@ abstract class Ecwid_HTML_Meta
|
|
51 |
'site_name' => $this->_get_site_name(),
|
52 |
'image' => $this->_get_image_url()
|
53 |
);
|
54 |
-
|
55 |
$og_tags = apply_filters( 'ecwid_og_tags', $og_tags );
|
56 |
-
|
57 |
if (!empty($og_tags)) {
|
58 |
foreach ($og_tags as $tag => $value) {
|
59 |
if (!$value) continue;
|
@@ -75,9 +91,9 @@ abstract class Ecwid_HTML_Meta
|
|
75 |
'title' => $this->_get_title() . ' - ' . $this->_get_site_name(),
|
76 |
'image' => $this->_get_image_url()
|
77 |
);
|
78 |
-
|
79 |
$twitter_tags = apply_filters( 'ecwid_twitter_tags', $twitter_tags );
|
80 |
-
|
81 |
if ( !empty( $twitter_tags ) ) {
|
82 |
foreach ($twitter_tags as $tag => $value) {
|
83 |
if (!$value) continue;
|
@@ -110,7 +126,7 @@ abstract class Ecwid_HTML_Meta
|
|
110 |
abstract protected function _get_url();
|
111 |
|
112 |
abstract protected function _get_image_url();
|
113 |
-
|
114 |
// static only while ecwid_trim_description exists and meta functionality is not moved into this class
|
115 |
public static function process_raw_description( $description, $length = 0 ) {
|
116 |
$description = strip_tags( $description );
|
@@ -118,19 +134,20 @@ abstract class Ecwid_HTML_Meta
|
|
118 |
|
119 |
$description = preg_replace( '![\p{Z}\s]{1,}!u', ' ', $description );
|
120 |
$description = trim( $description, " \t\xA0\n\r" ); // Space, tab, non-breaking space, newline, carriage return
|
121 |
-
|
122 |
if ( function_exists( 'mb_substr' ) ) {
|
123 |
$description = mb_substr( $description, 0, $length ? $length : ECWID_TRIMMED_DESCRIPTION_LENGTH, 'UTF-8' );
|
124 |
} else {
|
125 |
$description = substr( $description, 0, $length ? $length : ECWID_TRIMMED_DESCRIPTION_LENGTH );
|
126 |
}
|
127 |
$description = htmlspecialchars( $description, ENT_COMPAT, 'UTF-8' );
|
128 |
-
|
129 |
return $description;
|
130 |
}
|
|
|
131 |
}
|
132 |
|
133 |
-
class Ecwid_HTML_Meta_Product extends
|
134 |
|
135 |
protected $product;
|
136 |
protected function _init()
|
@@ -160,7 +177,7 @@ class Ecwid_HTML_Meta_Product extends Ecwid_HTML_Meta {
|
|
160 |
}
|
161 |
}
|
162 |
|
163 |
-
class Ecwid_HTML_Meta_Category extends
|
164 |
|
165 |
protected $category;
|
166 |
protected function _init()
|
@@ -191,5 +208,11 @@ class Ecwid_HTML_Meta_Category extends Ecwid_HTML_Meta {
|
|
191 |
}
|
192 |
}
|
193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
|
195 |
-
add_action( '
|
2 |
|
3 |
abstract class Ecwid_HTML_Meta
|
4 |
{
|
5 |
+
protected function __construct()
|
|
|
|
|
|
|
6 |
{
|
|
|
7 |
$this->_init();
|
8 |
}
|
9 |
|
10 |
+
|
11 |
+
protected function _init()
|
12 |
+
{
|
13 |
+
add_action( 'wp_head', array( $this, 'wp_head' ) );
|
14 |
+
}
|
15 |
+
|
16 |
+
abstract public function wp_head();
|
17 |
+
|
18 |
public static function maybe_create()
|
19 |
{
|
20 |
$params = Ecwid_Seo_Links::maybe_extract_html_catalog_params();
|
21 |
+
|
|
|
|
|
22 |
$obj = null;
|
23 |
+
if ( ! empty( $params ) ) {
|
24 |
+
$obj = null;
|
25 |
+
|
26 |
+
if ( $params['mode'] == 'product' ) {
|
27 |
+
$obj = new Ecwid_HTML_Meta_Product( $params['id'] );
|
28 |
+
} else if ( $params['mode'] == 'category' ) {
|
29 |
+
$obj = new Ecwid_HTML_Meta_Category( $params['id'] );
|
30 |
+
}
|
31 |
+
|
32 |
}
|
33 |
+
|
34 |
+
if ( Ecwid_Seo_Links::is_noindex_page() ) {
|
35 |
+
$obj = new Ecwid_HTML_Meta_Noindex();
|
36 |
+
}
|
37 |
+
|
38 |
return $obj;
|
39 |
}
|
40 |
+
}
|
41 |
|
42 |
+
abstract class Ecwid_HTML_Meta_Catalog_Entry extends Ecwid_HTML_Meta {
|
43 |
+
|
44 |
+
protected $id;
|
45 |
+
|
46 |
+
protected function __construct($id)
|
47 |
{
|
48 |
+
parent::__construct();
|
49 |
+
|
50 |
+
$this->id = $id;
|
51 |
}
|
52 |
|
53 |
public function wp_head()
|
67 |
'site_name' => $this->_get_site_name(),
|
68 |
'image' => $this->_get_image_url()
|
69 |
);
|
70 |
+
|
71 |
$og_tags = apply_filters( 'ecwid_og_tags', $og_tags );
|
72 |
+
|
73 |
if (!empty($og_tags)) {
|
74 |
foreach ($og_tags as $tag => $value) {
|
75 |
if (!$value) continue;
|
91 |
'title' => $this->_get_title() . ' - ' . $this->_get_site_name(),
|
92 |
'image' => $this->_get_image_url()
|
93 |
);
|
94 |
+
|
95 |
$twitter_tags = apply_filters( 'ecwid_twitter_tags', $twitter_tags );
|
96 |
+
|
97 |
if ( !empty( $twitter_tags ) ) {
|
98 |
foreach ($twitter_tags as $tag => $value) {
|
99 |
if (!$value) continue;
|
126 |
abstract protected function _get_url();
|
127 |
|
128 |
abstract protected function _get_image_url();
|
129 |
+
|
130 |
// static only while ecwid_trim_description exists and meta functionality is not moved into this class
|
131 |
public static function process_raw_description( $description, $length = 0 ) {
|
132 |
$description = strip_tags( $description );
|
134 |
|
135 |
$description = preg_replace( '![\p{Z}\s]{1,}!u', ' ', $description );
|
136 |
$description = trim( $description, " \t\xA0\n\r" ); // Space, tab, non-breaking space, newline, carriage return
|
137 |
+
|
138 |
if ( function_exists( 'mb_substr' ) ) {
|
139 |
$description = mb_substr( $description, 0, $length ? $length : ECWID_TRIMMED_DESCRIPTION_LENGTH, 'UTF-8' );
|
140 |
} else {
|
141 |
$description = substr( $description, 0, $length ? $length : ECWID_TRIMMED_DESCRIPTION_LENGTH );
|
142 |
}
|
143 |
$description = htmlspecialchars( $description, ENT_COMPAT, 'UTF-8' );
|
144 |
+
|
145 |
return $description;
|
146 |
}
|
147 |
+
|
148 |
}
|
149 |
|
150 |
+
class Ecwid_HTML_Meta_Product extends Ecwid_HTML_Meta_Catalog_Entry {
|
151 |
|
152 |
protected $product;
|
153 |
protected function _init()
|
177 |
}
|
178 |
}
|
179 |
|
180 |
+
class Ecwid_HTML_Meta_Category extends Ecwid_HTML_Meta_Catalog_Entry {
|
181 |
|
182 |
protected $category;
|
183 |
protected function _init()
|
208 |
}
|
209 |
}
|
210 |
|
211 |
+
class Ecwid_HTML_Meta_Noindex extends Ecwid_HTML_Meta {
|
212 |
+
public function wp_head()
|
213 |
+
{
|
214 |
+
echo '<meta name="robots" content="noindex">';
|
215 |
+
}
|
216 |
+
}
|
217 |
|
218 |
+
add_action( 'wp', array( 'Ecwid_HTML_Meta', 'maybe_create' ) );
|
includes/class-ecwid-message-manager.php
CHANGED
@@ -248,20 +248,41 @@ TXT
|
|
248 |
),
|
249 |
|
250 |
'api_failed_tls' => array(
|
251 |
-
'title' => __(
|
252 |
-
|
253 |
-
|
254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
),
|
256 |
'type' => 'warning',
|
257 |
'hideable' => false
|
258 |
),
|
259 |
|
260 |
'api_failed_other' => array(
|
261 |
-
'title' => __(
|
262 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
, 'ecwid-shopping-cart' ),
|
264 |
-
Ecwid_Config::get_brand()
|
|
|
265 |
),
|
266 |
'type' => 'warning',
|
267 |
'hideable' => false
|
248 |
),
|
249 |
|
250 |
'api_failed_tls' => array(
|
251 |
+
'title' => __(
|
252 |
+
'Warning: some of your online store features are disabled. Please contact your hosting provider to resolve.',
|
253 |
+
'ecwid-shopping-cart'
|
254 |
+
),
|
255 |
+
'message' => sprintf(
|
256 |
+
__(
|
257 |
+
<<<HTML
|
258 |
+
<b>What happened:</b> This WordPress site doesn't seem to be able to connect to the %1\$s servers. Your store is working and your products can be purchased from your site, but some features are disabled, including SEO, product sidebar widgets, advanced site menu and store navigation. The %1\$s plugin tries to reach the %1\$s APIs at our servers and cannot do that because of your server misconfiguration.
|
259 |
+
<br /><br />
|
260 |
+
<b>How to fix:</b> Your server seems to be using outdated software (TLS v1.0) to communicate with the %1\$s APIs. The reason can also be a deprecated version of the CURL module. This can be fixed by your hosting provider by updating your server software to the latest version. Please send this message to your hosting provider and ask them to check it for you. If this doesn't help, please contact us at <a target="_blank" href="%2\$s">%2\$s</a>.
|
261 |
+
HTML
|
262 |
+
, 'ecwid-shopping-cart'
|
263 |
+
),
|
264 |
+
Ecwid_Config::get_brand(),
|
265 |
+
Ecwid_Config::get_contact_us_url()
|
266 |
),
|
267 |
'type' => 'warning',
|
268 |
'hideable' => false
|
269 |
),
|
270 |
|
271 |
'api_failed_other' => array(
|
272 |
+
'title' => __(
|
273 |
+
'Warning: some of your online store features are disabled. Please contact your hosting provider to resolve.',
|
274 |
+
'ecwid-shopping-cart'
|
275 |
+
),
|
276 |
+
'message' => sprintf(
|
277 |
+
__(
|
278 |
+
<<<HTML
|
279 |
+
<b>What happened:</b> This WordPress site doesn't seem to be able to connect to the %1\$s servers. Your store is working and your products can be purchased from your site, but some features are disabled, including SEO, product sidebar widgets, advanced site menu and store navigation. The %1\$s plugin tries to reach the %1\$s APIs at our servers and cannot do that as your server blocks those requests for some reason.
|
280 |
+
<br /><br />
|
281 |
+
<b>How to fix:</b> This is likely caused by your server misconfiguration and can be fixed by your hosting provider. In particular, the CURL module can be disabled in your PHP config or a firewall might block requests to our servers. Please send this message to your hosting provider and ask them to check it for you. If this doesn't help, please contact us at <a target="_blank" href="%2\$s">%2\$s</a>.
|
282 |
+
HTML
|
283 |
, 'ecwid-shopping-cart' ),
|
284 |
+
Ecwid_Config::get_brand(),
|
285 |
+
Ecwid_Config::get_contact_us_url()
|
286 |
),
|
287 |
'type' => 'warning',
|
288 |
'hideable' => false
|
includes/class-ecwid-nav-menus.php
CHANGED
@@ -266,11 +266,14 @@ class Ecwid_Nav_Menus {
|
|
266 |
|
267 |
public function nav_menu_link_attributes( $attributes, $item )
|
268 |
{
|
269 |
-
|
270 |
if ( !isset( $item->ecwid_page_type ) ) {
|
271 |
return $attributes;
|
272 |
}
|
273 |
-
|
|
|
|
|
|
|
|
|
274 |
if ( Ecwid_Store_Page::get_current_store_page_id() != get_the_ID() ) {
|
275 |
return $attributes;
|
276 |
}
|
@@ -281,6 +284,7 @@ class Ecwid_Nav_Menus {
|
|
281 |
$attributes['data-ecwid-category-id'] = $item->ecwid_category_id;
|
282 |
}
|
283 |
|
|
|
284 |
return $attributes;
|
285 |
}
|
286 |
|
@@ -335,7 +339,8 @@ class Ecwid_Nav_Menus {
|
|
335 |
'url' => 'cart',
|
336 |
'label' => __('Shopping Cart', 'ecwid-shopping-cart'),
|
337 |
'name' => 'cart',
|
338 |
-
'ecwid-page' => 'cart'
|
|
|
339 |
),
|
340 |
'ecwid-product-search' => array(
|
341 |
'list-name' => __('Product Search', 'ecwid-shopping-cart'),
|
@@ -351,7 +356,8 @@ class Ecwid_Nav_Menus {
|
|
351 |
'url' => 'accountSettings',
|
352 |
'label' => __('My Account', 'ecwid-shopping-cart'),
|
353 |
'name' => 'account',
|
354 |
-
'ecwid-page' => 'account/orders'
|
|
|
355 |
),
|
356 |
'ecwid-store' => array(
|
357 |
'list-name' => __('Store', 'ecwid-shopping-cart'),
|
266 |
|
267 |
public function nav_menu_link_attributes( $attributes, $item )
|
268 |
{
|
|
|
269 |
if ( !isset( $item->ecwid_page_type ) ) {
|
270 |
return $attributes;
|
271 |
}
|
272 |
+
|
273 |
+
if ( in_array( $item->ecwid_page_type, array( 'cart', 'account/orders' ) ) ) {
|
274 |
+
$attributes['rel'] = 'nofollow';
|
275 |
+
}
|
276 |
+
|
277 |
if ( Ecwid_Store_Page::get_current_store_page_id() != get_the_ID() ) {
|
278 |
return $attributes;
|
279 |
}
|
284 |
$attributes['data-ecwid-category-id'] = $item->ecwid_category_id;
|
285 |
}
|
286 |
|
287 |
+
|
288 |
return $attributes;
|
289 |
}
|
290 |
|
339 |
'url' => 'cart',
|
340 |
'label' => __('Shopping Cart', 'ecwid-shopping-cart'),
|
341 |
'name' => 'cart',
|
342 |
+
'ecwid-page' => 'cart',
|
343 |
+
'nofollow' => true
|
344 |
),
|
345 |
'ecwid-product-search' => array(
|
346 |
'list-name' => __('Product Search', 'ecwid-shopping-cart'),
|
356 |
'url' => 'accountSettings',
|
357 |
'label' => __('My Account', 'ecwid-shopping-cart'),
|
358 |
'name' => 'account',
|
359 |
+
'ecwid-page' => 'account/orders',
|
360 |
+
'nofollow' => true
|
361 |
),
|
362 |
'ecwid-store' => array(
|
363 |
'list-name' => __('Store', 'ecwid-shopping-cart'),
|
includes/class-ecwid-seo-links.php
CHANGED
@@ -341,7 +341,7 @@ JS;
|
|
341 |
if ( !isset( $base_urls[$page_id] ) ) {
|
342 |
$base_urls[$page_id] = array();
|
343 |
}
|
344 |
-
$base_urls[$page_id][] = urldecode(
|
345 |
}
|
346 |
|
347 |
if (
|
@@ -353,7 +353,7 @@ JS;
|
|
353 |
if ( PLL()->options['force_lang'] == 1 ) {
|
354 |
$patterns = $this->get_seo_links_patterns();
|
355 |
foreach ( $pages as $page_id ) {
|
356 |
-
$link = urldecode(
|
357 |
$language = pll_get_post_language( $page_id );
|
358 |
|
359 |
if ( !isset( $base_urls[$page_id] ) ) {
|
@@ -369,16 +369,42 @@ JS;
|
|
369 |
return $base_urls;
|
370 |
}
|
371 |
|
372 |
-
protected function _get_relative_permalink( $item_id ) {
|
373 |
$permalink = get_permalink( $item_id );
|
374 |
|
375 |
$home_url = home_url();
|
376 |
|
377 |
return substr( $permalink, strlen( $home_url ) );
|
378 |
}
|
379 |
-
|
380 |
-
|
381 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
382 |
public static function is_enabled() {
|
383 |
|
384 |
return self::is_feature_available() && get_option( self::OPTION_ENABLED );
|
341 |
if ( !isset( $base_urls[$page_id] ) ) {
|
342 |
$base_urls[$page_id] = array();
|
343 |
}
|
344 |
+
$base_urls[$page_id][] = urldecode( self::_get_relative_permalink( $page_id ) );
|
345 |
}
|
346 |
|
347 |
if (
|
353 |
if ( PLL()->options['force_lang'] == 1 ) {
|
354 |
$patterns = $this->get_seo_links_patterns();
|
355 |
foreach ( $pages as $page_id ) {
|
356 |
+
$link = urldecode( self::_get_relative_permalink( $page_id ) );
|
357 |
$language = pll_get_post_language( $page_id );
|
358 |
|
359 |
if ( !isset( $base_urls[$page_id] ) ) {
|
369 |
return $base_urls;
|
370 |
}
|
371 |
|
372 |
+
protected static function _get_relative_permalink( $item_id ) {
|
373 |
$permalink = get_permalink( $item_id );
|
374 |
|
375 |
$home_url = home_url();
|
376 |
|
377 |
return substr( $permalink, strlen( $home_url ) );
|
378 |
}
|
|
|
|
|
379 |
|
380 |
+
public static function is_noindex_page() {
|
381 |
+
|
382 |
+
if ( !Ecwid_Store_Page::is_store_page() ) {
|
383 |
+
return false;
|
384 |
+
}
|
385 |
+
|
386 |
+
$relative_permalink = self::_get_relative_permalink( get_the_ID() );
|
387 |
+
|
388 |
+
$noindex_pages = array(
|
389 |
+
'cart',
|
390 |
+
'account',
|
391 |
+
'checkout',
|
392 |
+
'signin'
|
393 |
+
);
|
394 |
+
|
395 |
+
$home_url = home_url();
|
396 |
+
$path = parse_url( $home_url, PHP_URL_PATH );
|
397 |
+
$seo_part = str_replace( $path . $relative_permalink, '', $_SERVER['REQUEST_URI'] );
|
398 |
+
|
399 |
+
foreach ( $noindex_pages as $page ) {
|
400 |
+
if ( preg_match( '!' . $page . '([\?\/]+.*|)$' . '!', $seo_part ) ) {
|
401 |
+
return true;
|
402 |
+
}
|
403 |
+
}
|
404 |
+
|
405 |
+
return false;
|
406 |
+
}
|
407 |
+
|
408 |
public static function is_enabled() {
|
409 |
|
410 |
return self::is_feature_available() && get_option( self::OPTION_ENABLED );
|
includes/class-ecwid-store-page.php
CHANGED
@@ -207,9 +207,18 @@ class Ecwid_Store_Page {
|
|
207 |
$pages = self::_set_store_pages( $pages );
|
208 |
|
209 |
if ( $page_id == get_option( self::OPTION_MAIN_STORE_PAGE_ID ) ) {
|
210 |
-
|
211 |
if ( isset( $pages[0] ) ) {
|
212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
} else {
|
214 |
update_option( self::OPTION_MAIN_STORE_PAGE_ID, '' );
|
215 |
}
|
@@ -241,6 +250,18 @@ class Ecwid_Store_Page {
|
|
241 |
return self::$_store_pages;
|
242 |
}
|
243 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
public static function schedule_flush_rewrites() {
|
245 |
update_option( self::OPTION_FLUSH_REWRITES, 1 );
|
246 |
}
|
@@ -275,8 +296,9 @@ class Ecwid_Store_Page {
|
|
275 |
$post_id = get_the_ID();
|
276 |
}
|
277 |
|
|
|
|
|
278 |
$post = get_post($post_id);
|
279 |
-
|
280 |
if ( $post ) {
|
281 |
$post_content = get_post( $post_id )->post_content;
|
282 |
|
@@ -284,7 +306,6 @@ class Ecwid_Store_Page {
|
|
284 |
$result = apply_filters( 'ecwid_page_has_product_browser', $result );
|
285 |
}
|
286 |
|
287 |
-
|
288 |
return $result;
|
289 |
}
|
290 |
|
207 |
$pages = self::_set_store_pages( $pages );
|
208 |
|
209 |
if ( $page_id == get_option( self::OPTION_MAIN_STORE_PAGE_ID ) ) {
|
210 |
+
|
211 |
if ( isset( $pages[0] ) ) {
|
212 |
+
|
213 |
+
$new_page = $pages[0];
|
214 |
+
// we prefer pages, not posts
|
215 |
+
foreach( $pages as $page ) {
|
216 |
+
if ( get_post($page)->post_type == 'page' ) {
|
217 |
+
$new_page = $page;
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
update_option( self::OPTION_MAIN_STORE_PAGE_ID, $new_page );
|
222 |
} else {
|
223 |
update_option( self::OPTION_MAIN_STORE_PAGE_ID, '' );
|
224 |
}
|
250 |
return self::$_store_pages;
|
251 |
}
|
252 |
|
253 |
+
public static function get_store_pages_array_for_selector()
|
254 |
+
{
|
255 |
+
$pages = self::get_store_pages_array();
|
256 |
+
foreach ( $pages as $ind => $page ) {
|
257 |
+
if ( $page != self::get_current_store_page_id() && get_post($page)->post_type == 'post' ) {
|
258 |
+
unset( $pages[$ind] );
|
259 |
+
}
|
260 |
+
}
|
261 |
+
|
262 |
+
return $pages;
|
263 |
+
}
|
264 |
+
|
265 |
public static function schedule_flush_rewrites() {
|
266 |
update_option( self::OPTION_FLUSH_REWRITES, 1 );
|
267 |
}
|
296 |
$post_id = get_the_ID();
|
297 |
}
|
298 |
|
299 |
+
$result = false;
|
300 |
+
|
301 |
$post = get_post($post_id);
|
|
|
302 |
if ( $post ) {
|
303 |
$post_content = get_post( $post_id )->post_content;
|
304 |
|
306 |
$result = apply_filters( 'ecwid_page_has_product_browser', $result );
|
307 |
}
|
308 |
|
|
|
309 |
return $result;
|
310 |
}
|
311 |
|
includes/importer/class-ecwid-import-page.php
CHANGED
@@ -9,6 +9,7 @@ class Ecwid_Import_Page
|
|
9 |
|
10 |
const AJAX_ACTION_CHECK_IMPORT = 'ec-store-check-import';
|
11 |
const AJAX_ACTION_DO_WOO_IMPORT = 'ec-store-do-woo-import';
|
|
|
12 |
|
13 |
const PARAM_FROM_IMPORT_ONBOARDING = 'from-woo-import-message';
|
14 |
|
@@ -19,6 +20,7 @@ class Ecwid_Import_Page
|
|
19 |
add_action( 'current_screen', array( $this, 'process_woo_onboarding_redirect' ) );
|
20 |
add_action( 'wp_ajax_' . self::AJAX_ACTION_CHECK_IMPORT, array( $this, 'check_import') );
|
21 |
add_action( 'wp_ajax_' . self::AJAX_ACTION_DO_WOO_IMPORT, array( $this, 'do_woo_import') );
|
|
|
22 |
}
|
23 |
|
24 |
public function process_woo_onboarding_redirect()
|
@@ -116,12 +118,36 @@ class Ecwid_Import_Page
|
|
116 |
return 'admin.php?page=' . Ecwid_Admin::ADMIN_SLUG . '&ec-page=billing';
|
117 |
}
|
118 |
|
119 |
-
|
120 |
{
|
121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
}
|
123 |
|
124 |
-
|
125 |
protected function _get_woo_url()
|
126 |
{
|
127 |
return 'admin.php?page=' . self::PAGE_SLUG_WOO;
|
9 |
|
10 |
const AJAX_ACTION_CHECK_IMPORT = 'ec-store-check-import';
|
11 |
const AJAX_ACTION_DO_WOO_IMPORT = 'ec-store-do-woo-import';
|
12 |
+
const ACTION_DO_RECONNECT = 'ec-store-do-reconnect';
|
13 |
|
14 |
const PARAM_FROM_IMPORT_ONBOARDING = 'from-woo-import-message';
|
15 |
|
20 |
add_action( 'current_screen', array( $this, 'process_woo_onboarding_redirect' ) );
|
21 |
add_action( 'wp_ajax_' . self::AJAX_ACTION_CHECK_IMPORT, array( $this, 'check_import') );
|
22 |
add_action( 'wp_ajax_' . self::AJAX_ACTION_DO_WOO_IMPORT, array( $this, 'do_woo_import') );
|
23 |
+
add_action( 'current_screen', array( $this, 'do_reconnect') );
|
24 |
}
|
25 |
|
26 |
public function process_woo_onboarding_redirect()
|
118 |
return 'admin.php?page=' . Ecwid_Admin::ADMIN_SLUG . '&ec-page=billing';
|
119 |
}
|
120 |
|
121 |
+
public function do_reconnect()
|
122 |
{
|
123 |
+
if ( strrpos( strrev( get_current_screen()->base), strrev( self::PAGE_SLUG_WOO) ) !== 0 ) {
|
124 |
+
return;
|
125 |
+
}
|
126 |
+
|
127 |
+
if ( !isset( $_GET['action'] ) || $_GET['action'] != 'reconnect' ) {
|
128 |
+
return;
|
129 |
+
}
|
130 |
+
|
131 |
+
$url = $this->_get_woo_url() . '#start';
|
132 |
+
|
133 |
+
$params = array(
|
134 |
+
'delete-demo',
|
135 |
+
'update-by-sku'
|
136 |
+
);
|
137 |
+
|
138 |
+
foreach ( $params as $param ) {
|
139 |
+
if ( isset( $_GET[$param] ) ) {
|
140 |
+
$url .= '&' . $param . '=true';
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
wp_redirect(
|
145 |
+
'admin.php?page=' . Ecwid_Admin::ADMIN_SLUG
|
146 |
+
. '&reconnect&return-url=' . urlencode( $url )
|
147 |
+
. '&scope=create_catalog+update_catalog&do_reconnect=1'
|
148 |
+
);
|
149 |
}
|
150 |
|
|
|
151 |
protected function _get_woo_url()
|
152 |
{
|
153 |
return 'admin.php?page=' . self::PAGE_SLUG_WOO;
|
includes/importer/class-ecwid-importer-task.php
CHANGED
@@ -39,15 +39,18 @@ class Ecwid_Importer_Task_Create_Product extends Ecwid_Importer_Task
|
|
39 |
{
|
40 |
public static $type = 'create_product';
|
41 |
|
|
|
|
|
42 |
public function execute( Ecwid_Importer $exporter, $product_data ) {
|
43 |
$api = new Ecwid_Api_V3( );
|
44 |
-
|
45 |
$woo_id = $product_data['woo_id'];
|
|
|
46 |
$product = get_post( $woo_id );
|
47 |
|
48 |
$data = array(
|
49 |
'name' => $product->post_title,
|
50 |
-
'price' =>
|
51 |
'description' => $product->post_content,
|
52 |
'isShippingRequired' => get_post_meta( $woo_id, '_virtual', true ) != 'yes',
|
53 |
'categoryIds' => array(),
|
@@ -66,6 +69,13 @@ class Ecwid_Importer_Task_Create_Product extends Ecwid_Importer_Task
|
|
66 |
$data['unlimited'] = true;
|
67 |
}
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
$categories = get_the_terms( $woo_id, 'product_cat' );
|
70 |
|
71 |
if ( $categories ) foreach ( $categories as $category ) {
|
@@ -76,21 +86,25 @@ class Ecwid_Importer_Task_Create_Product extends Ecwid_Importer_Task
|
|
76 |
}
|
77 |
}
|
78 |
if ( empty( $data['categoryIds'] ) ) {
|
79 |
-
unset($data['categoryIds']);
|
80 |
}
|
81 |
|
|
|
82 |
$result = null;
|
83 |
if ( $exporter->get_setting( Ecwid_Importer::SETTING_UPDATE_BY_SKU ) ) {
|
84 |
$products = $api->get_products( array( 'sku' => $data['sku'] ) );
|
85 |
|
86 |
if ( $products->total > 0 ) {
|
87 |
-
$
|
88 |
-
$result = $api->update_product( $data );
|
|
|
89 |
}
|
90 |
}
|
91 |
|
92 |
if ( !$result ) {
|
93 |
$result = $api->create_product( $data );
|
|
|
|
|
94 |
}
|
95 |
|
96 |
$return = array(
|
@@ -100,7 +114,8 @@ class Ecwid_Importer_Task_Create_Product extends Ecwid_Importer_Task
|
|
100 |
if ( $result['response']['code'] == '200' ) {
|
101 |
$result_object = json_decode( $result['body'] );
|
102 |
|
103 |
-
|
|
|
104 |
|
105 |
$return['status'] = 'success';
|
106 |
$return['data'] = $result_object;
|
@@ -109,10 +124,43 @@ class Ecwid_Importer_Task_Create_Product extends Ecwid_Importer_Task
|
|
109 |
$return['data'] = $result;
|
110 |
$return['sent_data'] = $data;
|
111 |
}
|
112 |
-
|
113 |
return $return;
|
114 |
}
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
public static function build( $data ) {
|
117 |
return array(
|
118 |
'type' => self::$type,
|
@@ -217,7 +265,7 @@ class Ecwid_Importer_Task_Upload_Product_Image extends Ecwid_Importer_Task
|
|
217 |
return array(
|
218 |
'status' => 'error',
|
219 |
'data' => 'skipped',
|
220 |
-
'message' => 'Parent product was not imported'
|
221 |
);
|
222 |
}
|
223 |
|
@@ -266,20 +314,28 @@ class Ecwid_Importer_Task_Create_Category extends Ecwid_Importer_Task
|
|
266 |
'description' => $category->description
|
267 |
);
|
268 |
|
269 |
-
$
|
270 |
-
|
271 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
|
273 |
$return = array(
|
274 |
'type' => self::$type
|
275 |
);
|
276 |
if ( $result['response']['code'] == '200' ) {
|
277 |
-
$
|
278 |
-
|
279 |
-
$exporter->save_ecwid_category( $category_data['woo_id'], $result_object->id );
|
280 |
-
|
281 |
$return['status'] = 'success';
|
282 |
-
$return['data'] = $
|
283 |
} else {
|
284 |
$return['status'] = 'error';
|
285 |
$return['data'] = $result;
|
39 |
{
|
40 |
public static $type = 'create_product';
|
41 |
|
42 |
+
const WC_PRODUCT_TYPE_VARIABLE = 'variable';
|
43 |
+
|
44 |
public function execute( Ecwid_Importer $exporter, $product_data ) {
|
45 |
$api = new Ecwid_Api_V3( );
|
46 |
+
|
47 |
$woo_id = $product_data['woo_id'];
|
48 |
+
|
49 |
$product = get_post( $woo_id );
|
50 |
|
51 |
$data = array(
|
52 |
'name' => $product->post_title,
|
53 |
+
'price' => get_post_meta( $woo_id, '_regular_price', true ),
|
54 |
'description' => $product->post_content,
|
55 |
'isShippingRequired' => get_post_meta( $woo_id, '_virtual', true ) != 'yes',
|
56 |
'categoryIds' => array(),
|
69 |
$data['unlimited'] = true;
|
70 |
}
|
71 |
|
72 |
+
$product = wc_get_product( $woo_id );
|
73 |
+
if ($product->get_type() == self::WC_PRODUCT_TYPE_VARIABLE ) {
|
74 |
+
$data = array_merge( $data, $this->_get_variable_product_data( $woo_id ) );
|
75 |
+
}
|
76 |
+
|
77 |
+
$data['price'] = floatval( $data['price'] );
|
78 |
+
|
79 |
$categories = get_the_terms( $woo_id, 'product_cat' );
|
80 |
|
81 |
if ( $categories ) foreach ( $categories as $category ) {
|
86 |
}
|
87 |
}
|
88 |
if ( empty( $data['categoryIds'] ) ) {
|
89 |
+
unset( $data['categoryIds'] );
|
90 |
}
|
91 |
|
92 |
+
$ecwid_product_id = null;
|
93 |
$result = null;
|
94 |
if ( $exporter->get_setting( Ecwid_Importer::SETTING_UPDATE_BY_SKU ) ) {
|
95 |
$products = $api->get_products( array( 'sku' => $data['sku'] ) );
|
96 |
|
97 |
if ( $products->total > 0 ) {
|
98 |
+
$ecwid_product_id = $products->items[0]->id;
|
99 |
+
$result = $api->update_product( $data, $ecwid_product_id );
|
100 |
+
$exporter->save_ecwid_product_id( $woo_id, $ecwid_product_id );
|
101 |
}
|
102 |
}
|
103 |
|
104 |
if ( !$result ) {
|
105 |
$result = $api->create_product( $data );
|
106 |
+
$result_object = json_decode( $result['body'] );
|
107 |
+
$ecwid_product_id = $result_object->id;
|
108 |
}
|
109 |
|
110 |
$return = array(
|
114 |
if ( $result['response']['code'] == '200' ) {
|
115 |
$result_object = json_decode( $result['body'] );
|
116 |
|
117 |
+
update_post_meta( $woo_id, 'ecwid_product_id', $ecwid_product_id );
|
118 |
+
$exporter->save_ecwid_product_id( $woo_id, $ecwid_product_id );
|
119 |
|
120 |
$return['status'] = 'success';
|
121 |
$return['data'] = $result_object;
|
124 |
$return['data'] = $result;
|
125 |
$return['sent_data'] = $data;
|
126 |
}
|
127 |
+
|
128 |
return $return;
|
129 |
}
|
130 |
|
131 |
+
public function _get_variable_product_data( $id )
|
132 |
+
{
|
133 |
+
$result = array();
|
134 |
+
|
135 |
+
$product = new WC_Product_Variable( $id );
|
136 |
+
$result['price'] = $product->get_variation_price();
|
137 |
+
|
138 |
+
$attributes = $product->get_variation_attributes();
|
139 |
+
if ( $attributes && is_array( $attributes ) && count( $attributes ) > 0 ) {
|
140 |
+
|
141 |
+
$default_attributes = $product->get_default_attributes();
|
142 |
+
$result['options'] = array();
|
143 |
+
foreach ( $attributes as $name => $attribute ) {
|
144 |
+
$option = array( 'type' => 'SELECT', 'name' => $name, 'required' => true, 'choices' => array() );
|
145 |
+
foreach ( $attribute as $option_name ) {
|
146 |
+
$choice = array( 'text' => $option_name, 'priceModifier' => 0, 'priceModifierType' => 'ABSOLUTE' );
|
147 |
+
$option['choices'][] = $choice;
|
148 |
+
}
|
149 |
+
if ( @$default_attributes[$name] ) {
|
150 |
+
$ind = array_search( $default_attributes[$name], $attribute );
|
151 |
+
|
152 |
+
if ( $ind !== false ) {
|
153 |
+
$option['defaultChoice'] = $ind;
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
$result['options'][] = $option;
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
return $result;
|
162 |
+
}
|
163 |
+
|
164 |
public static function build( $data ) {
|
165 |
return array(
|
166 |
'type' => self::$type,
|
265 |
return array(
|
266 |
'status' => 'error',
|
267 |
'data' => 'skipped',
|
268 |
+
'message' => 'Parent product was not imported for product #' . $product_data['woo_id']
|
269 |
);
|
270 |
}
|
271 |
|
314 |
'description' => $category->description
|
315 |
);
|
316 |
|
317 |
+
$ecwid_category_id = get_term_meta( $category_data['woo_id'], 'ecwid_category_id', true );
|
318 |
+
if ( $ecwid_category_id ) {
|
319 |
+
$result = $api->update_category( $data, $ecwid_category_id );
|
320 |
+
} else {
|
321 |
+
$result = $api->create_category(
|
322 |
+
$data
|
323 |
+
);
|
324 |
+
|
325 |
+
if ( $result['response']['code'] == 200 ) {
|
326 |
+
$result_object = json_decode( $result['body'] );
|
327 |
+
$ecwid_category_id = $result_object->id;
|
328 |
+
}
|
329 |
+
}
|
330 |
|
331 |
$return = array(
|
332 |
'type' => self::$type
|
333 |
);
|
334 |
if ( $result['response']['code'] == '200' ) {
|
335 |
+
$exporter->save_ecwid_category( $category_data['woo_id'], $ecwid_category_id );
|
336 |
+
update_term_meta( $category_data['woo_id'], 'ecwid_category_id', $ecwid_category_id );
|
|
|
|
|
337 |
$return['status'] = 'success';
|
338 |
+
$return['data'] = json_decode( $result['body'] );
|
339 |
} else {
|
340 |
$return['status'] = 'error';
|
341 |
$return['data'] = $result;
|
includes/importer/class-ecwid-importer.php
CHANGED
@@ -45,7 +45,7 @@ class Ecwid_Importer
|
|
45 |
set_time_limit(0);
|
46 |
$results = array();
|
47 |
|
48 |
-
$status = get_option( self::OPTION_STATUS, array() );
|
49 |
$count = 0;
|
50 |
$progress = array( 'success' => array(), 'error' => array(), 'total' => count($this->_tasks) );
|
51 |
|
@@ -81,6 +81,7 @@ class Ecwid_Importer
|
|
81 |
$this->_tasks[$current_task]['error'] = $message;
|
82 |
|
83 |
$progress['error_messages'][$task_data['type']][$message]++;
|
|
|
84 |
} else {
|
85 |
$progress['success'][] = $task_data['type'];
|
86 |
}
|
@@ -268,17 +269,40 @@ class Ecwid_Importer
|
|
268 |
}
|
269 |
}
|
270 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
public static function count_woo_categories()
|
272 |
{
|
273 |
-
$
|
274 |
-
'taxonomy' => 'product_cat',
|
275 |
-
'count' => true,
|
276 |
-
'hierarchical' => true,
|
277 |
-
'get' => 'all'
|
278 |
-
);
|
279 |
-
$all_categories = get_categories( $args );
|
280 |
|
281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
}
|
283 |
|
284 |
public static function count_woo_products()
|
@@ -322,15 +346,7 @@ class Ecwid_Importer
|
|
322 |
|
323 |
public function gather_categories($parent = 0 )
|
324 |
{
|
325 |
-
$product_categories =
|
326 |
-
'menu_order' => 'ASC',
|
327 |
-
'parent' => $parent,
|
328 |
-
'hide_empty' => 0,
|
329 |
-
'hierarchical' => 1,
|
330 |
-
'taxonomy' => 'product_cat',
|
331 |
-
'pad_counts' => 1,
|
332 |
-
'get' => 'all'
|
333 |
-
) ) );
|
334 |
|
335 |
if ( count( $product_categories ) == 0 ) {
|
336 |
return array();
|
@@ -339,18 +355,20 @@ class Ecwid_Importer
|
|
339 |
$result = array();
|
340 |
foreach ( $product_categories as $category ) {
|
341 |
|
342 |
-
$
|
343 |
-
'woo_id' => $category->term_id,
|
344 |
-
'parent_id' => $parent,
|
345 |
-
'has_image' => get_term_meta( $category->term_id, 'thumbnail_id', true )
|
346 |
-
);
|
347 |
|
348 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
$result = array_merge(
|
350 |
$result,
|
351 |
-
$
|
352 |
);
|
353 |
-
|
354 |
}
|
355 |
|
356 |
return $result;
|
45 |
set_time_limit(0);
|
46 |
$results = array();
|
47 |
|
48 |
+
$status = get_option( self::OPTION_STATUS, array( 'plan_limit' => array() ) );
|
49 |
$count = 0;
|
50 |
$progress = array( 'success' => array(), 'error' => array(), 'total' => count($this->_tasks) );
|
51 |
|
81 |
$this->_tasks[$current_task]['error'] = $message;
|
82 |
|
83 |
$progress['error_messages'][$task_data['type']][$message]++;
|
84 |
+
error_log( var_export( $result['sent_data'], true ) );
|
85 |
} else {
|
86 |
$progress['success'][] = $task_data['type'];
|
87 |
}
|
269 |
}
|
270 |
}
|
271 |
|
272 |
+
protected static function _get_woo_categories( $args ) {
|
273 |
+
|
274 |
+
$args = wp_parse_args( $args,
|
275 |
+
array(
|
276 |
+
'menu_order' => 'ASC',
|
277 |
+
'hide_empty' => 0,
|
278 |
+
'hierarchical' => 1,
|
279 |
+
'taxonomy' => 'product_cat',
|
280 |
+
'pad_counts' => 1,
|
281 |
+
'get' => 'all'
|
282 |
+
)
|
283 |
+
);
|
284 |
+
|
285 |
+
if ( isset( $args['parent'] ) && $args['parent'] ) {
|
286 |
+
$args = apply_filters( 'woocommerce_product_subcategories_args', $args );
|
287 |
+
}
|
288 |
+
|
289 |
+
return get_categories( $args );
|
290 |
+
}
|
291 |
+
|
292 |
public static function count_woo_categories()
|
293 |
{
|
294 |
+
$all_categories = self::_get_woo_categories( array( 'count' => true ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
|
296 |
+
$count = count($all_categories);
|
297 |
+
|
298 |
+
$default = self::_get_woo_categories( array( 'objectIds' => array( get_option ( 'default_product_cat' ) ) ) );
|
299 |
+
$children_of_default = self::_get_woo_categories( array( 'parent' => get_option ( 'default_product_cat' ) ) );
|
300 |
+
|
301 |
+
if ( count( $default ) > 0 && count( $children_of_default ) == 0 ) {
|
302 |
+
$count--;
|
303 |
+
}
|
304 |
+
|
305 |
+
return $count;
|
306 |
}
|
307 |
|
308 |
public static function count_woo_products()
|
346 |
|
347 |
public function gather_categories($parent = 0 )
|
348 |
{
|
349 |
+
$product_categories = self::_get_woo_categories( array( 'parent' => $parent) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
|
351 |
if ( count( $product_categories ) == 0 ) {
|
352 |
return array();
|
355 |
$result = array();
|
356 |
foreach ( $product_categories as $category ) {
|
357 |
|
358 |
+
$children = $this->gather_categories( $category->term_id );
|
|
|
|
|
|
|
|
|
359 |
|
360 |
+
if ( $category->term_id != get_option('default_product_cat') || count($children) > 0 ) {
|
361 |
+
$result[] = array(
|
362 |
+
'woo_id' => $category->term_id,
|
363 |
+
'parent_id' => $parent,
|
364 |
+
'has_image' => get_term_meta( $category->term_id, 'thumbnail_id', true )
|
365 |
+
);
|
366 |
+
|
367 |
$result = array_merge(
|
368 |
$result,
|
369 |
+
$children
|
370 |
);
|
371 |
+
}
|
372 |
}
|
373 |
|
374 |
return $result;
|
includes/widgets/class-ecwid-widget-floating-shopping-cart.php
CHANGED
@@ -96,7 +96,7 @@ class Ecwid_Widget_Floating_Shopping_Cart extends WP_Widget {
|
|
96 |
<<<HTML
|
97 |
<div class="ecwid-float-icons position-$position" ondragstart="return false">
|
98 |
<div class="ecwid-cart-icon off">
|
99 |
-
<a href="$cart_url" data-ecwid-page="cart" data-count="0">
|
100 |
<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>
|
101 |
<div id="ecwid-cart"><script type="text/javascript"> xMinicart("style=","id=ecwid-cart"); </script></div>
|
102 |
</a>
|
96 |
<<<HTML
|
97 |
<div class="ecwid-float-icons position-$position" ondragstart="return false">
|
98 |
<div class="ecwid-cart-icon off">
|
99 |
+
<a href="$cart_url" rel="nofollow" data-ecwid-page="cart" data-count="0">
|
100 |
<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>
|
101 |
<div id="ecwid-cart"><script type="text/javascript"> xMinicart("style=","id=ecwid-cart"); </script></div>
|
102 |
</a>
|
js/importer.js
CHANGED
@@ -8,6 +8,25 @@ jQuery(document).ready(function() {
|
|
8 |
'planLimitHit': false
|
9 |
};
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
jQuery('#ecwid-importer-woo').click(function() {
|
12 |
|
13 |
window.location.hash="woo";
|
@@ -34,11 +53,11 @@ jQuery(document).ready(function() {
|
|
34 |
console.log( "complete" );
|
35 |
});
|
36 |
});
|
37 |
-
|
38 |
-
|
39 |
$wrapper.removeClass('state-woo-initial').addClass('state-woo-in-progress');
|
40 |
jQuery('input[type=checkbox].import-settings').attr('onclick', 'return false').closest('label').addClass('readonly');
|
41 |
-
|
42 |
var settings = {};
|
43 |
jQuery('input[type=checkbox].import-settings').each(function(idx, el) {
|
44 |
if (el.checked) {
|
@@ -46,7 +65,7 @@ jQuery(document).ready(function() {
|
|
46 |
}
|
47 |
jQuery(el).attr('onclick', 'return false').closest('label').addClass('readonly');
|
48 |
});
|
49 |
-
|
50 |
do_import = function () {
|
51 |
jQuery.ajax({
|
52 |
'url': ajaxurl,
|
@@ -71,14 +90,14 @@ jQuery(document).ready(function() {
|
|
71 |
status.error[data.error[i]]++;
|
72 |
}
|
73 |
}
|
74 |
-
|
75 |
status.planLimitHit |= typeof data.plan_limit_hit != 'undefined';
|
76 |
-
|
77 |
if (data.error_messages) {
|
78 |
for (var import_type in data.error_messages) {
|
79 |
-
|
80 |
var messages = data.error_messages[import_type];
|
81 |
-
|
82 |
if ( !status.errorMessages[import_type] ) {
|
83 |
status.errorMessages[import_type] = {};
|
84 |
}
|
@@ -87,15 +106,15 @@ jQuery(document).ready(function() {
|
|
87 |
if ( !status.errorMessages[import_type].hasOwnProperty(message) ) {
|
88 |
status.errorMessages[import_type][message] = 0;
|
89 |
}
|
90 |
-
status.errorMessages[import_type][message] += messages[message];
|
91 |
}
|
92 |
}
|
93 |
}
|
94 |
-
|
95 |
jQuery('#import-progress-current').text((status.success.create_category || 0) + (status.success.create_product || 0));
|
96 |
|
97 |
if (data.status == 'complete') {
|
98 |
-
|
99 |
doImportComplete(status);
|
100 |
} else {
|
101 |
do_import();
|
@@ -103,18 +122,18 @@ jQuery(document).ready(function() {
|
|
103 |
}
|
104 |
});
|
105 |
};
|
106 |
-
|
107 |
do_import();
|
108 |
-
|
109 |
doImportComplete = function( status ) {
|
110 |
jQuery('#import-results-products').text(status.success.create_product || 0);
|
111 |
jQuery('#import-results-categories').text(status.success.create_category || 0);
|
112 |
$wrapper.removeClass('state-woo-in-progress').addClass('state-woo-complete');
|
113 |
-
|
114 |
if (status.planLimitHit) {
|
115 |
jQuery('plan-limit-message').show();
|
116 |
}
|
117 |
-
|
118 |
var errorContent = '';
|
119 |
for (var importType in status.errorMessages) {
|
120 |
errorContent += importType + "\n";
|
@@ -122,16 +141,35 @@ jQuery(document).ready(function() {
|
|
122 |
errorContent += ' ' + message + ':' + status.errorMessages[importType][message] + "\n";
|
123 |
}
|
124 |
}
|
125 |
-
|
126 |
if (errorContent.length > 0) {
|
127 |
jQuery('.ecwid-importer .errors').show().find('pre').text(errorContent);
|
128 |
}
|
129 |
-
|
130 |
-
|
131 |
}
|
132 |
-
}
|
133 |
|
134 |
-
|
135 |
-
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
});
|
8 |
'planLimitHit': false
|
9 |
};
|
10 |
|
11 |
+
jQuery('#reconnect-button').click(function() {
|
12 |
+
var url = this.href;
|
13 |
+
var settings = {};
|
14 |
+
jQuery('input[type=checkbox].import-settings').each(function(idx, el) {
|
15 |
+
if (el.checked) {
|
16 |
+
settings[el.name] = true;
|
17 |
+
}
|
18 |
+
});
|
19 |
+
|
20 |
+
for ( var i in settings ) {
|
21 |
+
url += '&' + i + '=true';
|
22 |
+
}
|
23 |
+
|
24 |
+
location.href = url;
|
25 |
+
|
26 |
+
return false;
|
27 |
+
});
|
28 |
+
|
29 |
+
|
30 |
jQuery('#ecwid-importer-woo').click(function() {
|
31 |
|
32 |
window.location.hash="woo";
|
53 |
console.log( "complete" );
|
54 |
});
|
55 |
});
|
56 |
+
|
57 |
+
startWooImport = function() {
|
58 |
$wrapper.removeClass('state-woo-initial').addClass('state-woo-in-progress');
|
59 |
jQuery('input[type=checkbox].import-settings').attr('onclick', 'return false').closest('label').addClass('readonly');
|
60 |
+
|
61 |
var settings = {};
|
62 |
jQuery('input[type=checkbox].import-settings').each(function(idx, el) {
|
63 |
if (el.checked) {
|
65 |
}
|
66 |
jQuery(el).attr('onclick', 'return false').closest('label').addClass('readonly');
|
67 |
});
|
68 |
+
|
69 |
do_import = function () {
|
70 |
jQuery.ajax({
|
71 |
'url': ajaxurl,
|
90 |
status.error[data.error[i]]++;
|
91 |
}
|
92 |
}
|
93 |
+
|
94 |
status.planLimitHit |= typeof data.plan_limit_hit != 'undefined';
|
95 |
+
|
96 |
if (data.error_messages) {
|
97 |
for (var import_type in data.error_messages) {
|
98 |
+
|
99 |
var messages = data.error_messages[import_type];
|
100 |
+
|
101 |
if ( !status.errorMessages[import_type] ) {
|
102 |
status.errorMessages[import_type] = {};
|
103 |
}
|
106 |
if ( !status.errorMessages[import_type].hasOwnProperty(message) ) {
|
107 |
status.errorMessages[import_type][message] = 0;
|
108 |
}
|
109 |
+
status.errorMessages[import_type][message] += messages[message];
|
110 |
}
|
111 |
}
|
112 |
}
|
113 |
+
|
114 |
jQuery('#import-progress-current').text((status.success.create_category || 0) + (status.success.create_product || 0));
|
115 |
|
116 |
if (data.status == 'complete') {
|
117 |
+
|
118 |
doImportComplete(status);
|
119 |
} else {
|
120 |
do_import();
|
122 |
}
|
123 |
});
|
124 |
};
|
125 |
+
|
126 |
do_import();
|
127 |
+
|
128 |
doImportComplete = function( status ) {
|
129 |
jQuery('#import-results-products').text(status.success.create_product || 0);
|
130 |
jQuery('#import-results-categories').text(status.success.create_category || 0);
|
131 |
$wrapper.removeClass('state-woo-in-progress').addClass('state-woo-complete');
|
132 |
+
|
133 |
if (status.planLimitHit) {
|
134 |
jQuery('plan-limit-message').show();
|
135 |
}
|
136 |
+
|
137 |
var errorContent = '';
|
138 |
for (var importType in status.errorMessages) {
|
139 |
errorContent += importType + "\n";
|
141 |
errorContent += ' ' + message + ':' + status.errorMessages[importType][message] + "\n";
|
142 |
}
|
143 |
}
|
144 |
+
|
145 |
if (errorContent.length > 0) {
|
146 |
jQuery('.ecwid-importer .errors').show().find('pre').text(errorContent);
|
147 |
}
|
148 |
+
|
149 |
+
|
150 |
}
|
151 |
+
};
|
152 |
|
153 |
+
jQuery('#ecwid-importer-woo-go').click(startWooImport);
|
154 |
+
|
155 |
+
jQuery('.ecwid-importer .errors .btn-details').click(function() {
|
156 |
+
jQuery('.ecwid-importer .errors .details').toggle();
|
157 |
+
});
|
158 |
+
|
159 |
+
if (window.location.hash.indexOf('start') != -1) {
|
160 |
+
|
161 |
+
var params = location.hash.split('&');
|
162 |
+
|
163 |
+
for ( var i in params ){
|
164 |
+
var name = params[i].split('=');
|
165 |
+
name = name[0];
|
166 |
+
|
167 |
+
var el = jQuery( 'input[name="' + name + '"]' );
|
168 |
+
if ( el.length == 1 ) {
|
169 |
+
el.prop('checked', true);
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
startWooImport();
|
174 |
+
}
|
175 |
});
|
lib/ecwid_api_v3.php
CHANGED
@@ -497,6 +497,7 @@ class Ecwid_Api_V3
|
|
497 |
}
|
498 |
|
499 |
if ( self::get_api_status() == self::API_STATUS_OK && ( @$result['code'] != '200' || empty($result['data'] ) ) ) {
|
|
|
500 |
self::set_api_status( self::API_STATUS_UNDEFINED );
|
501 |
return false;
|
502 |
}
|
@@ -645,38 +646,97 @@ class Ecwid_Api_V3
|
|
645 |
'token'
|
646 |
);
|
647 |
$url = $this->build_request_url( $this->_products_api_url, $request_params );
|
|
|
|
|
648 |
|
649 |
$result = $this->_do_post( $url, $params );
|
650 |
|
651 |
return $result;
|
652 |
}
|
653 |
|
654 |
-
public function update_product( $params ) {
|
655 |
$request_params = array(
|
656 |
'token'
|
657 |
);
|
658 |
|
659 |
-
$
|
660 |
-
unset( $params['id'] );
|
661 |
-
|
662 |
-
$url = $this->build_request_url( $this->_products_api_url . '/' . $id, $request_params );
|
663 |
|
|
|
|
|
664 |
$result = $this->_do_put( $url, $params );
|
665 |
|
666 |
return $result;
|
667 |
}
|
668 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
669 |
public function create_category( $params ) {
|
|
|
670 |
$request_params = array(
|
671 |
'token'
|
672 |
);
|
|
|
673 |
$url = $this->build_request_url( $this->_categories_api_url, $request_params );
|
674 |
-
|
|
|
|
|
675 |
$result = $this->_do_post( $url, $params );
|
676 |
|
677 |
return $result;
|
678 |
}
|
679 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
680 |
public function delete_products( $ids )
|
681 |
{
|
682 |
$request_params = array( 'token' );
|
@@ -789,4 +849,4 @@ class Ecwid_Api_V3
|
|
789 |
}
|
790 |
}
|
791 |
}
|
792 |
-
}
|
497 |
}
|
498 |
|
499 |
if ( self::get_api_status() == self::API_STATUS_OK && ( @$result['code'] != '200' || empty($result['data'] ) ) ) {
|
500 |
+
update_option('ecwid_error_log', var_export( $result, true ) );
|
501 |
self::set_api_status( self::API_STATUS_UNDEFINED );
|
502 |
return false;
|
503 |
}
|
646 |
'token'
|
647 |
);
|
648 |
$url = $this->build_request_url( $this->_products_api_url, $request_params );
|
649 |
+
|
650 |
+
$params = $this->_sanitize_product_data( $params );
|
651 |
|
652 |
$result = $this->_do_post( $url, $params );
|
653 |
|
654 |
return $result;
|
655 |
}
|
656 |
|
657 |
+
public function update_product( $params, $product_id ) {
|
658 |
$request_params = array(
|
659 |
'token'
|
660 |
);
|
661 |
|
662 |
+
$url = $this->build_request_url( $this->_products_api_url . '/' . $product_id, $request_params );
|
|
|
|
|
|
|
663 |
|
664 |
+
$params = $this->_sanitize_product_data( $params );
|
665 |
+
|
666 |
$result = $this->_do_put( $url, $params );
|
667 |
|
668 |
return $result;
|
669 |
}
|
670 |
|
671 |
+
protected function _sanitize_product_data( $data ) {
|
672 |
+
|
673 |
+
$int_fields = array( 'quantity', 'defaultCategoryId', 'showOnFrontPage' );
|
674 |
+
foreach ( $int_fields as $field ) {
|
675 |
+
if ( array_key_exists( $field, $data ) ) {
|
676 |
+
$data[$field] = intval( $data[$field] );
|
677 |
+
}
|
678 |
+
}
|
679 |
+
|
680 |
+
$float_fields = array( 'price' );
|
681 |
+
foreach ( $float_fields as $field ) {
|
682 |
+
if ( array_key_exists( $field, $data ) ) {
|
683 |
+
$data[$field] = floatval( $data[$field] );
|
684 |
+
}
|
685 |
+
}
|
686 |
+
|
687 |
+
if ( array_key_exists( 'categoryIds', $data ) ) {
|
688 |
+
foreach ( $data['categoryIds'] as $key => $id ) {
|
689 |
+
$data['categoryIds'][$key] = intval( $id );
|
690 |
+
}
|
691 |
+
}
|
692 |
+
|
693 |
+
return $data;
|
694 |
+
|
695 |
+
}
|
696 |
+
|
697 |
public function create_category( $params ) {
|
698 |
+
|
699 |
$request_params = array(
|
700 |
'token'
|
701 |
);
|
702 |
+
|
703 |
$url = $this->build_request_url( $this->_categories_api_url, $request_params );
|
704 |
+
|
705 |
+
$params = $this->_sanitize_category_data( $params );
|
706 |
+
|
707 |
$result = $this->_do_post( $url, $params );
|
708 |
|
709 |
return $result;
|
710 |
}
|
711 |
|
712 |
+
public function update_category( $params, $category_id ) {
|
713 |
+
|
714 |
+
$request_params = array(
|
715 |
+
'token'
|
716 |
+
);
|
717 |
+
|
718 |
+
$url = $this->build_request_url( $this->_categories_api_url . '/' . $category_id, $request_params );
|
719 |
+
|
720 |
+
$params = $this->_sanitize_category_data( $params );
|
721 |
+
|
722 |
+
$result = $this->_do_put( $url, $params );
|
723 |
+
|
724 |
+
return $result;
|
725 |
+
}
|
726 |
+
|
727 |
+
protected function _sanitize_category_data( $data ) {
|
728 |
+
$result = array();
|
729 |
+
|
730 |
+
$int_fields = array( 'parentId', 'orderBy' );
|
731 |
+
foreach ( $int_fields as $field ) {
|
732 |
+
if ( array_key_exists( $field, $data ) ) {
|
733 |
+
$data[$field] = intval( $data[$field] );
|
734 |
+
}
|
735 |
+
}
|
736 |
+
|
737 |
+
return $data;
|
738 |
+
}
|
739 |
+
|
740 |
public function delete_products( $ids )
|
741 |
{
|
742 |
$request_params = array( 'token' );
|
849 |
}
|
850 |
}
|
851 |
}
|
852 |
+
}
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: Ecwid
|
|
3 |
Tags: ecommerce, downloadable products, Facebook ecommerce, online store, paypal, product catalog, shop, shopping cart, store
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 4.9
|
6 |
-
Stable tag: 6.2.
|
7 |
|
8 |
Powerful, easy to use ecommerce shopping cart. Bank level PCI DSS Level 1 security. iPhone & Android apps. Superb support. Free plan available.
|
9 |
|
@@ -151,8 +151,10 @@ You can use Ecwid’s built-in import tools to copy your store products from any
|
|
151 |
* [Ecwid eCommerce Forums](https://www.ecwid.com/forums/forumdisplay.php?f=19)
|
152 |
|
153 |
== Changelog ==
|
154 |
-
= 6.2.
|
|
|
155 |
|
|
|
156 |
- **New “Main storefront page” selector in the plugin advanced settings.** If you have your storefront added to several pages on your site, you can now choose the main storefront page in the plugin settings (Ecwid → Advanced). This will define where the store navigation menus and sidebar widgets should be linked to. If you have a single online store page (which is totally OK), this new option won’t be displayed.
|
157 |
- **New warning messages for the sites with outdated TLS.** Ecwid is a PCI DSS level 1 certified ecommerce provider, which is a gold security standard for e-commerce solutions. Put it simply, when you use Ecwid, you have a bank level of online payments security in your online store. One of the requirements to make sure Ecwid merchants can securely process payments on their site is to use up-to-date TLS software on the server where your site is hosted. If your store dashboard doesn’t load in your Wordpress admin backend or you see a warning message saying that the Ecwid plugin cannot connect to the Ecwid API, that’s most likely caused by outdated TLS on your hosting. We recommend contacting your hosting in such case. If everything works fine and no warning message appears, that means no action is required from your side.
|
158 |
- **Minor improvements in the store dashboard in the WordPress admin backend.** We improved the scroll behavior on the store admin dashboard pages and fixed a couple minor issues in the Ecwid menu items in the WordPress admin backend.
|
3 |
Tags: ecommerce, downloadable products, Facebook ecommerce, online store, paypal, product catalog, shop, shopping cart, store
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 4.9
|
6 |
+
Stable tag: 6.2.2
|
7 |
|
8 |
Powerful, easy to use ecommerce shopping cart. Bank level PCI DSS Level 1 security. iPhone & Android apps. Superb support. Free plan available.
|
9 |
|
151 |
* [Ecwid eCommerce Forums](https://www.ecwid.com/forums/forumdisplay.php?f=19)
|
152 |
|
153 |
== Changelog ==
|
154 |
+
= 6.2.2 - Aug 15, 2018 =
|
155 |
+
- Minor fixes and improvements.
|
156 |
|
157 |
+
= 6.2.1 - Aug 8, 2018 =
|
158 |
- **New “Main storefront page” selector in the plugin advanced settings.** If you have your storefront added to several pages on your site, you can now choose the main storefront page in the plugin settings (Ecwid → Advanced). This will define where the store navigation menus and sidebar widgets should be linked to. If you have a single online store page (which is totally OK), this new option won’t be displayed.
|
159 |
- **New warning messages for the sites with outdated TLS.** Ecwid is a PCI DSS level 1 certified ecommerce provider, which is a gold security standard for e-commerce solutions. Put it simply, when you use Ecwid, you have a bank level of online payments security in your online store. One of the requirements to make sure Ecwid merchants can securely process payments on their site is to use up-to-date TLS software on the server where your site is hosted. If your store dashboard doesn’t load in your Wordpress admin backend or you see a warning message saying that the Ecwid plugin cannot connect to the Ecwid API, that’s most likely caused by outdated TLS on your hosting. We recommend contacting your hosting in such case. If everything works fine and no warning message appears, that means no action is required from your side.
|
160 |
- **Minor improvements in the store dashboard in the WordPress admin backend.** We improved the scroll behavior on the store admin dashboard pages and fixed a couple minor issues in the Ecwid menu items in the WordPress admin backend.
|
templates/advanced-settings.php
CHANGED
@@ -122,14 +122,14 @@
|
|
122 |
<?php endif; ?>
|
123 |
<hr />
|
124 |
|
125 |
-
<?php if ( count ( Ecwid_Store_Page::
|
126 |
<div class="pure-control-group">
|
127 |
<div class="label">
|
128 |
<label for="<?php echo Ecwid_Store_Page::OPTION_MAIN_STORE_PAGE_ID; ?>">
|
129 |
<?php _e('Main storefront page', 'ecwid-shopping-cart'); ?>
|
130 |
</label>
|
131 |
<select id="<?php echo Ecwid_Store_Page::OPTION_MAIN_STORE_PAGE_ID; ?>" name="<?php echo Ecwid_Store_Page::OPTION_MAIN_STORE_PAGE_ID; ?>">
|
132 |
-
<?php foreach ( Ecwid_Store_Page::
|
133 |
<option
|
134 |
value="<?php echo $id; ?>"
|
135 |
<?php if ( $id == Ecwid_Store_Page::get_current_store_page_id() ): ?>
|
122 |
<?php endif; ?>
|
123 |
<hr />
|
124 |
|
125 |
+
<?php if ( count ( Ecwid_Store_Page::get_store_pages_array_for_selector() ) > 1 ): ?>
|
126 |
<div class="pure-control-group">
|
127 |
<div class="label">
|
128 |
<label for="<?php echo Ecwid_Store_Page::OPTION_MAIN_STORE_PAGE_ID; ?>">
|
129 |
<?php _e('Main storefront page', 'ecwid-shopping-cart'); ?>
|
130 |
</label>
|
131 |
<select id="<?php echo Ecwid_Store_Page::OPTION_MAIN_STORE_PAGE_ID; ?>" name="<?php echo Ecwid_Store_Page::OPTION_MAIN_STORE_PAGE_ID; ?>">
|
132 |
+
<?php foreach ( Ecwid_Store_Page::get_store_pages_array_for_selector() as $id ): ?>
|
133 |
<option
|
134 |
value="<?php echo $id; ?>"
|
135 |
<?php if ( $id == Ecwid_Store_Page::get_current_store_page_id() ): ?>
|
templates/importer/import-no-token.php
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<a class="button button-primary" href="<?php echo $this->_get_reconnect_url(); ?>"><?php _e( 'Connect', 'ecwid-shopping-cart' ); ?></a>
|
|
templates/importer/import-no-token.tpl.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<a class="button button-primary" id="reconnect-button" href="admin.php?page=<?php echo self::PAGE_SLUG_WOO; ?>&action=reconnect"><?php _e( 'Connect', 'ecwid-shopping-cart' ); ?></a>
|
templates/importer/woo-complete.tpl.php
CHANGED
@@ -20,6 +20,6 @@
|
|
20 |
</p>
|
21 |
|
22 |
<div class="errors">
|
23 |
-
<?php _e( 'Some of the
|
24 |
<pre class="details"></pre>
|
25 |
</div>
|
20 |
</p>
|
21 |
|
22 |
<div class="errors">
|
23 |
+
<?php _e( 'Some of the items could not be imported.', 'ecwid-shopping-cart' ); ?> <a class="btn-details"><?php _e( 'Details...', 'ecwid-shopping-cart' ); ?></a>
|
24 |
<pre class="details"></pre>
|
25 |
</div>
|
templates/importer/woo-main.tpl.php
CHANGED
@@ -53,7 +53,7 @@
|
|
53 |
</div>
|
54 |
|
55 |
<div class="importer-state importer-state-no-token">
|
56 |
-
<?php require __DIR__ . '/import-no-token.php'; ?>
|
57 |
</div>
|
58 |
|
59 |
<div class="importer-state importer-state-woo-in-progress">
|
53 |
</div>
|
54 |
|
55 |
<div class="importer-state importer-state-no-token">
|
56 |
+
<?php require __DIR__ . '/import-no-token.tpl.php'; ?>
|
57 |
</div>
|
58 |
|
59 |
<div class="importer-state importer-state-woo-in-progress">
|