Version Description
- Apr 11, 2018 =
- Compatibility with Gutenberg. Gutenberg editor is getting more and more popular and will soon be the default WordPress editor. To make sure Ecwid users are ready for that, we added Gutenberg support to our plugin. Now when you edit a page in Gutenberg, you will see a new "Ecwid online store" block in the editor toolbar this can be used to add a store to a page. In future updates, we will add ability to add a product widget (or a buy now button) to a post or page in Gutenberg.
- New product import tools. Some sellers copy their products to Ecwid e-commerce plugin from WooCommerce, other shopping carts or local database or spreadsheet. We made it easier to do that in Ecwid. You can now see a separate Ecwid block under Tools -> Import in the WordPress admin backend. That block allows you to import products and categories to your store from WooCommerce or external CSV file.
- New WordPress admin dashboard widget: help/educational materials for sellers. We added a new Ecwid block to the WordPress admin dashboard it features useful posts from the Ecwid ecommerce blog. The block refreshes itself automatically when we publish a new blog post. Check it to find fresh product updates and tips and recommendations from the Ecwid team on how to better set up your store and sell more.
- Revamped Ecwid menu in WordPress admin backend. This is step #2 of the menu changes implemented in the version 5.8. Historically, the Ecwid store management dashboard displayed navigation within the central page content when you open it in your WordPress admin backend. So, you open the Ecwid menu in your WP admin and then navigate through your store admin pages inside that general Ecwid page. Were improving this process: now the store admin navigation menu will be a part of the WordPress admin menu. So now you will find management/settings/apps and other sections right in the WordPress left-hand navigation sidebar. This will align the Ecwid plugin navigation with the general WordPress navigation and provide more natural way to find the right page of your store dashboard. Also, this will free some space in the page central area to make it more convenient to manage your store, especially on mobile devices.
- Minor fixes and improvements.
Download this release
Release Info
Developer | Ecwid |
Plugin | Ecwid Ecommerce Shopping Cart |
Version | 6.0 |
Comparing to | |
See all releases |
Code changes from version 5.8.2 to 6.0
- css/admin.css +46 -4
- css/dashboard-blog.css +68 -0
- css/gutenberg-block.css +26 -0
- css/importer.css +36 -0
- css/popup-deactivate.css +7 -0
- css/popup.css +0 -5
- css/settings.css +0 -18
- ecwid-shopping-cart.php +91 -25
- images/wordpress_20x20.svg +23 -0
- includes/class-ecwid-admin.php +43 -6
- includes/class-ecwid-config.php +2 -1
- includes/class-ecwid-help-page.php +1 -1
- includes/class-ecwid-integration-gutenberg.php +82 -0
- includes/class-ecwid-message-manager.php +33 -7
- includes/class-ecwid-nav-menus.php +1 -1
- includes/class-ecwid-oauth.php +31 -4
- includes/class-ecwid-popup-deactivate.php +3 -3
- includes/class-ecwid-products.php +2 -2
- includes/class-ecwid-seo-links.php +127 -17
- includes/class-ecwid-store-editor.php +5 -1
- includes/class-ecwid-store-page.php +11 -3
- includes/class-ecwid-wp-dashboard-feed.php +89 -0
- includes/importer/class-ecwid-import-page.php +146 -0
- includes/importer/class-ecwid-import.php +99 -0
- includes/importer/class-ecwid-importer-task.php +298 -0
- includes/importer/class-ecwid-importer.php +379 -0
- includes/importer/importer.php +10 -0
- includes/shortcodes/class-ecwid-shortcode-productbrowser.php +29 -3
- includes/themes.php +2 -1
- includes/themes/class-ecwid-theme-themify-music.php +23 -0
- includes/themes/class-ecwid-theme-trend.php +7 -3
- includes/widgets/class-ecwid-widget-random-product.php +1 -1
- js/admin.js +2 -0
- js/dashboard-blog.js +71 -0
- js/gutenberg-block.js +117 -0
- js/importer.js +137 -0
- js/products-list.js +2 -0
- js/store-editor-gutenberg.js +233 -0
- js/store-editor-page.js +28 -3
- languages/ecwid-shopping-cart-ru_RU.mo +0 -0
- languages/ecwid-shopping-cart-ru_RU.po +18 -0
- lib/ecwid_api_v3.php +162 -4
- lib/ecwid_platform.php +73 -0
- lib/html-catalog-templates/category.php +1 -1
- lib/html-catalog-templates/product.php +2 -2
- readme.txt +9 -1
- templates/admin-message.php +16 -15
- templates/advanced-settings.php +1 -1
- templates/dashboard-blog-posts.tpl.php +23 -0
- templates/ecwid-admin.php +8 -1
- templates/importer/import-no-token.php +1 -0
- templates/importer/landing.tpl.php +36 -0
- templates/importer/woo-complete.tpl.php +25 -0
- templates/importer/woo-in-progress.tpl.php +15 -0
- templates/importer/woo-initial.tpl.php +1 -0
- templates/importer/woo-main.tpl.php +64 -0
- templates/store-popup.php +175 -176
- templates/store-svg.php +3 -4
- templates/sync.php +1 -1
- templates/wp-toolbox.tpl.php +8 -0
css/admin.css
CHANGED
@@ -116,18 +116,18 @@ div.ecwid-message {
|
|
116 |
text-decoration: none;
|
117 |
}
|
118 |
|
119 |
-
.ecwid-message .ecwid-message-hide:not(:hover) {
|
120 |
color: #bbb;
|
121 |
}
|
122 |
|
123 |
-
.ecwid-message .ecwid-message-hide {
|
124 |
font-size: 12px;
|
125 |
font-weight: 100;
|
126 |
cursor: pointer;
|
127 |
text-decoration: none;
|
128 |
}
|
129 |
|
130 |
-
.ecwid-message .ecwid-message-hide:before {
|
131 |
content: "\e606";
|
132 |
font-family: ecwid-plugin-icons;
|
133 |
font-size: 16px;
|
@@ -160,7 +160,7 @@ div.ecwid-message {
|
|
160 |
width: 100%;
|
161 |
}
|
162 |
|
163 |
-
.ecwid-message .ecwid-message-hide:before {
|
164 |
font-size: 21px;
|
165 |
top: 5px;
|
166 |
}
|
@@ -712,3 +712,45 @@ body[class*="_page_ecwid"] .ecwid-message {
|
|
712 |
.ecwid-admin-iframe .update-nag {
|
713 |
display: none;
|
714 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
text-decoration: none;
|
117 |
}
|
118 |
|
119 |
+
.ecwid-message .ecwid-message-hide:not(:hover):not(.button) {
|
120 |
color: #bbb;
|
121 |
}
|
122 |
|
123 |
+
.ecwid-message .ecwid-message-hide:not(.button) {
|
124 |
font-size: 12px;
|
125 |
font-weight: 100;
|
126 |
cursor: pointer;
|
127 |
text-decoration: none;
|
128 |
}
|
129 |
|
130 |
+
.ecwid-message .ecwid-message-hide:not(.button):before {
|
131 |
content: "\e606";
|
132 |
font-family: ecwid-plugin-icons;
|
133 |
font-size: 16px;
|
160 |
width: 100%;
|
161 |
}
|
162 |
|
163 |
+
.ecwid-message .ecwid-message-hide:before:not(.button) {
|
164 |
font-size: 21px;
|
165 |
top: 5px;
|
166 |
}
|
712 |
.ecwid-admin-iframe .update-nag {
|
713 |
display: none;
|
714 |
}
|
715 |
+
|
716 |
+
/* progress recycling icon */
|
717 |
+
|
718 |
+
.progress-indicator svg {
|
719 |
+
animation-name: progress-rotation;
|
720 |
+
animation-duration: 1s;
|
721 |
+
animation-iteration-count: infinite;
|
722 |
+
animation-timing-function: linear;
|
723 |
+
display: inline-block;
|
724 |
+
vertical-align: middle;
|
725 |
+
}
|
726 |
+
|
727 |
+
.progress-indicator svg path {
|
728 |
+
fill: #298CBA;
|
729 |
+
|
730 |
+
}
|
731 |
+
.progress-indicator .icon {
|
732 |
+
width: 30px;
|
733 |
+
}
|
734 |
+
.progress-message {
|
735 |
+
padding-left: 30px;
|
736 |
+
}
|
737 |
+
|
738 |
+
.progress-indicator .icon,
|
739 |
+
.progress-indicator .inline-note {
|
740 |
+
display: table-cell;
|
741 |
+
vertical-align: middle;
|
742 |
+
}
|
743 |
+
|
744 |
+
.progress-indicator .inline-note {
|
745 |
+
line-height: 26px;
|
746 |
+
color: #298CBA;
|
747 |
+
font-weight: 600;
|
748 |
+
}
|
749 |
+
.progress-message {
|
750 |
+
font-weight: 600;
|
751 |
+
}
|
752 |
+
|
753 |
+
@keyframes progress-rotation {
|
754 |
+
0% {transform:rotate(0deg);}
|
755 |
+
100% {transform:rotate(360deg);}
|
756 |
+
}
|
css/dashboard-blog.css
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#ecwid_blog_feed .template-container {
|
2 |
+
display: none;
|
3 |
+
}
|
4 |
+
|
5 |
+
#ecwid_blog_feed .ecwid-blog-post-image-container .ecwid-blog-post-image {
|
6 |
+
-webkit-background-size: cover;
|
7 |
+
-o-background-size: cover;
|
8 |
+
-moz-background-size: cover;
|
9 |
+
background-size: cover;
|
10 |
+
width: 120px;
|
11 |
+
height: 80px;
|
12 |
+
background-position: 50% 50%;
|
13 |
+
margin-top: 4px;
|
14 |
+
}
|
15 |
+
|
16 |
+
#ecwid_blog_feed .inside {
|
17 |
+
margin: 0;
|
18 |
+
padding: 0;
|
19 |
+
}
|
20 |
+
|
21 |
+
#ecwid_blog_feed .ecwid-blog-posts {
|
22 |
+
margin: 10px 12px;
|
23 |
+
}
|
24 |
+
|
25 |
+
#ecwid_blog_feed .ecwid-blog-post {
|
26 |
+
vertical-align: middle;
|
27 |
+
margin-bottom: 20px;
|
28 |
+
}
|
29 |
+
|
30 |
+
.ecwid-blog-post-image-container,
|
31 |
+
.ecwid-blog-post-text-container {
|
32 |
+
display: table-cell;
|
33 |
+
}
|
34 |
+
|
35 |
+
.ecwid-blog-post-text-container {
|
36 |
+
vertical-align: top;
|
37 |
+
}
|
38 |
+
|
39 |
+
#ecwid_blog_feed .ecwid-blog-post:last-child {
|
40 |
+
margin-bottom: 0;
|
41 |
+
}
|
42 |
+
|
43 |
+
#ecwid_blog_feed .ecwid-blog-post-title,
|
44 |
+
#ecwid_blog_feed .ecwid-blog-post-excerpt
|
45 |
+
{
|
46 |
+
margin-left: 10px;
|
47 |
+
display: inline-block;
|
48 |
+
}
|
49 |
+
|
50 |
+
#ecwid_blog_feed .ecwid-blog-post-title {
|
51 |
+
font-size: 14px;
|
52 |
+
font-weight: 600;
|
53 |
+
}
|
54 |
+
|
55 |
+
#ecwid_blog_feed .ecwid-blog-post-excerpt {
|
56 |
+
margin-top: 3px;
|
57 |
+
margin-bottom: 0;
|
58 |
+
}
|
59 |
+
|
60 |
+
#ecwid_blog_feed .ecwid-blog-post-excerpt p {
|
61 |
+
margin: 0;
|
62 |
+
}
|
63 |
+
|
64 |
+
.ecwid-blog-footer {
|
65 |
+
border-top: 1px solid #eee;
|
66 |
+
padding: 10px 12px;
|
67 |
+
color: #ddd;
|
68 |
+
}
|
css/gutenberg-block.css
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.editor-block-list__block[data-type="ecwid/store-block"] .editor-block-list__block-edit {
|
2 |
+
text-align: center;
|
3 |
+
min-height: 200px;
|
4 |
+
background: no-repeat 50% 30px #F1F1F1;
|
5 |
+
outline: 1px solid #E7E7E7;
|
6 |
+
background-size: 400px;
|
7 |
+
}
|
8 |
+
|
9 |
+
.ecwid-store-block-icon {
|
10 |
+
background: url('../images/wordpress_20x20.svg');
|
11 |
+
background-size: contain;
|
12 |
+
width: 20px;
|
13 |
+
height: 20px;
|
14 |
+
margin-bottom: 3px;
|
15 |
+
}
|
16 |
+
|
17 |
+
.ecwid-store-block {
|
18 |
+
position: relative;
|
19 |
+
}
|
20 |
+
|
21 |
+
.ecwid-store-block-button {
|
22 |
+
font-family: Open Sans, Trebuchet MS, Helvetica, Verdana, sans-serif;
|
23 |
+
position: relative;
|
24 |
+
top:135px;
|
25 |
+
font-size: 14px;
|
26 |
+
}
|
css/importer.css
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.ecwid-importer .importer-state {
|
2 |
+
display: none;
|
3 |
+
}
|
4 |
+
|
5 |
+
.ecwid-importer.state-no-token .importer-state-no-token,
|
6 |
+
.ecwid-importer.state-woo-initial .importer-state-woo-initial,
|
7 |
+
.ecwid-importer.state-woo-in-progress .importer-state-woo-in-progress,
|
8 |
+
.ecwid-importer.state-woo-complete .importer-state-woo-complete
|
9 |
+
{
|
10 |
+
display: block;
|
11 |
+
}
|
12 |
+
|
13 |
+
.ecwid-importer .readonly {
|
14 |
+
color: lightgray;
|
15 |
+
}
|
16 |
+
|
17 |
+
.ecwid-importer .readonly input {
|
18 |
+
background-color: lightgray;
|
19 |
+
}
|
20 |
+
|
21 |
+
.ecwid-importer .errors {
|
22 |
+
display: none;
|
23 |
+
}
|
24 |
+
.ecwid-importer .errors .btn-details {
|
25 |
+
cursor: pointer;
|
26 |
+
}
|
27 |
+
.ecwid-importer .errors .details {
|
28 |
+
display: none;
|
29 |
+
border: 1px solid gray;
|
30 |
+
background: rgba(255,255,255,.5);
|
31 |
+
padding: 5px;
|
32 |
+
}
|
33 |
+
|
34 |
+
.plan-limit-message {
|
35 |
+
display: none;
|
36 |
+
}
|
css/popup-deactivate.css
CHANGED
@@ -18,4 +18,11 @@
|
|
18 |
|
19 |
.bottom-support-link {
|
20 |
text-align: right;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
}
|
18 |
|
19 |
.bottom-support-link {
|
20 |
text-align: right;
|
21 |
+
}
|
22 |
+
|
23 |
+
.ecwid-popup .ecwid-popup-window {
|
24 |
+
left: 50%;
|
25 |
+
margin-left: -298px;
|
26 |
+
top: 10%;
|
27 |
+
width: 596px;
|
28 |
}
|
css/popup.css
CHANGED
@@ -20,11 +20,6 @@ body.ecwid-popup-open {
|
|
20 |
.ecwid-popup .ecwid-popup-window {
|
21 |
background: white;
|
22 |
position: absolute;
|
23 |
-
left: 50%;
|
24 |
-
margin-left: -298px;
|
25 |
-
top: 10%;
|
26 |
-
z-index: 100001;
|
27 |
-
width: 596px;
|
28 |
}
|
29 |
|
30 |
.ecwid-popup-header, .ecwid-popup-footer, .ecwid-popup-body {
|
20 |
.ecwid-popup .ecwid-popup-window {
|
21 |
background: white;
|
22 |
position: absolute;
|
|
|
|
|
|
|
|
|
|
|
23 |
}
|
24 |
|
25 |
.ecwid-popup-header, .ecwid-popup-footer, .ecwid-popup-body {
|
css/settings.css
CHANGED
@@ -805,19 +805,6 @@ label.premium-feature svg path {
|
|
805 |
font-weight: 600;
|
806 |
}
|
807 |
|
808 |
-
#updating svg {
|
809 |
-
animation-name: rotation;
|
810 |
-
animation-duration: 1s;
|
811 |
-
animation-iteration-count: infinite;
|
812 |
-
animation-timing-function: linear;
|
813 |
-
display: inline-block;
|
814 |
-
vertical-align: middle;
|
815 |
-
}
|
816 |
-
|
817 |
-
#updating svg path {
|
818 |
-
fill: #298CBA;
|
819 |
-
}
|
820 |
-
|
821 |
.sync-block#updating > div {
|
822 |
display: table-cell;
|
823 |
vertical-align: middle;
|
@@ -829,9 +816,4 @@ label.premium-feature svg path {
|
|
829 |
|
830 |
.sync-block#updating .sync-icon {
|
831 |
width: 30px;
|
832 |
-
}
|
833 |
-
|
834 |
-
@keyframes rotation {
|
835 |
-
0% {transform:rotate(0deg);}
|
836 |
-
100% {transform:rotate(360deg);}
|
837 |
}
|
805 |
font-weight: 600;
|
806 |
}
|
807 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
808 |
.sync-block#updating > div {
|
809 |
display: table-cell;
|
810 |
vertical-align: middle;
|
816 |
|
817 |
.sync-block#updating .sync-icon {
|
818 |
width: 30px;
|
|
|
|
|
|
|
|
|
|
|
819 |
}
|
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:
|
9 |
Author URI: http://www.ecwid.com?source=wporg
|
10 |
*/
|
11 |
|
@@ -23,6 +23,10 @@ if ( ! defined( 'ECWID_PLUGIN_DIR' ) ) {
|
|
23 |
define( 'ECWID_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
24 |
}
|
25 |
|
|
|
|
|
|
|
|
|
26 |
if ( ! defined( 'ECWID_PLUGIN_BASENAME' ) ) {
|
27 |
define( 'ECWID_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
28 |
}
|
@@ -128,6 +132,8 @@ require_once ECWID_PLUGIN_DIR . 'lib/ecwid_category.php';
|
|
128 |
require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-nav-menus.php';
|
129 |
require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-seo-links.php';
|
130 |
require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-html-meta.php';
|
|
|
|
|
131 |
|
132 |
$ecwid_script_rendered = false; // controls single script.js on page
|
133 |
|
@@ -137,7 +143,6 @@ foreach (Ecwid_Shortcode_Base::get_store_shortcode_names() as $shortcode_name) {
|
|
137 |
add_shortcode( $shortcode_name, 'ecwid_shortcode' );
|
138 |
}
|
139 |
|
140 |
-
|
141 |
function ecwid_init_integrations()
|
142 |
{
|
143 |
if ( !function_exists( 'get_plugins' ) ) { require_once ( ABSPATH . 'wp-admin/includes/plugin.php' ); }
|
@@ -148,9 +153,14 @@ function ecwid_init_integrations()
|
|
148 |
'wordpress-seo-premium/wp-seo-premium.php' => 'wpseo',
|
149 |
'divi-builder/divi-builder.php' => 'divibuilder',
|
150 |
'autoptimize/autoptimize.php' => 'autoptimize',
|
151 |
-
'above-the-fold-optimization/abovethefold.php' => 'above-the-fold'
|
152 |
);
|
153 |
|
|
|
|
|
|
|
|
|
|
|
154 |
foreach ( $integrations as $plugin => $class ) {
|
155 |
if ( is_plugin_active( $plugin ) ) {
|
156 |
require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-integration-' . $class . '.php';
|
@@ -1406,6 +1416,11 @@ function ecwid_get_scriptjs_params( $force_lang = null ) {
|
|
1406 |
$params .= '&data_no_apiv3=1';
|
1407 |
}
|
1408 |
|
|
|
|
|
|
|
|
|
|
|
1409 |
return $params;
|
1410 |
}
|
1411 |
|
@@ -1514,7 +1529,7 @@ function ecwid_shortcode($attributes)
|
|
1514 |
unset($widgets[$key]);
|
1515 |
}
|
1516 |
}
|
1517 |
-
|
1518 |
if (empty($widgets)) {
|
1519 |
$widgets = array('productbrowser');
|
1520 |
}
|
@@ -1595,7 +1610,7 @@ function ecwid_store_activate() {
|
|
1595 |
EOT;
|
1596 |
add_option("ecwid_store_page_id", '', '', 'yes');
|
1597 |
|
1598 |
-
add_option("ecwid_store_id",
|
1599 |
|
1600 |
add_option("ecwid_enable_minicart", 'Y', '', 'yes');
|
1601 |
add_option("ecwid_show_categories", '', '', 'yes');
|
@@ -1787,6 +1802,9 @@ function ecwid_get_update_params_options() {
|
|
1787 |
'ecwid_store_id' => array(
|
1788 |
'type' => 'string'
|
1789 |
),
|
|
|
|
|
|
|
1790 |
'ecwid_ajax_defer_rendering' => array(
|
1791 |
'values' => array(
|
1792 |
'on',
|
@@ -1908,6 +1926,13 @@ function ecwid_reset_categories_cache()
|
|
1908 |
EcwidPlatform::cache_reset( 'all_categories' );
|
1909 |
}
|
1910 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1911 |
function ecwid_register_admin_styles($hook_suffix) {
|
1912 |
|
1913 |
wp_enqueue_style('ecwid-admin-css', ECWID_PLUGIN_URL . 'css/admin.css', array(), get_option('ecwid_plugin_version'));
|
@@ -1915,7 +1940,7 @@ function ecwid_register_admin_styles($hook_suffix) {
|
|
1915 |
|
1916 |
if (isset($_GET['page']) && strpos($_GET['page'], 'ec-store') === 0) {
|
1917 |
|
1918 |
-
if (get_option('ecwid_store_id')
|
1919 |
// Open dashboard for the first time, ecwid store id is set to demo => need landing styles/scripts
|
1920 |
wp_enqueue_script('ecwid-landing-js', ECWID_PLUGIN_URL . 'js/landing.js', array(), get_option('ecwid_plugin_version'));
|
1921 |
wp_localize_script('ecwid-landing-js', 'ecwidParams', array(
|
@@ -1948,7 +1973,7 @@ function ecwid_register_settings_styles($hook_suffix) {
|
|
1948 |
|
1949 |
function ecwid_plugin_actions($links) {
|
1950 |
$settings_link = "<a href='" . Ecwid_Admin::get_dashboard_url() . "'>"
|
1951 |
-
. (
|
1952 |
. "</a>";
|
1953 |
array_unshift( $links, $settings_link );
|
1954 |
|
@@ -2005,6 +2030,7 @@ function ecwid_settings_api_init() {
|
|
2005 |
|
2006 |
function ecwid_common_admin_scripts() {
|
2007 |
|
|
|
2008 |
wp_enqueue_script('ecwid-admin-js', ECWID_PLUGIN_URL . 'js/admin.js', array(), get_option('ecwid_plugin_version'));
|
2009 |
wp_enqueue_script('ecwid-modernizr-js', ECWID_PLUGIN_URL . 'js/modernizr.js', array(), get_option('ecwid_plugin_version'));
|
2010 |
|
@@ -2026,7 +2052,9 @@ function ecwid_common_admin_scripts() {
|
|
2026 |
}
|
2027 |
|
2028 |
function ecwid_is_legacy_appearance_used() {
|
2029 |
-
|
|
|
|
|
2030 |
}
|
2031 |
|
2032 |
function ecwid_get_register_link()
|
@@ -2067,6 +2095,42 @@ function ecwid_get_register_link()
|
|
2067 |
return $link;
|
2068 |
}
|
2069 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2070 |
function ecwid_create_store() {
|
2071 |
$api = new Ecwid_Api_V3();
|
2072 |
|
@@ -2078,7 +2142,7 @@ function ecwid_create_store() {
|
|
2078 |
ecwid_update_store_id($data->id);
|
2079 |
|
2080 |
$api->save_token( $data->token );
|
2081 |
-
update_option( 'ecwid_oauth_scope', 'read_profile
|
2082 |
|
2083 |
header( 'HTTP/1.1 200 OK' );
|
2084 |
|
@@ -2093,7 +2157,7 @@ function ecwid_general_settings_do_page() {
|
|
2093 |
|
2094 |
$connection_error = isset( $_GET['connection_error'] );
|
2095 |
|
2096 |
-
if (
|
2097 |
$no_oauth = @$_GET['oauth'] == 'no';
|
2098 |
|
2099 |
$there_was_oauth_error = isset( $connection_error ) && $no_oauth;
|
@@ -2217,8 +2281,8 @@ function ecwid_admin_do_page( $page ) {
|
|
2217 |
|
2218 |
global $ecwid_oauth;
|
2219 |
|
2220 |
-
if (isset($_GET['
|
2221 |
-
$page = $_GET['
|
2222 |
}
|
2223 |
|
2224 |
if (isset($_GET['ec-store-page']) && $_GET['ec-store-page']) {
|
@@ -2326,7 +2390,7 @@ function ecwid_process_oauth_params() {
|
|
2326 |
}
|
2327 |
|
2328 |
global $ecwid_oauth;
|
2329 |
-
$is_connect =
|
2330 |
|
2331 |
$is_reconnect = isset($_GET['reconnect']) && !isset($_GET['connection_error']);
|
2332 |
|
@@ -2343,6 +2407,10 @@ function ecwid_process_oauth_params() {
|
|
2343 |
'return_url' => isset($_GET['return-url']) ? $_GET['return-url'] : '',
|
2344 |
'reason' => isset($_GET['reason']) ? $_GET['reason'] : ''
|
2345 |
));
|
|
|
|
|
|
|
|
|
2346 |
}
|
2347 |
}
|
2348 |
|
@@ -2412,6 +2480,10 @@ function ecwid_get_categories_for_selector() {
|
|
2412 |
|
2413 |
$all_categories = array();
|
2414 |
|
|
|
|
|
|
|
|
|
2415 |
foreach ( $categories->items as $category ) {
|
2416 |
$all_categories[$category->id] = $category;
|
2417 |
}
|
@@ -2454,11 +2526,13 @@ function ecwid_get_categories_for_selector() {
|
|
2454 |
}
|
2455 |
}
|
2456 |
|
2457 |
-
|
2458 |
-
|
|
|
|
|
2459 |
}
|
2460 |
|
2461 |
-
usort( $result, '
|
2462 |
|
2463 |
EcwidPlatform::store_in_categories_cache( 'ecwid_categories_for_selector', $result );
|
2464 |
|
@@ -2497,8 +2571,6 @@ function ecwid_debug_do_page() {
|
|
2497 |
ecwid_invalidate_cache(true );
|
2498 |
}
|
2499 |
|
2500 |
-
$remote_get_results = wp_remote_get( 'http://app.ecwid.com/api/v1/' . get_ecwid_store_id() . '/profile' );
|
2501 |
-
|
2502 |
$api_v3_profile_results = wp_remote_get( 'https://app.ecwid.com/api/v3/' . get_ecwid_store_id() . '/profile?token=' . Ecwid_Api_V3::get_token() );
|
2503 |
|
2504 |
global $ecwid_oauth;
|
@@ -2528,7 +2600,7 @@ function get_ecwid_store_id() {
|
|
2528 |
|
2529 |
$store_id = get_option('ecwid_store_id');
|
2530 |
if (empty($store_id)) {
|
2531 |
-
$store_id =
|
2532 |
}
|
2533 |
|
2534 |
return $store_id;
|
@@ -2692,12 +2764,6 @@ function ecwid_add_dashboard_widgets() {
|
|
2692 |
}
|
2693 |
}
|
2694 |
|
2695 |
-
function ecwid_get_store_page_base_url( $page = 0 ) {
|
2696 |
-
|
2697 |
-
$url = parse_url( get_permalink( $page ) );
|
2698 |
-
return $url['path'];
|
2699 |
-
}
|
2700 |
-
|
2701 |
function ecwid_get_store_page_url()
|
2702 |
{
|
2703 |
static $link = null;
|
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.0
|
9 |
Author URI: http://www.ecwid.com?source=wporg
|
10 |
*/
|
11 |
|
23 |
define( 'ECWID_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
24 |
}
|
25 |
|
26 |
+
if ( !defined( 'ECWID_TEMPLATES_DIR' ) ) {
|
27 |
+
define ( 'ECWID_TEMPLATES_DIR', ECWID_PLUGIN_DIR . 'templates' );
|
28 |
+
}
|
29 |
+
|
30 |
if ( ! defined( 'ECWID_PLUGIN_BASENAME' ) ) {
|
31 |
define( 'ECWID_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
32 |
}
|
132 |
require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-nav-menus.php';
|
133 |
require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-seo-links.php';
|
134 |
require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-html-meta.php';
|
135 |
+
require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-wp-dashboard-feed.php';
|
136 |
+
require_once ECWID_PLUGIN_DIR . 'includes/importer/importer.php';
|
137 |
|
138 |
$ecwid_script_rendered = false; // controls single script.js on page
|
139 |
|
143 |
add_shortcode( $shortcode_name, 'ecwid_shortcode' );
|
144 |
}
|
145 |
|
|
|
146 |
function ecwid_init_integrations()
|
147 |
{
|
148 |
if ( !function_exists( 'get_plugins' ) ) { require_once ( ABSPATH . 'wp-admin/includes/plugin.php' ); }
|
153 |
'wordpress-seo-premium/wp-seo-premium.php' => 'wpseo',
|
154 |
'divi-builder/divi-builder.php' => 'divibuilder',
|
155 |
'autoptimize/autoptimize.php' => 'autoptimize',
|
156 |
+
'above-the-fold-optimization/abovethefold.php' => 'above-the-fold'
|
157 |
);
|
158 |
|
159 |
+
|
160 |
+
if (version_compare( phpversion(), '5.3', '>' ) ) {
|
161 |
+
$integrations['gutenberg/gutenberg.php'] = 'gutenberg';
|
162 |
+
}
|
163 |
+
|
164 |
foreach ( $integrations as $plugin => $class ) {
|
165 |
if ( is_plugin_active( $plugin ) ) {
|
166 |
require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-integration-' . $class . '.php';
|
1416 |
$params .= '&data_no_apiv3=1';
|
1417 |
}
|
1418 |
|
1419 |
+
require_once ECWID_PLUGIN_DIR . '/includes/importer/importer.php';
|
1420 |
+
if ( class_exists( 'Ecwid_Importer' ) && get_option( Ecwid_Importer::OPTION_WOO_CATALOG_IMPORTED ) ) {
|
1421 |
+
$params .= '&data_imported=1';
|
1422 |
+
}
|
1423 |
+
|
1424 |
return $params;
|
1425 |
}
|
1426 |
|
1529 |
unset($widgets[$key]);
|
1530 |
}
|
1531 |
}
|
1532 |
+
|
1533 |
if (empty($widgets)) {
|
1534 |
$widgets = array('productbrowser');
|
1535 |
}
|
1610 |
EOT;
|
1611 |
add_option("ecwid_store_page_id", '', '', 'yes');
|
1612 |
|
1613 |
+
add_option("ecwid_store_id", ecwid_get_demo_store_id(), '', 'yes');
|
1614 |
|
1615 |
add_option("ecwid_enable_minicart", 'Y', '', 'yes');
|
1616 |
add_option("ecwid_show_categories", '', '', 'yes');
|
1802 |
'ecwid_store_id' => array(
|
1803 |
'type' => 'string'
|
1804 |
),
|
1805 |
+
'ecwid_store_page_id' => array(
|
1806 |
+
'type' => 'string'
|
1807 |
+
),
|
1808 |
'ecwid_ajax_defer_rendering' => array(
|
1809 |
'values' => array(
|
1810 |
'on',
|
1926 |
EcwidPlatform::cache_reset( 'all_categories' );
|
1927 |
}
|
1928 |
|
1929 |
+
add_action( 'tool_box', 'ecwid_add_toolbox' );
|
1930 |
+
|
1931 |
+
function ecwid_add_toolbox() {
|
1932 |
+
|
1933 |
+
require ECWID_PLUGIN_DIR . 'templates/wp-toolbox.tpl.php';
|
1934 |
+
}
|
1935 |
+
|
1936 |
function ecwid_register_admin_styles($hook_suffix) {
|
1937 |
|
1938 |
wp_enqueue_style('ecwid-admin-css', ECWID_PLUGIN_URL . 'css/admin.css', array(), get_option('ecwid_plugin_version'));
|
1940 |
|
1941 |
if (isset($_GET['page']) && strpos($_GET['page'], 'ec-store') === 0) {
|
1942 |
|
1943 |
+
if ( ecwid_is_demo_store( get_option('ecwid_store_id') ) ) {
|
1944 |
// Open dashboard for the first time, ecwid store id is set to demo => need landing styles/scripts
|
1945 |
wp_enqueue_script('ecwid-landing-js', ECWID_PLUGIN_URL . 'js/landing.js', array(), get_option('ecwid_plugin_version'));
|
1946 |
wp_localize_script('ecwid-landing-js', 'ecwidParams', array(
|
1973 |
|
1974 |
function ecwid_plugin_actions($links) {
|
1975 |
$settings_link = "<a href='" . Ecwid_Admin::get_dashboard_url() . "'>"
|
1976 |
+
. ( ecwid_is_demo_store() ? __('Setup', 'ecwid-shopping-cart') : __('Settings') )
|
1977 |
. "</a>";
|
1978 |
array_unshift( $links, $settings_link );
|
1979 |
|
2030 |
|
2031 |
function ecwid_common_admin_scripts() {
|
2032 |
|
2033 |
+
ecwid_get_demo_store_id();
|
2034 |
wp_enqueue_script('ecwid-admin-js', ECWID_PLUGIN_URL . 'js/admin.js', array(), get_option('ecwid_plugin_version'));
|
2035 |
wp_enqueue_script('ecwid-modernizr-js', ECWID_PLUGIN_URL . 'js/modernizr.js', array(), get_option('ecwid_plugin_version'));
|
2036 |
|
2052 |
}
|
2053 |
|
2054 |
function ecwid_is_legacy_appearance_used() {
|
2055 |
+
$api = new Ecwid_Api_V3();
|
2056 |
+
|
2057 |
+
return !$api->is_store_feature_enabled( Ecwid_Api_V3::FEATURE_NEW_PRODUCT_LIST );
|
2058 |
}
|
2059 |
|
2060 |
function ecwid_get_register_link()
|
2095 |
return $link;
|
2096 |
}
|
2097 |
|
2098 |
+
function ecwid_is_demo_store( $store_id = null ) {
|
2099 |
+
|
2100 |
+
if ( is_null( $store_id ) ) {
|
2101 |
+
$store_id = get_ecwid_store_id();
|
2102 |
+
}
|
2103 |
+
|
2104 |
+
$config_id = Ecwid_Config::get_demo_store_id();
|
2105 |
+
if ( $config_id ) return $config_id;
|
2106 |
+
|
2107 |
+
return in_array( $store_id, ecwid_get_demo_stores() );
|
2108 |
+
}
|
2109 |
+
|
2110 |
+
function ecwid_get_demo_store_id() {
|
2111 |
+
$config_id = Ecwid_Config::get_demo_store_id();
|
2112 |
+
if ( $config_id ) return $config_id;
|
2113 |
+
|
2114 |
+
$demo_stores = ecwid_get_demo_stores();
|
2115 |
+
|
2116 |
+
$locale = get_locale();
|
2117 |
+
|
2118 |
+
if ( strpos( $locale, 'ru' ) === 0 ) {
|
2119 |
+
return $demo_stores['locale_ru'];
|
2120 |
+
} else {
|
2121 |
+
return $demo_stores['locale_other'];
|
2122 |
+
}
|
2123 |
+
}
|
2124 |
+
|
2125 |
+
function ecwid_get_demo_stores() {
|
2126 |
+
return $demo_stores = array(
|
2127 |
+
'legacy' => 1003,
|
2128 |
+
'locale_ru' => 13437191,
|
2129 |
+
'locale_other' => 13433173
|
2130 |
+
);
|
2131 |
+
|
2132 |
+
}
|
2133 |
+
|
2134 |
function ecwid_create_store() {
|
2135 |
$api = new Ecwid_Api_V3();
|
2136 |
|
2142 |
ecwid_update_store_id($data->id);
|
2143 |
|
2144 |
$api->save_token( $data->token );
|
2145 |
+
update_option( 'ecwid_oauth_scope', 'read_profile ' . Ecwid_OAuth::SCOPE_READ_CATALOG . ' allow_sso create_customers public_storefront' );
|
2146 |
|
2147 |
header( 'HTTP/1.1 200 OK' );
|
2148 |
|
2157 |
|
2158 |
$connection_error = isset( $_GET['connection_error'] );
|
2159 |
|
2160 |
+
if ( ecwid_is_demo_store() && !Ecwid_Config::overrides_token() ) {
|
2161 |
$no_oauth = @$_GET['oauth'] == 'no';
|
2162 |
|
2163 |
$there_was_oauth_error = isset( $connection_error ) && $no_oauth;
|
2281 |
|
2282 |
global $ecwid_oauth;
|
2283 |
|
2284 |
+
if (isset($_GET['ec-page']) && $_GET['ec-page']) {
|
2285 |
+
$page = $_GET['ec-page'];
|
2286 |
}
|
2287 |
|
2288 |
if (isset($_GET['ec-store-page']) && $_GET['ec-store-page']) {
|
2390 |
}
|
2391 |
|
2392 |
global $ecwid_oauth;
|
2393 |
+
$is_connect = ecwid_is_demo_store() && !isset($_GET['connection_error']);
|
2394 |
|
2395 |
$is_reconnect = isset($_GET['reconnect']) && !isset($_GET['connection_error']);
|
2396 |
|
2407 |
'return_url' => isset($_GET['return-url']) ? $_GET['return-url'] : '',
|
2408 |
'reason' => isset($_GET['reason']) ? $_GET['reason'] : ''
|
2409 |
));
|
2410 |
+
|
2411 |
+
if ( @$_GET['do_reconnect'] ) {
|
2412 |
+
wp_redirect( $ecwid_oauth->get_auth_dialog_url() );
|
2413 |
+
}
|
2414 |
}
|
2415 |
}
|
2416 |
|
2480 |
|
2481 |
$all_categories = array();
|
2482 |
|
2483 |
+
if ( !$categories || @$categories->count == 0 ) {
|
2484 |
+
return array();
|
2485 |
+
}
|
2486 |
+
|
2487 |
foreach ( $categories->items as $category ) {
|
2488 |
$all_categories[$category->id] = $category;
|
2489 |
}
|
2526 |
}
|
2527 |
}
|
2528 |
|
2529 |
+
if (!function_exists('_ecwid_compare_categories')) {
|
2530 |
+
function _ecwid_compare_categories($cat1, $cat2) {
|
2531 |
+
return strcasecmp( $cat1->path, $cat2->path );
|
2532 |
+
}
|
2533 |
}
|
2534 |
|
2535 |
+
usort( $result, '_ecwid_compare_categories' );
|
2536 |
|
2537 |
EcwidPlatform::store_in_categories_cache( 'ecwid_categories_for_selector', $result );
|
2538 |
|
2571 |
ecwid_invalidate_cache(true );
|
2572 |
}
|
2573 |
|
|
|
|
|
2574 |
$api_v3_profile_results = wp_remote_get( 'https://app.ecwid.com/api/v3/' . get_ecwid_store_id() . '/profile?token=' . Ecwid_Api_V3::get_token() );
|
2575 |
|
2576 |
global $ecwid_oauth;
|
2600 |
|
2601 |
$store_id = get_option('ecwid_store_id');
|
2602 |
if (empty($store_id)) {
|
2603 |
+
$store_id = ecwid_get_demo_store_id();
|
2604 |
}
|
2605 |
|
2606 |
return $store_id;
|
2764 |
}
|
2765 |
}
|
2766 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2767 |
function ecwid_get_store_page_url()
|
2768 |
{
|
2769 |
static $link = null;
|
images/wordpress_20x20.svg
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
3 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
4 |
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
5 |
+
viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">
|
6 |
+
<path fill="#555d66" d="M15.32,15.58c-0.37,0-0.66,0.3-0.66,0.67c0,0.37,0.3,0.67,0.66,0.67c0.37,0,0.67-0.3,0.67-0.67
|
7 |
+
C15.98,15.88,15.69,15.58,15.32,15.58z"/>
|
8 |
+
<path fill="#555d66" d="M15.45,0H4.55C2.04,0,0,2.04,0,4.55v10.91C0,17.97,2.04,20,4.55,20h10.91c2.51,0,4.55-2.04,4.55-4.55V4.55
|
9 |
+
C20,2.04,17.96,0,15.45,0z M12.97,4.94C13.54,4.94,14,5.4,14,5.96s-0.46,1.03-1.03,1.03c-0.57,0-1.03-0.46-1.03-1.03
|
10 |
+
C11.95,5.4,12.41,4.94,12.97,4.94z M12.97,8.02c0.57,0,1.03,0.46,1.03,1.03c0,0.57-0.46,1.03-1.03,1.03c-0.57,0-1.03-0.46-1.03-1.03
|
11 |
+
C11.95,8.48,12.41,8.02,12.97,8.02z M9.98,4.94c0.57,0,1.03,0.46,1.03,1.03s-0.46,1.03-1.03,1.03c-0.57,0-1.03-0.46-1.03-1.03
|
12 |
+
C8.95,5.4,9.41,4.94,9.98,4.94z M9.98,8.02c0.57,0,1.03,0.46,1.03,1.03s-0.46,1.03-1.03,1.03c-0.57,0-1.03-0.46-1.03-1.03
|
13 |
+
C8.95,8.48,9.41,8.02,9.98,8.02z M7.03,4.94c0.57,0,1.03,0.46,1.03,1.03S7.6,6.99,7.03,6.99C6.46,6.99,6,6.53,6,5.96
|
14 |
+
C6,5.4,6.46,4.94,7.03,4.94z M7.03,8.02c0.57,0,1.03,0.46,1.03,1.03s-0.46,1.03-1.03,1.03C6.46,10.08,6,9.62,6,9.05
|
15 |
+
C6,8.48,6.46,8.02,7.03,8.02z M4.6,18.02c-1.02,0-1.86-0.83-1.86-1.86c0-1.03,0.83-1.86,1.86-1.86c1.03,0,1.86,0.83,1.86,1.86
|
16 |
+
C6.45,17.19,5.62,18.02,4.6,18.02z M15.32,18.1c-1.02,0-1.86-0.83-1.86-1.86c0-1.03,0.83-1.86,1.86-1.86c1.03,0,1.86,0.83,1.86,1.86
|
17 |
+
C17.17,17.27,16.34,18.1,15.32,18.1z M18.48,2.79l-1.92,7.14c-0.51,1.91-2.03,3.1-4,3.1H7.2c-1.91,0-3.26-1.09-3.84-2.91L1.73,5
|
18 |
+
C1.7,4.9,1.72,4.79,1.78,4.71c0.06-0.09,0.16-0.14,0.27-0.14l0.31,0c0.75,0,1.41,0.49,1.64,1.2l1.2,3.76
|
19 |
+
c0.32,1.02,1.26,1.7,2.33,1.7h4.81c1.1,0,2.08-0.74,2.36-1.81l1.55-5.78c0.2-0.75,0.89-1.28,1.67-1.28h0.24
|
20 |
+
c0.1,0,0.2,0.05,0.26,0.13C18.48,2.58,18.5,2.68,18.48,2.79z"/>
|
21 |
+
<path fill="#555d66" d="M4.6,15.5c-0.37,0-0.66,0.3-0.66,0.67c0,0.37,0.3,0.67,0.66,0.67c0.37,0,0.67-0.3,0.67-0.67
|
22 |
+
S4.96,15.5,4.6,15.5z"/>
|
23 |
+
</svg>
|
includes/class-ecwid-admin.php
CHANGED
@@ -35,8 +35,7 @@ class Ecwid_Admin {
|
|
35 |
|
36 |
public function build_menu()
|
37 |
{
|
38 |
-
|
39 |
-
$is_newbie = get_ecwid_store_id() == Ecwid_Config::get_demo_store_id();
|
40 |
|
41 |
add_menu_page(
|
42 |
sprintf(__('%s shopping cart settings', 'ecwid-shopping-cart'), Ecwid_Config::get_brand()),
|
@@ -164,6 +163,29 @@ class Ecwid_Admin {
|
|
164 |
foreach ($pages as $page) {
|
165 |
add_submenu_page( '', 'Legacy', '', 'manage_options', $page, array( $this, 'do_ec_redirect' ) );
|
166 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
}
|
168 |
|
169 |
public function do_admin_page()
|
@@ -171,11 +193,26 @@ class Ecwid_Admin {
|
|
171 |
$menus = $this->_get_menus();
|
172 |
|
173 |
$admin_prefix = self::ADMIN_SLUG . '-admin-';
|
174 |
-
$
|
175 |
-
$slug = substr( get_current_screen()->base, strpos( $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
|
177 |
// Yeah, in some case there might be a collision between the wp slug and ecwid hash if some hashes collide into the same slug
|
178 |
-
ecwid_admin_do_page( $
|
179 |
}
|
180 |
|
181 |
public function ajax_update_menu()
|
@@ -330,7 +367,7 @@ class Ecwid_Admin {
|
|
330 |
return true;
|
331 |
}
|
332 |
|
333 |
-
return
|
334 |
}
|
335 |
|
336 |
static public function disable_dashboard() {
|
35 |
|
36 |
public function build_menu()
|
37 |
{
|
38 |
+
$is_newbie = ecwid_is_demo_store();
|
|
|
39 |
|
40 |
add_menu_page(
|
41 |
sprintf(__('%s shopping cart settings', 'ecwid-shopping-cart'), Ecwid_Config::get_brand()),
|
163 |
foreach ($pages as $page) {
|
164 |
add_submenu_page( '', 'Legacy', '', 'manage_options', $page, array( $this, 'do_ec_redirect' ) );
|
165 |
}
|
166 |
+
|
167 |
+
if ( self::are_auto_menus_enabled() && Ecwid_Api_V3::is_available() && !ecwid_is_demo_store() ) {
|
168 |
+
add_options_page(
|
169 |
+
__( 'Store', 'ecwid-shopping-cart' ),
|
170 |
+
__( 'Store', 'ecwid-shopping-cart' ),
|
171 |
+
self::get_capability(),
|
172 |
+
'admin.php?page=' . self::ADMIN_SLUG . '-admin-general-settings'
|
173 |
+
);
|
174 |
+
|
175 |
+
add_users_page(
|
176 |
+
__( 'Customers', 'ecwid-shopping-cart' ),
|
177 |
+
__( 'Customers', 'ecwid-shopping-cart' ),
|
178 |
+
self::get_capability(),
|
179 |
+
'admin.php?page=' . self::ADMIN_SLUG . '-admin-customers'
|
180 |
+
);
|
181 |
+
|
182 |
+
add_theme_page(
|
183 |
+
__( 'Store', 'ecwid-shopping-cart' ),
|
184 |
+
__( 'Store', 'ecwid-shopping-cart' ),
|
185 |
+
self::get_capability(),
|
186 |
+
'admin.php?page=' . self::ADMIN_SLUG . '-admin-design'
|
187 |
+
);
|
188 |
+
}
|
189 |
}
|
190 |
|
191 |
public function do_admin_page()
|
193 |
$menus = $this->_get_menus();
|
194 |
|
195 |
$admin_prefix = self::ADMIN_SLUG . '-admin-';
|
196 |
+
$wp_slug = get_current_screen()->base;
|
197 |
+
$slug = substr( get_current_screen()->base, strpos( $wp_slug, $admin_prefix ) );
|
198 |
+
|
199 |
+
$menu = $this->_get_menus();
|
200 |
+
|
201 |
+
foreach ($menu as $item) {
|
202 |
+
if ( @$item['slug'] == $slug ) {
|
203 |
+
$hash = $item['hash'];
|
204 |
+
break;
|
205 |
+
}
|
206 |
+
if ( @$item['children'] ) foreach ( $item['children'] as $child ) {
|
207 |
+
if ($child['slug'] == $slug) {
|
208 |
+
$hash = $child['hash'];
|
209 |
+
break;
|
210 |
+
}
|
211 |
+
}
|
212 |
+
}
|
213 |
|
214 |
// Yeah, in some case there might be a collision between the wp slug and ecwid hash if some hashes collide into the same slug
|
215 |
+
ecwid_admin_do_page( $hash );
|
216 |
}
|
217 |
|
218 |
public function ajax_update_menu()
|
367 |
return true;
|
368 |
}
|
369 |
|
370 |
+
return true;
|
371 |
}
|
372 |
|
373 |
static public function disable_dashboard() {
|
includes/class-ecwid-config.php
CHANGED
@@ -91,8 +91,9 @@ class Ecwid_Config {
|
|
91 |
return EcwidPlatform::get( self::CPANEL_DOMAIN, 'my.ecwid.com' );
|
92 |
}
|
93 |
|
|
|
94 |
public static function get_demo_store_id() {
|
95 |
-
return EcwidPlatform::get( self::DEMO_STORE_ID,
|
96 |
}
|
97 |
|
98 |
public static function load_from_ini() {
|
91 |
return EcwidPlatform::get( self::CPANEL_DOMAIN, 'my.ecwid.com' );
|
92 |
}
|
93 |
|
94 |
+
// ALWAYS use ecwid_get_demo_store_id or ecwid_is_demo_store instead of this function
|
95 |
public static function get_demo_store_id() {
|
96 |
+
return EcwidPlatform::get( self::DEMO_STORE_ID, null );
|
97 |
}
|
98 |
|
99 |
public static function load_from_ini() {
|
includes/class-ecwid-help-page.php
CHANGED
@@ -22,7 +22,7 @@ class Ecwid_Help_Page {
|
|
22 |
$to = get_option( 'ecwid_support_email' );
|
23 |
|
24 |
$body_lines = array();
|
25 |
-
if (
|
26 |
$body_lines[] = 'Store ID: ' . get_ecwid_store_id();
|
27 |
}
|
28 |
$body_lines[] = 'Store URL: ' . Ecwid_Store_Page::get_store_url();
|
22 |
$to = get_option( 'ecwid_support_email' );
|
23 |
|
24 |
$body_lines = array();
|
25 |
+
if ( !ecwid_is_demo_store() ) {
|
26 |
$body_lines[] = 'Store ID: ' . get_ecwid_store_id();
|
27 |
}
|
28 |
$body_lines[] = 'Store URL: ' . Ecwid_Store_Page::get_store_url();
|
includes/class-ecwid-integration-gutenberg.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ecwid_Integration_Gutenberg {
|
4 |
+
|
5 |
+
const STORE_BLOCK = 'ecwid/store-block';
|
6 |
+
|
7 |
+
public function __construct() {
|
8 |
+
|
9 |
+
if ( isset( $_GET['classic-editor'] ) ) return;
|
10 |
+
|
11 |
+
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_block_editor_assets' ) );
|
12 |
+
add_action( 'admin_enqueue_scripts', function() {
|
13 |
+
EcwidPlatform::enqueue_script( 'store-editor-gutenberg' );
|
14 |
+
EcwidPlatform::enqueue_style( 'store-popup' );
|
15 |
+
|
16 |
+
wp_localize_script( 'ecwid-store-editor-gutenberg', 'EcwidGutenbergParams',
|
17 |
+
array(
|
18 |
+
'ecwid_pb_defaults' => ecwid_get_default_pb_size(),
|
19 |
+
'storeImageUrl' => site_url('?file=ecwid_store_svg.svg'),
|
20 |
+
'title' => sprintf( __( '%s store', 'ecwid-shopping-cart'), Ecwid_Config::get_brand() ),
|
21 |
+
'storeShortcodeName' => Ecwid_Shortcode_Base::get_current_store_shortcode_name(),
|
22 |
+
'storeBlock' => self::STORE_BLOCK
|
23 |
+
)
|
24 |
+
);
|
25 |
+
|
26 |
+
} );
|
27 |
+
|
28 |
+
add_action( "rest_insert_post", array( $this, 'on_save_post' ), 10, 3 );
|
29 |
+
add_action( "rest_insert_page", array( $this, 'on_save_post' ), 10, 3 );
|
30 |
+
|
31 |
+
register_block_type('ecwid/store-block', array(
|
32 |
+
'editor_script' => 'ecwid-block-store',
|
33 |
+
'render_callback' => array( $this, 'render_callback' ),
|
34 |
+
));
|
35 |
+
|
36 |
+
add_action( 'in_admin_header', array( $this, 'add_popup' ) );
|
37 |
+
}
|
38 |
+
|
39 |
+
public function on_save_post( $post, $request, $creating ) {
|
40 |
+
if (strpos( $post->post_content, '<!-- wp:' . self::STORE_BLOCK ) !== false ) {
|
41 |
+
Ecwid_Store_Page::add_store_page( $post->ID );
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
public function enqueue_block_editor_assets() {
|
46 |
+
EcwidPlatform::enqueue_script( 'gutenberg-block', array( 'wp-blocks', 'wp-i18n', 'wp-element' ) );
|
47 |
+
EcwidPlatform::enqueue_style( 'gutenberg-block', array( 'wp-edit-blocks' ) );
|
48 |
+
|
49 |
+
$storeImageUrl = site_url('?file=ecwid_store_svg.svg');
|
50 |
+
|
51 |
+
wp_add_inline_style('ecwid-gutenberg-block', <<<CSS
|
52 |
+
.editor-block-list__block[data-type="ecwid/store-block"] .editor-block-list__block-edit {
|
53 |
+
background-image: url("$storeImageUrl")
|
54 |
+
}
|
55 |
+
CSS
|
56 |
+
);
|
57 |
+
}
|
58 |
+
|
59 |
+
public function render_callback( $params ) {
|
60 |
+
if ( $_SERVER['REQUEST_METHOD'] != 'GET' ) {
|
61 |
+
return '';
|
62 |
+
}
|
63 |
+
return ecwid_shortcode( $params );
|
64 |
+
}
|
65 |
+
|
66 |
+
public function add_popup() {
|
67 |
+
$categories = ecwid_get_categories_for_selector();
|
68 |
+
|
69 |
+
require ECWID_PLUGIN_DIR . '/templates/store-popup.php';
|
70 |
+
}
|
71 |
+
|
72 |
+
protected function _get_version_for_assets( $asset_file_path )
|
73 |
+
{
|
74 |
+
if ( $_SERVER['HTTP_HOST'] == 'localhost' ) {
|
75 |
+
return filemtime( ECWID_PLUGIN_DIR . '/' . $asset_file_path );
|
76 |
+
}
|
77 |
+
|
78 |
+
return get_option( 'ecwid_plugin_version' );
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
$ecwid_gutenberg = new Ecwid_Integration_Gutenberg();
|
includes/class-ecwid-message-manager.php
CHANGED
@@ -3,6 +3,8 @@
|
|
3 |
class Ecwid_Message_Manager
|
4 |
{
|
5 |
protected $messages = array();
|
|
|
|
|
6 |
|
7 |
protected function __construct()
|
8 |
{
|
@@ -81,8 +83,9 @@ TXT
|
|
81 |
$secondary_button = isset($params['secondary_title']);
|
82 |
if ($secondary_button) {
|
83 |
$secondary_title = $params['secondary_title'];
|
84 |
-
$secondary_url =
|
85 |
$secondary_blank = @$params['secondary_blank'];
|
|
|
86 |
}
|
87 |
|
88 |
$do_not_show_again = true == $params['hideable'];
|
@@ -189,7 +192,7 @@ TXT
|
|
189 |
|
190 |
protected static function get_default_messages()
|
191 |
{
|
192 |
-
|
193 |
'on_activate' => array(
|
194 |
'title' => sprintf( __( 'Greetings! Your %s plugin is now active.', 'ecwid-shopping-cart'), Ecwid_Config::get_brand() ),
|
195 |
'message' => __('Take a few simple steps to complete store setup', 'ecwid-shopping-cart'),
|
@@ -240,8 +243,22 @@ TXT
|
|
240 |
'primary_title' => __( 'Connect', 'ecwid-shopping-cart' ),
|
241 |
'primary_url' => admin_url( 'admin-post.php?action=ec_connect&reconnect' ),
|
242 |
'hideable' => true
|
243 |
-
)
|
244 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
}
|
246 |
|
247 |
protected function need_to_show_message($name)
|
@@ -263,10 +280,10 @@ TXT
|
|
263 |
|
264 |
switch ($name) {
|
265 |
case 'on_activate':
|
266 |
-
return !$this->should_display_on_no_storeid_on_setup_pages() && $admin_page != 'toplevel_page_ec-store' &&
|
267 |
|
268 |
case 'on_storeid_set':
|
269 |
-
return
|
270 |
|
271 |
case 'on_no_storeid_on_setup_pages':
|
272 |
return $this->should_display_on_no_storeid_on_setup_pages();
|
@@ -276,9 +293,18 @@ TXT
|
|
276 |
|
277 |
case 'no_token':
|
278 |
$no_token = Ecwid_Api_V3::get_token() == false;
|
279 |
-
$is_not_demo =
|
280 |
return $no_token && $is_not_demo && !$is_ecwid_menu;
|
281 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
case 'please_vote':
|
283 |
|
284 |
if ( Ecwid_Config::is_wl() ) return false;
|
@@ -307,7 +333,7 @@ TXT
|
|
307 |
|
308 |
$admin_page = $screen->base;
|
309 |
|
310 |
-
$is_newbie =
|
311 |
|
312 |
$is_ecwid_settings = in_array($admin_page, array('ecwid-store_page_ecwid-advanced', 'ecwid-store_page_ecwid-appearance'));
|
313 |
$is_store_page = $admin_page == 'post' && isset($_GET['post']) && $_GET['post'] == Ecwid_Store_Page::get_current_store_page_id();
|
3 |
class Ecwid_Message_Manager
|
4 |
{
|
5 |
protected $messages = array();
|
6 |
+
|
7 |
+
const MSG_WOO_IMPORT_ONBOARDING = 'connected_woo';
|
8 |
|
9 |
protected function __construct()
|
10 |
{
|
83 |
$secondary_button = isset($params['secondary_title']);
|
84 |
if ($secondary_button) {
|
85 |
$secondary_title = $params['secondary_title'];
|
86 |
+
$secondary_url = @$params['secondary_url'];
|
87 |
$secondary_blank = @$params['secondary_blank'];
|
88 |
+
$secondary_hide = @$params['secondary_hide'];
|
89 |
}
|
90 |
|
91 |
$do_not_show_again = true == $params['hideable'];
|
192 |
|
193 |
protected static function get_default_messages()
|
194 |
{
|
195 |
+
$messages = array(
|
196 |
'on_activate' => array(
|
197 |
'title' => sprintf( __( 'Greetings! Your %s plugin is now active.', 'ecwid-shopping-cart'), Ecwid_Config::get_brand() ),
|
198 |
'message' => __('Take a few simple steps to complete store setup', 'ecwid-shopping-cart'),
|
243 |
'primary_title' => __( 'Connect', 'ecwid-shopping-cart' ),
|
244 |
'primary_url' => admin_url( 'admin-post.php?action=ec_connect&reconnect' ),
|
245 |
'hideable' => true
|
246 |
+
),
|
247 |
);
|
248 |
+
|
249 |
+
if ( class_exists( 'Ecwid_Import_Page' ) ) {
|
250 |
+
$messages[self::MSG_WOO_IMPORT_ONBOARDING] = array(
|
251 |
+
'title' => sprintf( __( 'Need help importing your products from WooCommerce to %s?', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand() ),
|
252 |
+
'message' => sprintf( __( 'We noticed you have WooCommerce installed. If you want to easily copy your WooCommerce products to %s, this tool will help you.', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand() ),
|
253 |
+
'hideable' => false,
|
254 |
+
'primary_title' => __( 'Import my products from WooCommerce', 'ecwid-shopping-cart' ),
|
255 |
+
'primary_url' => Ecwid_Import_Page::get_woo_page_url_from_message(),
|
256 |
+
'secondary_title' => __( 'No Thanks', 'ecwid-shopping-cart' ),
|
257 |
+
'secondary_hide' => true
|
258 |
+
);
|
259 |
+
}
|
260 |
+
|
261 |
+
return $messages;
|
262 |
}
|
263 |
|
264 |
protected function need_to_show_message($name)
|
280 |
|
281 |
switch ($name) {
|
282 |
case 'on_activate':
|
283 |
+
return !$this->should_display_on_no_storeid_on_setup_pages() && $admin_page != 'toplevel_page_ec-store' && ecwid_is_demo_store();
|
284 |
|
285 |
case 'on_storeid_set':
|
286 |
+
return !ecwid_is_demo_store() && @$_GET['settings-updated'] == 'true' && $admin_page == 'toplevel_page_ec-store';
|
287 |
|
288 |
case 'on_no_storeid_on_setup_pages':
|
289 |
return $this->should_display_on_no_storeid_on_setup_pages();
|
293 |
|
294 |
case 'no_token':
|
295 |
$no_token = Ecwid_Api_V3::get_token() == false;
|
296 |
+
$is_not_demo = !ecwid_is_demo_store();
|
297 |
return $no_token && $is_not_demo && !$is_ecwid_menu;
|
298 |
|
299 |
+
case self::MSG_WOO_IMPORT_ONBOARDING:
|
300 |
+
return 0
|
301 |
+
&& is_plugin_active( 'woocommerce/woocommerce.php' )
|
302 |
+
&& strpos( $admin_page, Ecwid_Import::PAGE_SLUG ) === false
|
303 |
+
&& !$this->need_to_show_message( 'on_activate' )
|
304 |
+
&& Ecwid_Api_V3::is_available()
|
305 |
+
&& get_ecwid_store_id() % 2 == 0
|
306 |
+
&& !Ecwid_Config::is_wl();
|
307 |
+
|
308 |
case 'please_vote':
|
309 |
|
310 |
if ( Ecwid_Config::is_wl() ) return false;
|
333 |
|
334 |
$admin_page = $screen->base;
|
335 |
|
336 |
+
$is_newbie = ecwid_is_demo_store();
|
337 |
|
338 |
$is_ecwid_settings = in_array($admin_page, array('ecwid-store_page_ecwid-advanced', 'ecwid-store_page_ecwid-appearance'));
|
339 |
$is_store_page = $admin_page == 'post' && isset($_GET['post']) && $_GET['post'] == Ecwid_Store_Page::get_current_store_page_id();
|
includes/class-ecwid-nav-menus.php
CHANGED
@@ -366,4 +366,4 @@ class Ecwid_Nav_Menus {
|
|
366 |
return $this->item_types;
|
367 |
}
|
368 |
}
|
369 |
-
$ecwid_menus = new Ecwid_Nav_Menus();
|
366 |
return $this->item_types;
|
367 |
}
|
368 |
}
|
369 |
+
$ecwid_menus = new Ecwid_Nav_Menus();
|
includes/class-ecwid-oauth.php
CHANGED
@@ -7,6 +7,10 @@ class Ecwid_OAuth {
|
|
7 |
|
8 |
const MODE_CONNECT = 'connect';
|
9 |
const MODE_RECONNECT = 'reconnect';
|
|
|
|
|
|
|
|
|
10 |
|
11 |
protected $state;
|
12 |
|
@@ -19,6 +23,10 @@ class Ecwid_OAuth {
|
|
19 |
add_action('admin_post_ec_disconnect', array($this, 'disconnect_store'));
|
20 |
add_action('admin_post_ec_show_reconnect', array($this, 'show_reconnect'));
|
21 |
|
|
|
|
|
|
|
|
|
22 |
$this->_load_state();
|
23 |
|
24 |
$this->api = new Ecwid_Api_V3();
|
@@ -125,9 +133,11 @@ class Ecwid_OAuth {
|
|
125 |
update_option( 'ecwid_oauth_scope', $result->scope );
|
126 |
update_option( 'ecwid_api_check_time', 0 );
|
127 |
update_option( 'ecwid_public_token', $result->public_token );
|
|
|
128 |
EcwidPlatform::cache_reset( 'all_categories' );
|
129 |
$this->api->save_token($result->access_token);
|
130 |
-
|
|
|
131 |
// Reset "Create store cookie" set previously to display the landing page
|
132 |
//in "Connect" mode rather than "Create" mode
|
133 |
setcookie('ecwid_create_store_clicked', null, strtotime('-1 day'), ADMIN_COOKIE_PATH, COOKIE_DOMAIN);
|
@@ -148,7 +158,7 @@ class Ecwid_OAuth {
|
|
148 |
|
149 |
public function disconnect_store()
|
150 |
{
|
151 |
-
update_option( 'ecwid_store_id',
|
152 |
$this->api->save_token( '' );
|
153 |
update_option( 'ecwid_is_api_enabled', 'off' );
|
154 |
update_option( 'ecwid_api_check_time', 0 );
|
@@ -183,7 +193,7 @@ class Ecwid_OAuth {
|
|
183 |
} else {
|
184 |
$stored_scope = get_option( 'ecwid_oauth_scope' );
|
185 |
if (empty($stored_scope)) {
|
186 |
-
$stored_scope = 'read_store_profile
|
187 |
}
|
188 |
}
|
189 |
|
@@ -191,7 +201,14 @@ class Ecwid_OAuth {
|
|
191 |
}
|
192 |
|
193 |
protected function _get_default_scopes_array() {
|
194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
}
|
196 |
|
197 |
protected function trigger_auth_error($mode = 'default')
|
@@ -350,6 +367,16 @@ class Ecwid_OAuth {
|
|
350 |
return $reconnect_message;
|
351 |
}
|
352 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
protected function _is_reconnect() {
|
354 |
return @$this->state->mode == self::MODE_RECONNECT;
|
355 |
}
|
7 |
|
8 |
const MODE_CONNECT = 'connect';
|
9 |
const MODE_RECONNECT = 'reconnect';
|
10 |
+
|
11 |
+
const OPTION_JUST_CONNECTED = 'ecwid_just_connected';
|
12 |
+
|
13 |
+
const SCOPE_READ_CATALOG = 'read_catalog';
|
14 |
|
15 |
protected $state;
|
16 |
|
23 |
add_action('admin_post_ec_disconnect', array($this, 'disconnect_store'));
|
24 |
add_action('admin_post_ec_show_reconnect', array($this, 'show_reconnect'));
|
25 |
|
26 |
+
if ( get_option( self::OPTION_JUST_CONNECTED ) ) {
|
27 |
+
add_action( 'shutdown', array( $this, 'reset_just_connected' ) );
|
28 |
+
}
|
29 |
+
|
30 |
$this->_load_state();
|
31 |
|
32 |
$this->api = new Ecwid_Api_V3();
|
133 |
update_option( 'ecwid_oauth_scope', $result->scope );
|
134 |
update_option( 'ecwid_api_check_time', 0 );
|
135 |
update_option( 'ecwid_public_token', $result->public_token );
|
136 |
+
update_option( self::OPTION_JUST_CONNECTED, true );
|
137 |
EcwidPlatform::cache_reset( 'all_categories' );
|
138 |
$this->api->save_token($result->access_token);
|
139 |
+
|
140 |
+
|
141 |
// Reset "Create store cookie" set previously to display the landing page
|
142 |
//in "Connect" mode rather than "Create" mode
|
143 |
setcookie('ecwid_create_store_clicked', null, strtotime('-1 day'), ADMIN_COOKIE_PATH, COOKIE_DOMAIN);
|
158 |
|
159 |
public function disconnect_store()
|
160 |
{
|
161 |
+
update_option( 'ecwid_store_id', ecwid_get_demo_store_id() );
|
162 |
$this->api->save_token( '' );
|
163 |
update_option( 'ecwid_is_api_enabled', 'off' );
|
164 |
update_option( 'ecwid_api_check_time', 0 );
|
193 |
} else {
|
194 |
$stored_scope = get_option( 'ecwid_oauth_scope' );
|
195 |
if (empty($stored_scope)) {
|
196 |
+
$stored_scope = 'read_store_profile ' . Ecwid_OAuth::SCOPE_READ_CATALOG;
|
197 |
}
|
198 |
}
|
199 |
|
201 |
}
|
202 |
|
203 |
protected function _get_default_scopes_array() {
|
204 |
+
$defaults = array( 'read_store_profile', Ecwid_OAuth::SCOPE_READ_CATALOG, 'allow_sso', 'create_customers', 'public_storefront' );
|
205 |
+
|
206 |
+
if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
|
207 |
+
$defaults[] = 'create_catalog';
|
208 |
+
$defaults[] = 'update_catalog';
|
209 |
+
}
|
210 |
+
|
211 |
+
return $defaults;
|
212 |
}
|
213 |
|
214 |
protected function trigger_auth_error($mode = 'default')
|
367 |
return $reconnect_message;
|
368 |
}
|
369 |
|
370 |
+
public static function just_connected()
|
371 |
+
{
|
372 |
+
return get_option( self::OPTION_JUST_CONNECTED );
|
373 |
+
}
|
374 |
+
|
375 |
+
public function reset_just_connected()
|
376 |
+
{
|
377 |
+
update_option( self::OPTION_JUST_CONNECTED, false );
|
378 |
+
}
|
379 |
+
|
380 |
protected function _is_reconnect() {
|
381 |
return @$this->state->mode == self::MODE_RECONNECT;
|
382 |
}
|
includes/class-ecwid-popup-deactivate.php
CHANGED
@@ -30,7 +30,7 @@ class Ecwid_Popup_Deactivate extends Ecwid_Popup {
|
|
30 |
$to = 'plugins-feedback@ecwid.com';
|
31 |
|
32 |
$body_lines = array();
|
33 |
-
if (
|
34 |
$body_lines[] = 'Store ID: ' . get_ecwid_store_id();
|
35 |
}
|
36 |
|
@@ -87,8 +87,8 @@ class Ecwid_Popup_Deactivate extends Ecwid_Popup {
|
|
87 |
if ( $disabled ) return true;
|
88 |
|
89 |
if ( Ecwid_Config::is_wl() ) return true;
|
90 |
-
|
91 |
-
if (strpos(
|
92 |
|
93 |
return false;
|
94 |
}
|
30 |
$to = 'plugins-feedback@ecwid.com';
|
31 |
|
32 |
$body_lines = array();
|
33 |
+
if ( !ecwid_is_demo_store() ) {
|
34 |
$body_lines[] = 'Store ID: ' . get_ecwid_store_id();
|
35 |
}
|
36 |
|
87 |
if ( $disabled ) return true;
|
88 |
|
89 |
if ( Ecwid_Config::is_wl() ) return true;
|
90 |
+
|
91 |
+
if (strpos(get_user_locale(), 'en') !== 0) return true;
|
92 |
|
93 |
return false;
|
94 |
}
|
includes/class-ecwid-products.php
CHANGED
@@ -488,8 +488,8 @@ class Ecwid_Products {
|
|
488 |
protected function _sync_product( $product, $existing_post_id = null ) {
|
489 |
|
490 |
$meta = array(
|
491 |
-
'_price' => $product->
|
492 |
-
'_regular_price' => $product->
|
493 |
'image' => $product->imageUrl,
|
494 |
'ecwid_id' => $product->id,
|
495 |
'_sku' => $product->sku,
|
488 |
protected function _sync_product( $product, $existing_post_id = null ) {
|
489 |
|
490 |
$meta = array(
|
491 |
+
'_price' => $product->defaultDisplayedPrice,
|
492 |
+
'_regular_price' => $product->defaultDisplayedPrice,
|
493 |
'image' => $product->imageUrl,
|
494 |
'ecwid_id' => $product->id,
|
495 |
'_sku' => $product->sku,
|
includes/class-ecwid-seo-links.php
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
class Ecwid_Seo_Links {
|
5 |
|
6 |
const OPTION_ENABLED = 'ecwid_seo_links_enabled';
|
|
|
7 |
|
8 |
public function __construct()
|
9 |
{
|
@@ -12,6 +13,7 @@ class Ecwid_Seo_Links {
|
|
12 |
|
13 |
add_action( 'init', array( $this, 'init' ) );
|
14 |
add_action( 'ecwid_on_fresh_install', array( $this, 'on_fresh_install' ) );
|
|
|
15 |
}
|
16 |
|
17 |
public function init() {
|
@@ -27,9 +29,55 @@ class Ecwid_Seo_Links {
|
|
27 |
add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', array( $this, 'is_post_slug_bad'), 10, 4 );
|
28 |
add_filter( 'wp_unique_post_slug_is_bad_flat_slug', array( $this, 'is_post_slug_bad' ), 10, 2 );
|
29 |
add_filter( 'wp_unique_post_slug_is_bad_attachment_slug', array( $this, 'is_post_slug_bad' ), 10, 2 );
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
public function on_fresh_install() {
|
34 |
add_option( self::OPTION_ENABLED, 'Y' );
|
35 |
}
|
@@ -138,7 +186,11 @@ class Ecwid_Seo_Links {
|
|
138 |
|
139 |
public function is_store_on_home_page() {
|
140 |
$front_page = get_option( 'page_on_front' );
|
141 |
-
|
|
|
|
|
|
|
|
|
142 |
if ( Ecwid_Store_Page::is_store_page( $front_page ) ) {
|
143 |
return true;
|
144 |
}
|
@@ -155,7 +207,7 @@ class Ecwid_Seo_Links {
|
|
155 |
|
156 |
if ( !$has_store ) return;
|
157 |
|
158 |
-
$url = esc_js(
|
159 |
|
160 |
echo <<<JS
|
161 |
window.ec.config.storefrontUrls = window.ec.config.storefrontUrls || {};
|
@@ -196,17 +248,76 @@ JS;
|
|
196 |
|
197 |
if ( !self::is_enabled() ) return;
|
198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
$pages = Ecwid_Store_Page::get_store_pages_array();
|
200 |
|
201 |
if ( is_array( $pages ) ) {
|
202 |
|
203 |
foreach ( $pages as $page_id ) {
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
foreach ( $patterns as $pattern ) {
|
208 |
-
add_rewrite_rule( '^' . $link . '/' . $pattern . '.*', 'index.php?page_id=' . $page_id, 'top' );
|
209 |
}
|
|
|
210 |
}
|
211 |
|
212 |
if (
|
@@ -223,22 +334,21 @@ JS;
|
|
223 |
foreach ( $pages as $page_id ) {
|
224 |
$link = urldecode( get_page_uri( $page_id ) );
|
225 |
$language = pll_get_post_language( $page_id );
|
226 |
-
|
227 |
-
|
|
|
228 |
}
|
|
|
|
|
229 |
}
|
230 |
}
|
231 |
}
|
232 |
}
|
233 |
-
|
234 |
-
|
235 |
-
$patterns = $this->get_seo_links_patterns();
|
236 |
-
foreach ( $patterns as $pattern ) {
|
237 |
-
add_rewrite_rule( '^' . $pattern . '$', 'index.php?page_id=' . get_option( 'page_on_front' ), 'top' );
|
238 |
-
}
|
239 |
-
}
|
240 |
}
|
241 |
-
|
|
|
242 |
|
243 |
public static function is_enabled() {
|
244 |
|
4 |
class Ecwid_Seo_Links {
|
5 |
|
6 |
const OPTION_ENABLED = 'ecwid_seo_links_enabled';
|
7 |
+
const OPTION_ALL_BASE_URLS = 'ecwid_all_base_urls';
|
8 |
|
9 |
public function __construct()
|
10 |
{
|
13 |
|
14 |
add_action( 'init', array( $this, 'init' ) );
|
15 |
add_action( 'ecwid_on_fresh_install', array( $this, 'on_fresh_install' ) );
|
16 |
+
add_action( 'save_post', array( $this, 'on_save_post' ) );
|
17 |
}
|
18 |
|
19 |
public function init() {
|
29 |
add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', array( $this, 'is_post_slug_bad'), 10, 4 );
|
30 |
add_filter( 'wp_unique_post_slug_is_bad_flat_slug', array( $this, 'is_post_slug_bad' ), 10, 2 );
|
31 |
add_filter( 'wp_unique_post_slug_is_bad_attachment_slug', array( $this, 'is_post_slug_bad' ), 10, 2 );
|
32 |
+
|
33 |
+
if ( is_admin() ) {
|
34 |
+
add_action( 'current_screen', array( $this, 'check_base_urls_on_edit_store_page' ) );
|
35 |
+
}
|
36 |
}
|
37 |
}
|
38 |
|
39 |
+
public function on_save_post( $post_id ) {
|
40 |
+
if ( wp_is_post_revision( $post_id ) )
|
41 |
+
return;
|
42 |
+
|
43 |
+
if ( Ecwid_Store_Page::is_store_page( $post_id ) ) {
|
44 |
+
if ( !$this->are_base_urls_ok() ) {
|
45 |
+
flush_rewrite_rules();
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
public function check_base_urls_on_edit_store_page() {
|
51 |
+
|
52 |
+
$current_screen = get_current_screen();
|
53 |
+
|
54 |
+
if ( $current_screen->base != 'post' || !in_array( $current_screen->post_type, array( 'post', 'page' ) ) ) {
|
55 |
+
return;
|
56 |
+
}
|
57 |
+
|
58 |
+
$id = @$_GET['post'];
|
59 |
+
|
60 |
+
if ( !$id ) {
|
61 |
+
return;
|
62 |
+
}
|
63 |
+
|
64 |
+
if ( Ecwid_Store_Page::is_store_page( $id ) ) {
|
65 |
+
if ( !$this->are_base_urls_ok() ) {
|
66 |
+
flush_rewrite_rules();
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
public function check_base_urls_on_view_store_page_as_admin() {
|
72 |
+
$id = get_the_ID();
|
73 |
+
|
74 |
+
if ( Ecwid_Store_Page::is_store_page( $id ) ) {
|
75 |
+
if ( !$this->are_base_urls_ok() ) {
|
76 |
+
flush_rewrite_rules();
|
77 |
+
}
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
public function on_fresh_install() {
|
82 |
add_option( self::OPTION_ENABLED, 'Y' );
|
83 |
}
|
186 |
|
187 |
public function is_store_on_home_page() {
|
188 |
$front_page = get_option( 'page_on_front' );
|
189 |
+
|
190 |
+
if ( !$front_page ) {
|
191 |
+
return false;
|
192 |
+
}
|
193 |
+
|
194 |
if ( Ecwid_Store_Page::is_store_page( $front_page ) ) {
|
195 |
return true;
|
196 |
}
|
207 |
|
208 |
if ( !$has_store ) return;
|
209 |
|
210 |
+
$url = esc_js( get_page_link( $page_id ) );
|
211 |
|
212 |
echo <<<JS
|
213 |
window.ec.config.storefrontUrls = window.ec.config.storefrontUrls || {};
|
248 |
|
249 |
if ( !self::is_enabled() ) return;
|
250 |
|
251 |
+
$all_base_urls = $this->_build_all_base_urls();
|
252 |
+
|
253 |
+
if ( $this->is_store_on_home_page() ) {
|
254 |
+
$patterns = $this->get_seo_links_patterns();
|
255 |
+
foreach ( $patterns as $pattern ) {
|
256 |
+
add_rewrite_rule( '^' . $pattern . '$', 'index.php?page_id=' . get_option( 'page_on_front' ), 'top' );
|
257 |
+
}
|
258 |
+
}
|
259 |
+
|
260 |
+
foreach ( $all_base_urls as $page_id => $links ) {
|
261 |
+
$patterns = $this->get_seo_links_patterns();
|
262 |
+
|
263 |
+
foreach ( $links as $link ) {
|
264 |
+
foreach ( $patterns as $pattern ) {
|
265 |
+
add_rewrite_rule( '^' . $link . '/' . $pattern . '.*', 'index.php?page_id=' . $page_id, 'top' );
|
266 |
+
}
|
267 |
+
}
|
268 |
+
}
|
269 |
+
|
270 |
+
update_option( self::OPTION_ALL_BASE_URLS, array_merge( $all_base_urls, array( 'home' => $this->is_store_on_home_page() ) ) );
|
271 |
+
}
|
272 |
+
|
273 |
+
public function are_base_urls_ok() {
|
274 |
+
$all_base_urls = $this->_build_all_base_urls();
|
275 |
+
|
276 |
+
$flattened = array();
|
277 |
+
foreach ( $all_base_urls as $page_id => $links ) {
|
278 |
+
foreach ( $links as $link ) {
|
279 |
+
$flattened[$link] = $link;
|
280 |
+
}
|
281 |
+
}
|
282 |
+
|
283 |
+
$saved = get_option( self::OPTION_ALL_BASE_URLS );
|
284 |
+
|
285 |
+
if ( empty( $saved ) || !is_array( $saved ) ) {
|
286 |
+
return false;
|
287 |
+
}
|
288 |
+
|
289 |
+
$saved_home = false;
|
290 |
+
if ( isset( $saved['home'] ) ) {
|
291 |
+
$saved_home = $saved['home'];
|
292 |
+
unset( $saved['home'] );
|
293 |
+
}
|
294 |
+
|
295 |
+
$flattened_saved = array();
|
296 |
+
foreach ( $saved as $page_id => $links ) {
|
297 |
+
foreach ( $links as $link ) {
|
298 |
+
$flattened_saved[$link] = $link;
|
299 |
+
}
|
300 |
+
}
|
301 |
+
|
302 |
+
$are_the_same = array_diff( $flattened, $flattened_saved );
|
303 |
+
|
304 |
+
return empty( $are_the_same ) && $saved_home == $this->is_store_on_home_page();
|
305 |
+
}
|
306 |
+
|
307 |
+
protected function _build_all_base_urls()
|
308 |
+
{
|
309 |
+
$base_urls = array();
|
310 |
+
|
311 |
$pages = Ecwid_Store_Page::get_store_pages_array();
|
312 |
|
313 |
if ( is_array( $pages ) ) {
|
314 |
|
315 |
foreach ( $pages as $page_id ) {
|
316 |
+
|
317 |
+
if ( !isset( $base_urls[$page_id] ) ) {
|
318 |
+
$base_urls[$page_id] = array();
|
|
|
|
|
319 |
}
|
320 |
+
$base_urls[$page_id][] = urldecode( get_page_uri( $page_id ) );
|
321 |
}
|
322 |
|
323 |
if (
|
334 |
foreach ( $pages as $page_id ) {
|
335 |
$link = urldecode( get_page_uri( $page_id ) );
|
336 |
$language = pll_get_post_language( $page_id );
|
337 |
+
|
338 |
+
if ( !isset( $base_urls[$page_id] ) ) {
|
339 |
+
$base_urls[$page_id] = array();
|
340 |
}
|
341 |
+
|
342 |
+
$base_urls[$page_id][] = $language . '/' . $link;
|
343 |
}
|
344 |
}
|
345 |
}
|
346 |
}
|
347 |
+
|
348 |
+
return $base_urls;
|
|
|
|
|
|
|
|
|
|
|
349 |
}
|
350 |
+
|
351 |
+
|
352 |
|
353 |
public static function is_enabled() {
|
354 |
|
includes/class-ecwid-store-editor.php
CHANGED
@@ -25,6 +25,10 @@ class Ecwid_Store_Editor {
|
|
25 |
return;
|
26 |
}
|
27 |
|
|
|
|
|
|
|
|
|
28 |
add_filter( 'mce_external_plugins', array( $this, 'add_mce_plugin' ) );
|
29 |
add_action( 'media_buttons_context', array( $this, 'add_editor_button' ) );
|
30 |
add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts' ) );
|
@@ -85,7 +89,7 @@ HTML;
|
|
85 |
|
86 |
public function add_popup() {
|
87 |
$categories = ecwid_get_categories_for_selector();
|
88 |
-
|
89 |
require_once( ECWID_PLUGIN_DIR . 'templates/store-popup.php' );
|
90 |
}
|
91 |
}
|
25 |
return;
|
26 |
}
|
27 |
|
28 |
+
if ( is_plugin_active( 'gutenberg/gutenberg.php' ) && !isset( $_GET['classic-editor'] ) ) {
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
|
32 |
add_filter( 'mce_external_plugins', array( $this, 'add_mce_plugin' ) );
|
33 |
add_action( 'media_buttons_context', array( $this, 'add_editor_button' ) );
|
34 |
add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts' ) );
|
89 |
|
90 |
public function add_popup() {
|
91 |
$categories = ecwid_get_categories_for_selector();
|
92 |
+
|
93 |
require_once( ECWID_PLUGIN_DIR . 'templates/store-popup.php' );
|
94 |
}
|
95 |
}
|
includes/class-ecwid-store-page.php
CHANGED
@@ -102,12 +102,22 @@ class Ecwid_Store_Page {
|
|
102 |
static $link = null;
|
103 |
|
104 |
if ( is_null( $link ) ) {
|
105 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
}
|
107 |
|
108 |
return $link;
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
111 |
public static function get_current_store_page_id()
|
112 |
{
|
113 |
static $page_id = null;
|
@@ -286,10 +296,8 @@ class Ecwid_Store_Page {
|
|
286 |
$has_pb = self::post_content_has_productbrowser( $post_id );
|
287 |
|
288 |
if ( self::is_store_page( $post_id ) ) {
|
289 |
-
|
290 |
$is_disabled = !in_array( get_post_status( $post_id ), self::_get_allowed_post_statuses() );
|
291 |
|
292 |
-
|
293 |
if ( $is_disabled || !$has_pb ) {
|
294 |
self::reset_store_page( $post_id );
|
295 |
}
|
102 |
static $link = null;
|
103 |
|
104 |
if ( is_null( $link ) ) {
|
105 |
+
$id = self::get_current_store_page_id();
|
106 |
+
|
107 |
+
if ( !$id ) {
|
108 |
+
return get_bloginfo( 'url' );
|
109 |
+
}
|
110 |
+
|
111 |
+
$link = get_page_link( $id );
|
112 |
}
|
113 |
|
114 |
return $link;
|
115 |
}
|
116 |
|
117 |
+
public static function get_page_base_url( $page = 0 ) {
|
118 |
+
return urldecode( get_page_uri( $page ) );
|
119 |
+
}
|
120 |
+
|
121 |
public static function get_current_store_page_id()
|
122 |
{
|
123 |
static $page_id = null;
|
296 |
$has_pb = self::post_content_has_productbrowser( $post_id );
|
297 |
|
298 |
if ( self::is_store_page( $post_id ) ) {
|
|
|
299 |
$is_disabled = !in_array( get_post_status( $post_id ), self::_get_allowed_post_statuses() );
|
300 |
|
|
|
301 |
if ( $is_disabled || !$has_pb ) {
|
302 |
self::reset_store_page( $post_id );
|
303 |
}
|
includes/class-ecwid-wp-dashboard-feed.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ecwid_WP_Dashboard_Feed {
|
4 |
+
const CACHE_POSTS = 'wp-dashboard-blog-posts';
|
5 |
+
const ACTION_AJAX_SAVE = 'ecwid-save-posts';
|
6 |
+
const PARAM_LAST_ECWID_ADMIN_PREFETCH_TIME = 'last-admin-prefetch-time';
|
7 |
+
|
8 |
+
public function __construct() {
|
9 |
+
if ( Ecwid_Config::is_wl() ) {
|
10 |
+
return;
|
11 |
+
}
|
12 |
+
|
13 |
+
add_action( 'wp_dashboard_setup', array( $this, 'dashboard_setup' ) );
|
14 |
+
|
15 |
+
add_action( 'wp_ajax_' . self::ACTION_AJAX_SAVE, array( $this, 'ajax_save_posts' ) );
|
16 |
+
}
|
17 |
+
|
18 |
+
public function dashboard_setup() {
|
19 |
+
$url = 'https://www.ecwid.com/wp-json/wp/v2/posts?per_page=3&categories=1';
|
20 |
+
$media_url = 'https://www.ecwid.com/wp-json/wp/v2/media/';
|
21 |
+
$images_cdn = 'https://web-cdn.ecwid.com/wp-content/uploads/';
|
22 |
+
|
23 |
+
$lang = get_user_locale();
|
24 |
+
if ( $lang == 'ru_RU' ) {
|
25 |
+
$url = 'https://www.ecwid.ru/wp-json/wp/v2/posts?per_page=3&categories=1';
|
26 |
+
$media_url = 'https://www.ecwid.ru/wp-json/wp/v2/media/';
|
27 |
+
$images_cdn = 'https://web-cdn.ecwid.com/wp-content/uploads/ru/';
|
28 |
+
}
|
29 |
+
|
30 |
+
wp_enqueue_style( 'ecwid-dashboard-blog', ECWID_PLUGIN_URL . '/css/dashboard-blog.css', array( ), get_option('ecwid_plugin_version') );
|
31 |
+
|
32 |
+
wp_enqueue_script( 'ecwid-dashboard-blog', ECWID_PLUGIN_URL . '/js/dashboard-blog.js', array( 'jquery' ), get_option('ecwid_plugin_version') );
|
33 |
+
wp_localize_script( 'ecwid-dashboard-blog', 'ecwidDashboardBlog', array(
|
34 |
+
'posts' => EcwidPlatform::cache_get( $this->_get_cache_name() ),
|
35 |
+
'url' => $url,
|
36 |
+
'mediaUrl' => $media_url,
|
37 |
+
'imagesCDN' => $images_cdn,
|
38 |
+
'saveAction' => self::ACTION_AJAX_SAVE
|
39 |
+
) );
|
40 |
+
|
41 |
+
wp_add_dashboard_widget(
|
42 |
+
'ecwid_blog_feed',
|
43 |
+
sprintf( __( '%s Blog', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand() ),
|
44 |
+
array( $this, 'display' )
|
45 |
+
);
|
46 |
+
}
|
47 |
+
|
48 |
+
public function ajax_save_posts()
|
49 |
+
{
|
50 |
+
if ( !current_user_can( Ecwid_Admin::get_capability() ) ) {
|
51 |
+
die();
|
52 |
+
}
|
53 |
+
|
54 |
+
EcwidPlatform::cache_set( $this->_get_cache_name(), $_POST['posts'], 12 * HOUR_IN_SECONDS );
|
55 |
+
|
56 |
+
header( 'HTTP/1.0 200 OK' );
|
57 |
+
die();
|
58 |
+
}
|
59 |
+
|
60 |
+
protected function _get_cache_name()
|
61 |
+
{
|
62 |
+
$name = self::CACHE_POSTS;
|
63 |
+
$name .= '-' . get_user_locale();
|
64 |
+
|
65 |
+
return $name;
|
66 |
+
}
|
67 |
+
|
68 |
+
|
69 |
+
public function display() {
|
70 |
+
require_once ECWID_PLUGIN_DIR . '/templates/dashboard-blog-posts.tpl.php';
|
71 |
+
|
72 |
+
if ( EcwidPlatform::get( self::PARAM_LAST_ECWID_ADMIN_PREFETCH_TIME ) > time() + HOUR_IN_SECONDS * 12 ) {
|
73 |
+
$dashboard_url = ecwid_get_iframe_src( time(), 'dashboard' );
|
74 |
+
echo <<<HTML
|
75 |
+
<div style="display:none">
|
76 |
+
<iframe id="ecwid-prefetch" src=""></iframe>
|
77 |
+
<script type="text/javascript">
|
78 |
+
jQuery(document).ready(function() {
|
79 |
+
jQuery('#ecwid-prefetch').attr('src', '$dashboard_url');
|
80 |
+
});
|
81 |
+
</script>
|
82 |
+
</div>
|
83 |
+
HTML;
|
84 |
+
EcwidPlatform::set( self::PARAM_LAST_ECWID_ADMIN_PREFETCH_TIME, time() );
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
$ecwid_wp_dashboard_feed = new Ecwid_WP_Dashboard_Feed();
|
includes/importer/class-ecwid-import-page.php
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once __DIR__ . '/class-ecwid-importer.php';
|
4 |
+
|
5 |
+
class Ecwid_Import_Page
|
6 |
+
{
|
7 |
+
const PAGE_SLUG = 'ec-store-import';
|
8 |
+
const PAGE_SLUG_WOO = 'ec-store-import-woocommerce';
|
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 |
+
|
15 |
+
public function init_actions()
|
16 |
+
{
|
17 |
+
add_action( 'admin_menu', array( $this, 'build_menu' ) );
|
18 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
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()
|
25 |
+
{
|
26 |
+
if ( strrpos( strrev( get_current_screen()->base), strrev( self::PAGE_SLUG_WOO) ) !== 0 ) {
|
27 |
+
return;
|
28 |
+
}
|
29 |
+
|
30 |
+
if ( @$_GET[self::PARAM_FROM_IMPORT_ONBOARDING] ) {
|
31 |
+
Ecwid_Message_Manager::disable_message( Ecwid_Message_Manager::MSG_WOO_IMPORT_ONBOARDING );
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
public function build_menu()
|
36 |
+
{
|
37 |
+
add_submenu_page(
|
38 |
+
'',
|
39 |
+
__( 'Import', 'ecwid-shopping-cart' ),
|
40 |
+
__( 'Import', 'ecwid-shopping-cart' ),
|
41 |
+
Ecwid_Admin::get_capability(),
|
42 |
+
self::PAGE_SLUG,
|
43 |
+
array( $this, 'do_page' )
|
44 |
+
);
|
45 |
+
|
46 |
+
if ( $this->_need_to_show_woo() ) {
|
47 |
+
add_submenu_page(
|
48 |
+
self::PAGE_SLUG,
|
49 |
+
sprintf( __( 'Import your products from WooCommerce to %s', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand() ),
|
50 |
+
sprintf( __( 'Import your products from WooCommerce to %s', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand() ),
|
51 |
+
Ecwid_Admin::get_capability(),
|
52 |
+
self::PAGE_SLUG_WOO,
|
53 |
+
array( $this, 'do_woo_page' )
|
54 |
+
);
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
public function enqueue_scripts()
|
59 |
+
{
|
60 |
+
wp_enqueue_style( 'ecwid-importer', ECWID_PLUGIN_URL . '/css/importer.css' );
|
61 |
+
wp_enqueue_script( 'ecwid-importer', ECWID_PLUGIN_URL . '/js/importer.js' );
|
62 |
+
wp_localize_script( 'ecwid-importer', 'ecwid_importer', array(
|
63 |
+
'check_token_action' => self::AJAX_ACTION_CHECK_IMPORT,
|
64 |
+
'do_woo_import_action' => self::AJAX_ACTION_DO_WOO_IMPORT
|
65 |
+
) );
|
66 |
+
}
|
67 |
+
|
68 |
+
public function check_import()
|
69 |
+
{
|
70 |
+
if ( !current_user_can( Ecwid_Admin::get_capability() ) ) {
|
71 |
+
return;
|
72 |
+
}
|
73 |
+
|
74 |
+
$data = array();
|
75 |
+
$token_ok = $this->_is_token_ok();
|
76 |
+
if ( !$token_ok ){
|
77 |
+
$data['has_good_token'] = false;
|
78 |
+
} else {
|
79 |
+
$data['has_good_token'] = true;
|
80 |
+
$data = Ecwid_Import::gather_import_data();
|
81 |
+
}
|
82 |
+
|
83 |
+
echo json_encode( $data );
|
84 |
+
|
85 |
+
die();
|
86 |
+
}
|
87 |
+
|
88 |
+
// Returns url for the page that should be displayed on clicking the "Import from woo" button in woo import onboarding message
|
89 |
+
public static function get_woo_page_url_from_message() {
|
90 |
+
return 'admin.php?page=' . self::PAGE_SLUG_WOO . '&' . self::PARAM_FROM_IMPORT_ONBOARDING . '=1';
|
91 |
+
}
|
92 |
+
|
93 |
+
protected function _is_token_ok()
|
94 |
+
{
|
95 |
+
$oauth = new Ecwid_OAuth();
|
96 |
+
|
97 |
+
return $oauth->has_scope( 'create_catalog' ) && $oauth->has_scope( 'update_catalog' );
|
98 |
+
}
|
99 |
+
|
100 |
+
public function do_woo_import()
|
101 |
+
{
|
102 |
+
$importer = new Ecwid_Importer();
|
103 |
+
|
104 |
+
if ( !$importer->has_begun() ) {
|
105 |
+
$importer->initiate( @$_REQUEST['settings'] );
|
106 |
+
}
|
107 |
+
|
108 |
+
$result = $importer->proceed();
|
109 |
+
|
110 |
+
echo json_encode( $result );
|
111 |
+
|
112 |
+
die();
|
113 |
+
}
|
114 |
+
|
115 |
+
protected function _get_billing_page_url() {
|
116 |
+
return 'admin.php?page=' . Ecwid_Admin::ADMIN_SLUG . '&ec-page=billing';
|
117 |
+
}
|
118 |
+
|
119 |
+
protected function _get_reconnect_url()
|
120 |
+
{
|
121 |
+
return 'admin.php?page=' . Ecwid_Admin::ADMIN_SLUG . '&reconnect&return-url=' . urlencode( $this->_get_woo_url() ) . '&scope=create_catalog+update_catalog&do_reconnect=1';
|
122 |
+
}
|
123 |
+
|
124 |
+
|
125 |
+
protected function _get_woo_url()
|
126 |
+
{
|
127 |
+
return 'admin.php?page=' . self::PAGE_SLUG_WOO;
|
128 |
+
}
|
129 |
+
|
130 |
+
protected function _need_to_show_woo()
|
131 |
+
{
|
132 |
+
return is_plugin_active( 'woocommerce/woocommerce.php' );
|
133 |
+
}
|
134 |
+
|
135 |
+
public function do_page()
|
136 |
+
{
|
137 |
+
require_once ECWID_IMPORTER_TEMPLATES_DIR . '/landing.tpl.php';
|
138 |
+
}
|
139 |
+
|
140 |
+
public function do_woo_page()
|
141 |
+
{
|
142 |
+
$import_data = Ecwid_Import::gather_import_data();
|
143 |
+
|
144 |
+
require_once ECWID_IMPORTER_TEMPLATES_DIR . '/woo-main.tpl.php';
|
145 |
+
}
|
146 |
+
}
|
includes/importer/class-ecwid-import.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( !defined( 'ECWID_IMPORTER_TEMPLATES_DIR' ) ) {
|
4 |
+
define ( 'ECWID_IMPORTER_TEMPLATES_DIR', ECWID_TEMPLATES_DIR . '/importer' );
|
5 |
+
}
|
6 |
+
|
7 |
+
require_once __DIR__ . '/class-ecwid-importer.php';
|
8 |
+
require_once __DIR__ . '/class-ecwid-import-page.php';
|
9 |
+
|
10 |
+
class Ecwid_Import
|
11 |
+
{
|
12 |
+
const PAGE_SLUG = 'ec-store-import';
|
13 |
+
const IMPORTER_IDENTIFIER = 'ec-store-import';
|
14 |
+
|
15 |
+
protected $_view = null;
|
16 |
+
|
17 |
+
public function __construct()
|
18 |
+
{
|
19 |
+
if ( !Ecwid_Api_V3::is_available() || ecwid_is_demo_store() ) {
|
20 |
+
return;
|
21 |
+
}
|
22 |
+
|
23 |
+
$this->_view = new Ecwid_Import_Page();
|
24 |
+
$this->_view->init_actions();
|
25 |
+
|
26 |
+
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
27 |
+
}
|
28 |
+
|
29 |
+
public function admin_init()
|
30 |
+
{
|
31 |
+
if ( !Ecwid_Config::is_wl() ) {
|
32 |
+
if ( !function_exists( 'register_importer' ) ) {
|
33 |
+
require_once ABSPATH . 'wp-admin/includes/import.php';
|
34 |
+
}
|
35 |
+
|
36 |
+
register_importer(
|
37 |
+
self::IMPORTER_IDENTIFIER,
|
38 |
+
sprintf( __( '%s products and categories', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand() ),
|
39 |
+
sprintf( __( 'Bulk import products and categories to your %s store', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand() ),
|
40 |
+
array( $this->_view, 'do_page' )
|
41 |
+
);
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
public static function gather_import_data()
|
47 |
+
{
|
48 |
+
$result = array();
|
49 |
+
|
50 |
+
$api = new Ecwid_Api_V3();
|
51 |
+
|
52 |
+
$ecwid_products = $api->get_products( array( 'limit' => '1' ) );
|
53 |
+
$result['ecwid_total_products'] = $ecwid_products->total;
|
54 |
+
|
55 |
+
$ecwid_categories = $api->get_categories(array('limit' => 1));
|
56 |
+
$result['ecwid_total_categories'] = $ecwid_categories->total;
|
57 |
+
|
58 |
+
$result['allow_delete_demo'] = self::allow_delete_demo_products();
|
59 |
+
|
60 |
+
$count = wp_count_posts( 'product' );
|
61 |
+
|
62 |
+
$result['woo_total_products'] = $count->publish;
|
63 |
+
|
64 |
+
$args = array(
|
65 |
+
'taxonomy' => 'product_cat',
|
66 |
+
'count' => true,
|
67 |
+
'hierarchical' => true,
|
68 |
+
'get' => 'all'
|
69 |
+
);
|
70 |
+
$all_categories = get_categories( $args );
|
71 |
+
$result['woo_total_categories'] = count( $all_categories );
|
72 |
+
|
73 |
+
return $result;
|
74 |
+
}
|
75 |
+
|
76 |
+
public static function allow_delete_demo_products()
|
77 |
+
{
|
78 |
+
$result = false;
|
79 |
+
|
80 |
+
$api = new Ecwid_Api_V3();
|
81 |
+
|
82 |
+
$demo_products = $api->get_products( array( 'createdFrom' => Ecwid_Importer::DEMO_CREATE_FROM, 'createdTo' => Ecwid_Importer::DEMO_CREATE_TO + 1 ) );
|
83 |
+
if ( $demo_products->total <= 10 ) {
|
84 |
+
$result = true;
|
85 |
+
foreach ( $demo_products->items as $product ) {
|
86 |
+
if ( !self::_is_demo_product( $product ) ) {
|
87 |
+
$result = false;
|
88 |
+
break;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
return $result;
|
94 |
+
}
|
95 |
+
|
96 |
+
protected static function _is_demo_product( $product_data ) {
|
97 |
+
return strpos( $product_data->originalImage->url, '/default-store/' ) > 0;
|
98 |
+
}
|
99 |
+
}
|
includes/importer/class-ecwid-importer-task.php
ADDED
@@ -0,0 +1,298 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
abstract class Ecwid_Importer_Task
|
4 |
+
{
|
5 |
+
public static $type;
|
6 |
+
|
7 |
+
abstract public function execute( Ecwid_Importer $exporter, $data );
|
8 |
+
|
9 |
+
public static function load_task( $task_type ) {
|
10 |
+
$tasks = self::get_tasks();
|
11 |
+
|
12 |
+
$task = $tasks[$task_type];
|
13 |
+
|
14 |
+
return new $task();
|
15 |
+
}
|
16 |
+
|
17 |
+
protected static function get_tasks()
|
18 |
+
{
|
19 |
+
static $tasks = array();
|
20 |
+
|
21 |
+
if ( !empty( $tasks ) ) {
|
22 |
+
return $tasks;
|
23 |
+
}
|
24 |
+
|
25 |
+
$names = array( 'Create_Category', 'Create_Product', 'Upload_Product_Image', 'Upload_Category_Image', 'Delete_Products' );
|
26 |
+
|
27 |
+
foreach ( $names as $name ) {
|
28 |
+
$class_name = 'Ecwid_Importer_Task_' . $name;
|
29 |
+
|
30 |
+
$tasks[$class_name::$type] = $class_name;
|
31 |
+
}
|
32 |
+
|
33 |
+
return $tasks;
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
37 |
+
|
38 |
+
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' => floatval( get_post_meta( $woo_id, '_regular_price', true ) ),
|
51 |
+
'description' => $product->post_content,
|
52 |
+
'isShippingRequired' => get_post_meta( $woo_id, '_virtual', true ) != 'yes',
|
53 |
+
'categoryIds' => array(),
|
54 |
+
'showOnFrontpage' => (int) ( get_post_meta( $woo_id, '_featured', true ) == 'yes' )
|
55 |
+
);
|
56 |
+
|
57 |
+
if ( !empty( get_post_meta( $woo_id, '_sku', true ) ) ) {
|
58 |
+
$data['sku'] = get_post_meta( $woo_id, '_sku', true );
|
59 |
+
}
|
60 |
+
|
61 |
+
if ( get_post_meta( $woo_id, '_manage_stock', true ) == 'yes' ) {
|
62 |
+
$data['unlimited'] = false;
|
63 |
+
$data['quantity'] = intval( get_post_meta( $woo_id, '_stock', true ) );
|
64 |
+
} else {
|
65 |
+
$data['unlimited'] = true;
|
66 |
+
}
|
67 |
+
|
68 |
+
$categories = get_the_terms( $woo_id, 'product_cat' );
|
69 |
+
|
70 |
+
if ( $categories ) foreach ( $categories as $category ) {
|
71 |
+
$category_id = $exporter->get_ecwid_category_id( $category->term_id );
|
72 |
+
|
73 |
+
if ( $category_id ) {
|
74 |
+
$data['categoryIds'][] = $category_id;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
if ( empty( $data['cateogryIds'] ) ) {
|
78 |
+
unset($data['categoryIds']);
|
79 |
+
}
|
80 |
+
|
81 |
+
$data['categoryIds'] = array();
|
82 |
+
|
83 |
+
$result = null;
|
84 |
+
if ( $exporter->get_setting( Ecwid_Importer::SETTING_UPDATE_BY_SKU ) ) {
|
85 |
+
$products = $api->get_products( array( 'sku' => $data['sku'] ) );
|
86 |
+
|
87 |
+
if ( $products->total > 0 ) {
|
88 |
+
$data['id'] = $products->items[0]->id;
|
89 |
+
$result = $api->update_product( $data );
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
if ( !$result ) {
|
94 |
+
$result = $api->create_product( $data );
|
95 |
+
}
|
96 |
+
|
97 |
+
$return = array(
|
98 |
+
'type' => self::$type
|
99 |
+
);
|
100 |
+
|
101 |
+
if ( $result['response']['code'] == '200' ) {
|
102 |
+
$result_object = json_decode( $result['body'] );
|
103 |
+
|
104 |
+
$exporter->save_ecwid_product_id( $woo_id, $result_object->id );
|
105 |
+
|
106 |
+
$return['status'] = 'success';
|
107 |
+
$return['data'] = $result_object;
|
108 |
+
} else {
|
109 |
+
$return['status'] = 'error';
|
110 |
+
$return['data'] = $result;
|
111 |
+
$return['sent_data'] = $data;
|
112 |
+
}
|
113 |
+
|
114 |
+
return $return;
|
115 |
+
}
|
116 |
+
|
117 |
+
public static function build( $data ) {
|
118 |
+
return array(
|
119 |
+
'type' => self::$type,
|
120 |
+
'woo_id' => $data['woo_id']
|
121 |
+
);
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
class Ecwid_Importer_Task_Delete_Products extends Ecwid_Importer_Task
|
126 |
+
{
|
127 |
+
public static $type = 'delete_products';
|
128 |
+
|
129 |
+
public function execute( Ecwid_Importer $exporter, $data ) {
|
130 |
+
$api = new Ecwid_Api_V3();
|
131 |
+
|
132 |
+
$ids = $data['ids'];
|
133 |
+
|
134 |
+
$result = $api->delete_products( $ids );
|
135 |
+
|
136 |
+
$return = array(
|
137 |
+
'type' => self::$type
|
138 |
+
);
|
139 |
+
|
140 |
+
$return['status'] = 'success';
|
141 |
+
$return['data'] = $result;
|
142 |
+
|
143 |
+
return $return;
|
144 |
+
}
|
145 |
+
|
146 |
+
public static function build( $ids ) {
|
147 |
+
return array(
|
148 |
+
'type' => self::$type,
|
149 |
+
'ids' => $ids
|
150 |
+
);
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
class Ecwid_Importer_Task_Upload_Category_Image extends Ecwid_Importer_Task
|
155 |
+
{
|
156 |
+
public static $type = 'upload_category_image';
|
157 |
+
|
158 |
+
public function execute( Ecwid_Importer $exporter, $category_data ) {
|
159 |
+
$api = new Ecwid_Api_V3();
|
160 |
+
|
161 |
+
$woo_id = $category_data['woo_id'];
|
162 |
+
|
163 |
+
// get the thumbnail id using the queried category term_id
|
164 |
+
$thumbnail_id = get_term_meta( $woo_id, 'thumbnail_id', true );
|
165 |
+
$file = get_attached_file ( $thumbnail_id );
|
166 |
+
|
167 |
+
$category_id = $exporter->get_ecwid_category_id( $woo_id );
|
168 |
+
if ( !$category_id ) {
|
169 |
+
return array(
|
170 |
+
'status' => 'error',
|
171 |
+
'data' => 'skipped',
|
172 |
+
'message' => 'parent category was not imported'
|
173 |
+
);
|
174 |
+
}
|
175 |
+
|
176 |
+
$data = array(
|
177 |
+
'categoryId' => $category_id,
|
178 |
+
'data' => file_get_contents( $file )
|
179 |
+
);
|
180 |
+
|
181 |
+
$result = $api->upload_category_image( $data );
|
182 |
+
|
183 |
+
$return = array(
|
184 |
+
'type' => self::$type
|
185 |
+
);
|
186 |
+
if ( $result['response']['code'] == '200' ) {
|
187 |
+
$result_object = json_decode( $result['body'] );
|
188 |
+
|
189 |
+
$return['status'] = 'success';
|
190 |
+
$return['data'] = $result_object;
|
191 |
+
} else {
|
192 |
+
$return['status'] = 'error';
|
193 |
+
$return['data'] = $result;
|
194 |
+
}
|
195 |
+
|
196 |
+
return $return;
|
197 |
+
}
|
198 |
+
|
199 |
+
public static function build($data) {
|
200 |
+
return array(
|
201 |
+
'type' => self::$type,
|
202 |
+
'woo_id' => $data['woo_id']
|
203 |
+
);
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
class Ecwid_Importer_Task_Upload_Product_Image extends Ecwid_Importer_Task
|
208 |
+
{
|
209 |
+
public static $type = 'upload_product_image';
|
210 |
+
|
211 |
+
public function execute( Ecwid_Importer $exporter, $product_data ) {
|
212 |
+
$api = new Ecwid_Api_V3();
|
213 |
+
|
214 |
+
$file = get_attached_file ( get_post_thumbnail_id( $product_data['woo_id'] ) );
|
215 |
+
|
216 |
+
$product_id = $exporter->get_ecwid_product_id( $product_data['woo_id'] );
|
217 |
+
if ( !$product_id ) {
|
218 |
+
return array(
|
219 |
+
'status' => 'error',
|
220 |
+
'data' => 'skipped',
|
221 |
+
'message' => 'Parent product was not imported'
|
222 |
+
);
|
223 |
+
}
|
224 |
+
|
225 |
+
$data = array(
|
226 |
+
'productId' => $product_id,
|
227 |
+
'data' => file_get_contents( $file )
|
228 |
+
);
|
229 |
+
|
230 |
+
$result = $api->upload_product_image( $data );
|
231 |
+
|
232 |
+
$return = array(
|
233 |
+
'type' => self::$type
|
234 |
+
);
|
235 |
+
if ( $result['response']['code'] == '200' ) {
|
236 |
+
$result_object = json_decode( $result['body'] );
|
237 |
+
|
238 |
+
$return['status'] = 'success';
|
239 |
+
$return['data'] = $result_object;
|
240 |
+
} else {
|
241 |
+
$return['status'] = 'error';
|
242 |
+
$return['data'] = $result;
|
243 |
+
}
|
244 |
+
|
245 |
+
return $return;
|
246 |
+
}
|
247 |
+
|
248 |
+
public static function build($data) {
|
249 |
+
return array(
|
250 |
+
'type' => self::$type,
|
251 |
+
'woo_id' => $data['woo_id']
|
252 |
+
);
|
253 |
+
}
|
254 |
+
}
|
255 |
+
|
256 |
+
class Ecwid_Importer_Task_Create_Category extends Ecwid_Importer_Task
|
257 |
+
{
|
258 |
+
public static $type = 'create_category';
|
259 |
+
|
260 |
+
public function execute( Ecwid_Importer $exporter, $category_data ) {
|
261 |
+
$api = new Ecwid_Api_V3();
|
262 |
+
|
263 |
+
$category = get_term_by( 'id', $category_data['woo_id'], 'product_cat' );
|
264 |
+
$data = array(
|
265 |
+
'name' => $category->name,
|
266 |
+
'parentId' => $exporter->get_ecwid_category_id( $category->parent ),
|
267 |
+
'description' => $category->description
|
268 |
+
);
|
269 |
+
|
270 |
+
$result = $api->create_category(
|
271 |
+
$data
|
272 |
+
);
|
273 |
+
|
274 |
+
$return = array(
|
275 |
+
'type' => self::$type
|
276 |
+
);
|
277 |
+
if ( $result['response']['code'] == '200' ) {
|
278 |
+
$result_object = json_decode( $result['body'] );
|
279 |
+
|
280 |
+
$exporter->save_ecwid_category( $category_data['woo_id'], $result_object->id );
|
281 |
+
|
282 |
+
$return['status'] = 'success';
|
283 |
+
$return['data'] = $result_object;
|
284 |
+
} else {
|
285 |
+
$return['status'] = 'error';
|
286 |
+
$return['data'] = $result;
|
287 |
+
}
|
288 |
+
|
289 |
+
return $return;
|
290 |
+
}
|
291 |
+
|
292 |
+
public static function build($data) {
|
293 |
+
return array(
|
294 |
+
'type' => self::$type,
|
295 |
+
'woo_id' => $data['woo_id']
|
296 |
+
);
|
297 |
+
}
|
298 |
+
}
|
includes/importer/class-ecwid-importer.php
ADDED
@@ -0,0 +1,379 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once dirname(__FILE__) . '/class-ecwid-importer-task.php';
|
4 |
+
|
5 |
+
class Ecwid_Importer
|
6 |
+
{
|
7 |
+
const OPTION_TASKS = 'ecwid_importer_tasks';
|
8 |
+
const OPTION_CURRENT_TASK = 'ecwid_importer_current_task';
|
9 |
+
const OPTION_CATEGORIES = 'ecwid_importer_categories';
|
10 |
+
const OPTION_PRODUCTS = 'ecwid_importer_products';
|
11 |
+
const OPTION_STATUS = 'ecwid_importer_status';
|
12 |
+
const OPTION_WOO_CATALOG_IMPORTED = 'ecwid_imported_from_woo';
|
13 |
+
const OPTION_SETTINGS = 'ecwid_importer_settings';
|
14 |
+
const TICK_LENGTH = 5;
|
15 |
+
|
16 |
+
const SETTING_UPDATE_BY_SKU = 'update-by-sku';
|
17 |
+
const SETTING_DELETE_DEMO = 'delete-demo';
|
18 |
+
|
19 |
+
const DEMO_CREATE_FROM = 1469707991;
|
20 |
+
const DEMO_CREATE_TO = 1469710442;
|
21 |
+
|
22 |
+
protected $_tasks;
|
23 |
+
protected $_start_time;
|
24 |
+
|
25 |
+
public function initiate( $settings = array() )
|
26 |
+
{
|
27 |
+
update_option( self::OPTION_CATEGORIES, array() );
|
28 |
+
update_option( self::OPTION_PRODUCTS, array() );
|
29 |
+
update_option( self::OPTION_TASKS, array() );
|
30 |
+
update_option( self::OPTION_STATUS, array() );
|
31 |
+
|
32 |
+
$this->_start();
|
33 |
+
|
34 |
+
$api = new Ecwid_Api_V3();
|
35 |
+
|
36 |
+
$this->_set_settings( $settings );
|
37 |
+
$this->_maybe_set_forced_settings();
|
38 |
+
$this->_build_tasks();
|
39 |
+
$this->_set_current_task( 0 );
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
public function tick()
|
44 |
+
{
|
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 |
+
|
52 |
+
do {
|
53 |
+
$current_task = $this->_load_current_task();
|
54 |
+
|
55 |
+
$task_data = $this->_tasks[$current_task];
|
56 |
+
|
57 |
+
if ( !is_array( $status['plan_limit'] ) || !array_key_exists( $task_data['type'], $status['plan_limit'] ) ) {
|
58 |
+
|
59 |
+
$task = Ecwid_Importer_Task::load_task($task_data['type']);
|
60 |
+
|
61 |
+
$result = $task->execute($this, $task_data);
|
62 |
+
|
63 |
+
if ( $result['status'] == 'error' ) {
|
64 |
+
$progress['error'][] = $task_data['type'];
|
65 |
+
|
66 |
+
$error_data = $result['data'];
|
67 |
+
|
68 |
+
if ( @$error_data['response']['code'] == 402 ) {
|
69 |
+
$status['plan_limit'][$task_data['type']] = true;
|
70 |
+
}
|
71 |
+
|
72 |
+
$message = '';
|
73 |
+
if ( is_wp_error( $error_data ) ) {
|
74 |
+
$message = $result['data']->get_error_message();
|
75 |
+
} elseif ( isset( $error_data['api_message'] ) ) {
|
76 |
+
$message = $error_data['api_message'];
|
77 |
+
} elseif ( @$error_data == 'skipped' ) {
|
78 |
+
$message = $result['message'];
|
79 |
+
}
|
80 |
+
|
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 |
+
}
|
87 |
+
|
88 |
+
update_option( self::OPTION_STATUS, $status );
|
89 |
+
} else {
|
90 |
+
$progress['error'][] = $task_data['type'];
|
91 |
+
$progress['plan_limit_hit'][] = $task_data['type'];
|
92 |
+
}
|
93 |
+
|
94 |
+
$current_task++;
|
95 |
+
|
96 |
+
if ( $current_task >= count( $this->_tasks ) ) {
|
97 |
+
break;
|
98 |
+
}
|
99 |
+
|
100 |
+
$this->_set_current_task( $current_task );
|
101 |
+
$count++;
|
102 |
+
|
103 |
+
$progress['current'] = $current_task;
|
104 |
+
|
105 |
+
if ( $count > self::TICK_LENGTH ) {
|
106 |
+
$progress['status'] = 'in_progress';
|
107 |
+
|
108 |
+
return $progress;
|
109 |
+
}
|
110 |
+
|
111 |
+
} while ( 1 );
|
112 |
+
|
113 |
+
$this->_set_tasks( null );
|
114 |
+
|
115 |
+
$progress['status'] = 'complete';
|
116 |
+
|
117 |
+
update_option( self::OPTION_WOO_CATALOG_IMPORTED, 'true' );
|
118 |
+
|
119 |
+
return $progress;
|
120 |
+
}
|
121 |
+
|
122 |
+
public function has_begun()
|
123 |
+
{
|
124 |
+
return $this->_load_tasks() != null;
|
125 |
+
}
|
126 |
+
|
127 |
+
public function proceed()
|
128 |
+
{
|
129 |
+
$this->_load_tasks();
|
130 |
+
$this->_load_current_task();
|
131 |
+
|
132 |
+
return $this->tick();
|
133 |
+
}
|
134 |
+
|
135 |
+
public function get_ecwid_category_id( $woo_category_id ) {
|
136 |
+
if ( !$woo_category_id ) {
|
137 |
+
return 0;
|
138 |
+
}
|
139 |
+
|
140 |
+
$categories = get_option( self::OPTION_CATEGORIES, array() );
|
141 |
+
|
142 |
+
return $categories[$woo_category_id];
|
143 |
+
}
|
144 |
+
|
145 |
+
public function save_ecwid_category( $woo_category_id, $ecwid_category_id )
|
146 |
+
{
|
147 |
+
$categories = get_option( self::OPTION_CATEGORIES, array() );
|
148 |
+
|
149 |
+
$categories[$woo_category_id] = $ecwid_category_id;
|
150 |
+
|
151 |
+
update_option(self::OPTION_CATEGORIES, $categories );
|
152 |
+
}
|
153 |
+
|
154 |
+
public function get_ecwid_product_id( $woo_product_id ) {
|
155 |
+
$products = get_option( self::OPTION_PRODUCTS, array() );
|
156 |
+
|
157 |
+
return @$products[$woo_product_id];
|
158 |
+
}
|
159 |
+
|
160 |
+
public function save_ecwid_product_id( $woo_product_id, $ecwid_product_id )
|
161 |
+
{
|
162 |
+
$products = get_option( self::OPTION_PRODUCTS, array() );
|
163 |
+
|
164 |
+
$products[$woo_product_id] = $ecwid_product_id;
|
165 |
+
|
166 |
+
update_option(self::OPTION_PRODUCTS, $products );
|
167 |
+
}
|
168 |
+
|
169 |
+
protected function _start()
|
170 |
+
{
|
171 |
+
$this->_start_time = time();
|
172 |
+
}
|
173 |
+
|
174 |
+
protected function _build_tasks()
|
175 |
+
{
|
176 |
+
$tasks = array();
|
177 |
+
|
178 |
+
if ( $this->get_setting( self::SETTING_DELETE_DEMO ) && Ecwid_Import::allow_delete_demo_products() ) {
|
179 |
+
$products = self::get_ecwid_demo_products();
|
180 |
+
|
181 |
+
$ids = array();
|
182 |
+
foreach ( $products->items as $item ) {
|
183 |
+
$ids[] = $item->id;
|
184 |
+
}
|
185 |
+
|
186 |
+
$tasks[] = Ecwid_Importer_Task_Delete_Products::build( $ids );
|
187 |
+
}
|
188 |
+
|
189 |
+
|
190 |
+
$categories = $this->gather_categories();
|
191 |
+
|
192 |
+
foreach ( @$categories as $category ) {
|
193 |
+
$tasks[] = Ecwid_Importer_Task_Create_Category::build( $category );
|
194 |
+
if ( $category['has_image'] ) {
|
195 |
+
$tasks[] = Ecwid_Importer_Task_Upload_Category_Image::build( $category );
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
$products = $this->gather_products();
|
200 |
+
|
201 |
+
foreach ( $products as $product ) {
|
202 |
+
$tasks[] = Ecwid_Importer_Task_Create_Product::build( $product );
|
203 |
+
|
204 |
+
if ( $product['has_image'] ) {
|
205 |
+
$tasks[] = Ecwid_Importer_Task_Upload_Product_Image::build( $product );
|
206 |
+
}
|
207 |
+
/*
|
208 |
+
if ( $product['has_gallery_images'] ) {
|
209 |
+
foreach ( $product->gallery_images as $image ) {
|
210 |
+
$tasks[] = $this->_build_upload_product_gallery_image_task( $product, $image );
|
211 |
+
}
|
212 |
+
}
|
213 |
+
*/ }
|
214 |
+
|
215 |
+
$this->_set_tasks($tasks);
|
216 |
+
}
|
217 |
+
|
218 |
+
protected function _set_tasks( $tasks )
|
219 |
+
{
|
220 |
+
$this->_tasks = $tasks;
|
221 |
+
update_option( self::OPTION_TASKS, $this->_tasks );
|
222 |
+
}
|
223 |
+
|
224 |
+
protected function _load_tasks()
|
225 |
+
{
|
226 |
+
return $this->_tasks = get_option( self::OPTION_TASKS, null );
|
227 |
+
}
|
228 |
+
|
229 |
+
protected function _set_current_task( $ind ) {
|
230 |
+
update_option( self::OPTION_CURRENT_TASK, $ind );
|
231 |
+
}
|
232 |
+
|
233 |
+
protected function _load_current_task() {
|
234 |
+
return get_option( self::OPTION_CURRENT_TASK, null );
|
235 |
+
}
|
236 |
+
|
237 |
+
public function get_setting( $name ) {
|
238 |
+
$settings = get_option( self::OPTION_SETTINGS, array() );
|
239 |
+
|
240 |
+
return @$settings[$name];
|
241 |
+
}
|
242 |
+
|
243 |
+
protected function _set_setting( $name, $value ) {
|
244 |
+
$settings = get_option( self::OPTION_SETTINGS, array() );
|
245 |
+
|
246 |
+
$settings[$name] = $value;
|
247 |
+
|
248 |
+
update_option( self::OPTION_SETTINGS, $settings );
|
249 |
+
}
|
250 |
+
|
251 |
+
protected function _set_settings( $settings ) {
|
252 |
+
$saved_settings = array();
|
253 |
+
|
254 |
+
if ( $settings[self::SETTING_UPDATE_BY_SKU] ) {
|
255 |
+
$saved_settings[self::SETTING_UPDATE_BY_SKU] = true;
|
256 |
+
}
|
257 |
+
|
258 |
+
if ( @$settings[self::SETTING_DELETE_DEMO] ) {
|
259 |
+
$saved_settings[self::SETTING_DELETE_DEMO] = true;
|
260 |
+
}
|
261 |
+
|
262 |
+
update_option( self::OPTION_SETTINGS, $saved_settings );
|
263 |
+
}
|
264 |
+
|
265 |
+
protected function _maybe_set_forced_settings() {
|
266 |
+
if ( self::count_ecwid_demo_products() > 0 && self::count_ecwid_demo_products() == self::count_ecwid_products() ) {
|
267 |
+
$this->_set_setting( self::SETTING_DELETE_DEMO, true );
|
268 |
+
}
|
269 |
+
}
|
270 |
+
|
271 |
+
public static function count_woo_categories()
|
272 |
+
{
|
273 |
+
$args = array(
|
274 |
+
'taxonomy' => 'product_cat',
|
275 |
+
'count' => true,
|
276 |
+
'hierarchical' => true,
|
277 |
+
'get' => 'all'
|
278 |
+
);
|
279 |
+
$all_categories = get_categories( $args );
|
280 |
+
|
281 |
+
return count($all_categories);
|
282 |
+
}
|
283 |
+
|
284 |
+
public static function count_woo_products()
|
285 |
+
{
|
286 |
+
$count = wp_count_posts( 'product' );
|
287 |
+
|
288 |
+
return $count->publish;
|
289 |
+
}
|
290 |
+
|
291 |
+
public static function count_ecwid_products()
|
292 |
+
{
|
293 |
+
$api = new Ecwid_Api_V3();
|
294 |
+
|
295 |
+
$ecwid_products = $api->get_products( array( 'limit' => 1 ) );
|
296 |
+
return $ecwid_products->total;
|
297 |
+
}
|
298 |
+
|
299 |
+
public static function count_ecwid_categories()
|
300 |
+
{
|
301 |
+
$api = new Ecwid_Api_V3();
|
302 |
+
|
303 |
+
$ecwid_categories = $api->get_categories( array( 'limit' => 1 ) );
|
304 |
+
return $ecwid_categories->total;
|
305 |
+
}
|
306 |
+
|
307 |
+
public static function count_ecwid_demo_products()
|
308 |
+
{
|
309 |
+
$ecwid_products = self::get_ecwid_demo_products();
|
310 |
+
|
311 |
+
return $ecwid_products->total;
|
312 |
+
}
|
313 |
+
|
314 |
+
public static function get_ecwid_demo_products() {
|
315 |
+
$api = new Ecwid_Api_V3();
|
316 |
+
|
317 |
+
$ecwid_products = $api->get_products( array( 'createdFrom' => self::DEMO_CREATE_FROM, 'createdTo' => self::DEMO_CREATE_TO ) );
|
318 |
+
|
319 |
+
return $ecwid_products;
|
320 |
+
}
|
321 |
+
|
322 |
+
|
323 |
+
public function gather_categories($parent = 0 )
|
324 |
+
{
|
325 |
+
$product_categories = get_categories( apply_filters( 'woocommerce_product_subcategories_args', array(
|
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();
|
337 |
+
}
|
338 |
+
|
339 |
+
$result = array();
|
340 |
+
foreach ( $product_categories as $category ) {
|
341 |
+
$result[] = array(
|
342 |
+
'woo_id' => $category->term_id,
|
343 |
+
'parent_id' => $parent,
|
344 |
+
'has_image' => get_term_meta( $category->term_id, 'thumbnail_id', true )
|
345 |
+
);
|
346 |
+
|
347 |
+
|
348 |
+
if ($parent != 0) {
|
349 |
+
// die(var_dump($product_categories, $parent));
|
350 |
+
}
|
351 |
+
|
352 |
+
|
353 |
+
//if ( $category->category_count > 0 ) {
|
354 |
+
$result = array_merge(
|
355 |
+
$result,
|
356 |
+
$this->gather_categories( $category->term_id )
|
357 |
+
);
|
358 |
+
//}
|
359 |
+
}
|
360 |
+
|
361 |
+
return $result;
|
362 |
+
}
|
363 |
+
|
364 |
+
public function gather_products()
|
365 |
+
{
|
366 |
+
$products = get_posts( array( 'post_type' => 'product', 'posts_per_page' => 2500 ) );
|
367 |
+
|
368 |
+
$return = array();
|
369 |
+
foreach ($products as $product) {
|
370 |
+
$return[] = array(
|
371 |
+
'woo_id' => $product->ID,
|
372 |
+
'has_image' => get_post_thumbnail_id( $product->ID ),
|
373 |
+
'has_gallery_images' => false
|
374 |
+
);
|
375 |
+
}
|
376 |
+
|
377 |
+
return $return;
|
378 |
+
}
|
379 |
+
}
|
includes/importer/importer.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if (version_compare( phpversion(), '5.3', '>' ) ) {
|
4 |
+
$oauth = new Ecwid_OAuth();
|
5 |
+
|
6 |
+
if ( $oauth->has_scope( Ecwid_OAuth::SCOPE_READ_CATALOG ) ) {
|
7 |
+
require __DIR__ . '/class-ecwid-import.php';
|
8 |
+
new Ecwid_Import();
|
9 |
+
}
|
10 |
+
}
|
includes/shortcodes/class-ecwid-shortcode-productbrowser.php
CHANGED
@@ -22,6 +22,11 @@ class Ecwid_Shortcode_ProductBrowser extends Ecwid_Shortcode_Base {
|
|
22 |
|
23 |
public function render() {
|
24 |
Ecwid_Store_Page::add_store_page( get_the_ID() );
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
return parent::render();
|
27 |
}
|
@@ -48,6 +53,18 @@ class Ecwid_Shortcode_ProductBrowser extends Ecwid_Shortcode_Base {
|
|
48 |
$classname = $this->_get_html_class_name();
|
49 |
$result = <<<HTML
|
50 |
<div id="ecwid-store-$store_id" class="ecwid-shopping-cart-$classname" data-ecwid-default-category-id="$html_catalog_params[default_category_id]">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
<div id="ecwid-html-catalog-$store_id">{$plain_content}</div>
|
52 |
</div>
|
53 |
HTML;
|
@@ -63,9 +80,18 @@ HTML;
|
|
63 |
public function _build_html_catalog($store_id, $params)
|
64 |
{
|
65 |
include_once ECWID_PLUGIN_DIR . 'lib/ecwid_catalog.php';
|
66 |
-
|
67 |
-
$
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
$catalog = new EcwidCatalog($store_id, $page_url);
|
70 |
|
71 |
$url = false;
|
22 |
|
23 |
public function render() {
|
24 |
Ecwid_Store_Page::add_store_page( get_the_ID() );
|
25 |
+
if( current_user_can( Ecwid_Admin::get_capability() ) ) {
|
26 |
+
|
27 |
+
$seo_links = new Ecwid_Seo_Links();
|
28 |
+
$seo_links->check_base_urls_on_view_store_page_as_admin();
|
29 |
+
}
|
30 |
|
31 |
return parent::render();
|
32 |
}
|
53 |
$classname = $this->_get_html_class_name();
|
54 |
$result = <<<HTML
|
55 |
<div id="ecwid-store-$store_id" class="ecwid-shopping-cart-$classname" data-ecwid-default-category-id="$html_catalog_params[default_category_id]">
|
56 |
+
<script>
|
57 |
+
function createClass(name,rules){
|
58 |
+
var style = document.createElement('style');
|
59 |
+
style.type = 'text/css';
|
60 |
+
document.getElementsByTagName('head')[0].appendChild(style);
|
61 |
+
if(!(style.sheet||{}).insertRule)
|
62 |
+
(style.styleSheet || style.sheet).addRule(name, rules);
|
63 |
+
else
|
64 |
+
style.sheet.insertRule(name+'{'+rules+'}',0);
|
65 |
+
}
|
66 |
+
createClass('#ecwid-html-catalog-$store_id','display:none;');
|
67 |
+
</script>
|
68 |
<div id="ecwid-html-catalog-$store_id">{$plain_content}</div>
|
69 |
</div>
|
70 |
HTML;
|
80 |
public function _build_html_catalog($store_id, $params)
|
81 |
{
|
82 |
include_once ECWID_PLUGIN_DIR . 'lib/ecwid_catalog.php';
|
83 |
+
|
84 |
+
$id = get_the_ID();
|
85 |
+
if (!$id) {
|
86 |
+
$id = Ecwid_Store_Page::get_current_store_page_id();
|
87 |
+
}
|
88 |
+
|
89 |
+
if ($id) {
|
90 |
+
$page_url = get_page_link( $id );
|
91 |
+
} else {
|
92 |
+
$page_url = '';
|
93 |
+
}
|
94 |
+
|
95 |
$catalog = new EcwidCatalog($store_id, $page_url);
|
96 |
|
97 |
$url = false;
|
includes/themes.php
CHANGED
@@ -82,7 +82,8 @@ function ecwid_apply_theme($theme_name = null)
|
|
82 |
'mfupdate',
|
83 |
'trend',
|
84 |
'Boundless',
|
85 |
-
'twentyseventeen'
|
|
|
86 |
);
|
87 |
|
88 |
$custom_themes = apply_filters( 'ecwid_custom_themes', $custom_themes );
|
82 |
'mfupdate',
|
83 |
'trend',
|
84 |
'Boundless',
|
85 |
+
'twentyseventeen',
|
86 |
+
'themify-music'
|
87 |
);
|
88 |
|
89 |
$custom_themes = apply_filters( 'ecwid_custom_themes', $custom_themes );
|
includes/themes/class-ecwid-theme-themify-music.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once ECWID_THEMES_DIR . '/class-ecwid-theme-base.php';
|
4 |
+
|
5 |
+
class Ecwid_Theme_Themify_Music extends Ecwid_Theme_Base
|
6 |
+
{
|
7 |
+
protected $name = 'Boundless';
|
8 |
+
|
9 |
+
public function __construct()
|
10 |
+
{
|
11 |
+
parent::__construct();
|
12 |
+
|
13 |
+
add_filter( Ecwid_Ajax_Defer_Renderer::FILTER_ENABLED, array( $this, 'filter_enabled_defer_rendering' ) );
|
14 |
+
}
|
15 |
+
|
16 |
+
public function filter_enabled_defer_rendering() {
|
17 |
+
$data = themify_get_data('disable_ajax');
|
18 |
+
|
19 |
+
return @$data['setting-disable_ajax'] != 'on';
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
$ecwid_current_theme = new Ecwid_Theme_Themify_Music();
|
includes/themes/class-ecwid-theme-trend.php
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
require_once ECWID_THEMES_DIR . '/class-ecwid-theme-base.php';
|
|
|
4 |
|
5 |
class Ecwid_Theme_Trend extends Ecwid_Theme_Base
|
6 |
{
|
@@ -12,9 +13,12 @@ class Ecwid_Theme_Trend extends Ecwid_Theme_Base
|
|
12 |
{
|
13 |
parent::__construct();
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
18 |
return;
|
19 |
}
|
20 |
|
1 |
<?php
|
2 |
|
3 |
require_once ECWID_THEMES_DIR . '/class-ecwid-theme-base.php';
|
4 |
+
require_once ECWID_PLUGIN_DIR . '/includes/class-ecwid-ajax-defer-renderer.php';
|
5 |
|
6 |
class Ecwid_Theme_Trend extends Ecwid_Theme_Base
|
7 |
{
|
13 |
{
|
14 |
parent::__construct();
|
15 |
|
16 |
+
if ( get_option('ecwid_defer_rendering') ) {
|
17 |
+
update_option( Ecwid_Ajax_Defer_Renderer::OPTION_DEFER_RENDERING, true );
|
18 |
+
delete_option( 'ecwid_defer_rendering' );
|
19 |
+
}
|
20 |
+
|
21 |
+
if ( !get_option( Ecwid_Ajax_Defer_Renderer::is_enabled() ) ) {
|
22 |
return;
|
23 |
}
|
24 |
|
includes/widgets/class-ecwid-widget-random-product.php
CHANGED
@@ -26,7 +26,7 @@ class Ecwid_Widget_Random_Product extends WP_Widget {
|
|
26 |
<a href="$url" data-ecwid-page="product" data-ecwid-product-id="$product->id"><div itemprop="image"></div></a>
|
27 |
<a href="$url" data-ecwid-page="product" data-ecwid-product-id="$product->id"><div class="ecwid-title" itemprop="name" content="$name"></div></a>
|
28 |
<a href="$url" data-ecwid-page="product" data-ecwid-product-id="$product->id"><div itemtype="http://schema.org/Offer" itemscope itemprop="offers">
|
29 |
-
<div class="ecwid-productBrowser-price ecwid-price" itemprop="price" content="$product->
|
30 |
<div itemprop="priceCurrency"></div>
|
31 |
</div>
|
32 |
</div>
|
26 |
<a href="$url" data-ecwid-page="product" data-ecwid-product-id="$product->id"><div itemprop="image"></div></a>
|
27 |
<a href="$url" data-ecwid-page="product" data-ecwid-product-id="$product->id"><div class="ecwid-title" itemprop="name" content="$name"></div></a>
|
28 |
<a href="$url" data-ecwid-page="product" data-ecwid-product-id="$product->id"><div itemtype="http://schema.org/Offer" itemscope itemprop="offers">
|
29 |
+
<div class="ecwid-productBrowser-price ecwid-price" itemprop="price" content="$product->defaultDisplayedPrice" data-spw-price-location="button">
|
30 |
<div itemprop="priceCurrency"></div>
|
31 |
</div>
|
32 |
</div>
|
js/admin.js
CHANGED
@@ -38,6 +38,8 @@ jQuery(document).ready(function() {
|
|
38 |
jQuery(a).closest('.ecwid-message').fadeOut();
|
39 |
}
|
40 |
);
|
|
|
|
|
41 |
});
|
42 |
|
43 |
if (location.href.match(/wp-admin\/widgets.php/) || location.href.match(/wp-admin\/customize.php/)) {
|
38 |
jQuery(a).closest('.ecwid-message').fadeOut();
|
39 |
}
|
40 |
);
|
41 |
+
|
42 |
+
return false;
|
43 |
});
|
44 |
|
45 |
if (location.href.match(/wp-admin\/widgets.php/) || location.href.match(/wp-admin\/customize.php/)) {
|
js/dashboard-blog.js
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function() {
|
2 |
+
window.ecwidBlogPosts = [];
|
3 |
+
|
4 |
+
if (ecwidDashboardBlog.posts.length > 0) {
|
5 |
+
renderBlogPosts(ecwidDashboardBlog.posts);
|
6 |
+
} else {
|
7 |
+
jQuery.getJSON( ecwidDashboardBlog.url, {}, function(data) {
|
8 |
+
posts = [], mediaIds = [];
|
9 |
+
|
10 |
+
for (var i = 0; i < data.length; i++) {
|
11 |
+
post = data[i];
|
12 |
+
window.ecwidBlogPosts[i] = {
|
13 |
+
'title': post.title.rendered,
|
14 |
+
'excerpt': post.excerpt.rendered,
|
15 |
+
'link': post.link,
|
16 |
+
'id': post.id
|
17 |
+
};
|
18 |
+
|
19 |
+
}
|
20 |
+
|
21 |
+
renderBlogPosts();
|
22 |
+
|
23 |
+
var deferreds = [];
|
24 |
+
for (var i = 0; i < data.length; i++) {
|
25 |
+
deferreds[deferreds.length] = jQuery.getJSON( ecwidDashboardBlog.mediaUrl + data[i].featured_media, function(data) {
|
26 |
+
var imageUrl = ecwidDashboardBlog.imagesCDN + data.media_details.sizes.medium.file;
|
27 |
+
jQuery('.ecwid-post-id-' + data.post + ' .ecwid-blog-post-image').css('background-image', 'url(' + imageUrl + ')');
|
28 |
+
|
29 |
+
for (var i = 0; i < window.ecwidBlogPosts.length; i++) if (window.ecwidBlogPosts[i].id == data.post ) {
|
30 |
+
window.ecwidBlogPosts[i].imageFile = data.media_details.sizes.medium.file;
|
31 |
+
}
|
32 |
+
});
|
33 |
+
}
|
34 |
+
|
35 |
+
jQuery.when.apply(jQuery, deferreds).done(function() {
|
36 |
+
sendPosts();
|
37 |
+
});
|
38 |
+
|
39 |
+
sendPosts = function() {
|
40 |
+
jQuery.ajax({
|
41 |
+
'url': ajaxurl + '?action=' + ecwidDashboardBlog.saveAction,
|
42 |
+
'method': 'POST',
|
43 |
+
'data': {
|
44 |
+
'posts': window.ecwidBlogPosts
|
45 |
+
}
|
46 |
+
});
|
47 |
+
};
|
48 |
+
|
49 |
+
sendPosts.posts = posts;
|
50 |
+
} );
|
51 |
+
}
|
52 |
+
|
53 |
+
function renderBlogPosts(posts) {
|
54 |
+
if (!posts) {
|
55 |
+
posts = window.ecwidBlogPosts;
|
56 |
+
}
|
57 |
+
for (var i = 0; i < posts.length; i++) {
|
58 |
+
var post = jQuery('#ecwid_blog_feed .template-container .ecwid-blog-post').clone();
|
59 |
+
post.addClass('ecwid-post-id-' + posts[i].id);
|
60 |
+
jQuery('.ecwid-blog-post-link', post).attr('href', posts[i].link);
|
61 |
+
jQuery('.ecwid-blog-post-title', post).html(posts[i].title);
|
62 |
+
jQuery('.ecwid-blog-post-excerpt', post).html(posts[i].excerpt);
|
63 |
+
|
64 |
+
if (posts[i].imageFile) {
|
65 |
+
jQuery('.ecwid-blog-post-image', post).css('background-image', 'url(' + ecwidDashboardBlog.imagesCDN + posts[i].imageFile + ')');
|
66 |
+
}
|
67 |
+
|
68 |
+
post.appendTo('#ecwid_blog_feed .ecwid-blog-posts');
|
69 |
+
}
|
70 |
+
}
|
71 |
+
});
|
js/gutenberg-block.js
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
( function( blocks, components, i18n, element, _ ) {
|
2 |
+
var el = element.createElement;
|
3 |
+
|
4 |
+
var ecwidStoreParams = {
|
5 |
+
title: EcwidGutenbergParams.title,
|
6 |
+
icon: el('div', {className:"ecwid-store-block-icon"}),
|
7 |
+
category: 'common',
|
8 |
+
attributes: {
|
9 |
+
widgets: { type: 'string' },
|
10 |
+
categories_per_row: { type: 'integer' },
|
11 |
+
grid: { type: 'string' },
|
12 |
+
list: { type: 'integer' },
|
13 |
+
table: { type: 'integer' },
|
14 |
+
default_category_id: { type: 'integer' },
|
15 |
+
default_product_id: { type: 'integer' },
|
16 |
+
category_view: { type: 'string' },
|
17 |
+
search_view: { type: 'string' },
|
18 |
+
minicart_layout: {type: 'string' }
|
19 |
+
},
|
20 |
+
useOnce: true,
|
21 |
+
|
22 |
+
edit: function( props ) {
|
23 |
+
|
24 |
+
return el( 'div', {className: 'ecwid-store-block' },
|
25 |
+
el( 'button', { className: 'button button-primary ecwid-store-block-button', onClick: function() { ecwid_open_store_popup( props ); } }, i18n.__( 'Edit Appearance' ) )
|
26 |
+
);
|
27 |
+
},
|
28 |
+
save: function( props ) {
|
29 |
+
var shortcode = new wp.shortcode({
|
30 |
+
'tag': EcwidGutenbergParams.storeShortcodeName,
|
31 |
+
'attrs': props.attributes,
|
32 |
+
'type': 'single'
|
33 |
+
});
|
34 |
+
|
35 |
+
return el( element.RawHTML, null, shortcode.string() );
|
36 |
+
},
|
37 |
+
|
38 |
+
transforms: {
|
39 |
+
from: [{
|
40 |
+
type: 'shortcode',
|
41 |
+
tag: ['ecwid', 'ec_store'],
|
42 |
+
attributes: {
|
43 |
+
widgets: {
|
44 |
+
type: 'string',
|
45 |
+
shortcode: function(named) {
|
46 |
+
return named.widgets
|
47 |
+
}
|
48 |
+
},
|
49 |
+
categories_per_row: {
|
50 |
+
type: 'integer',
|
51 |
+
shortcode: function(named) {
|
52 |
+
return named.categories_per_row
|
53 |
+
}
|
54 |
+
},
|
55 |
+
grid: {
|
56 |
+
type: 'string',
|
57 |
+
shortcode: function(named) {
|
58 |
+
return named.grid
|
59 |
+
}
|
60 |
+
},
|
61 |
+
list: {
|
62 |
+
type: 'integer',
|
63 |
+
shortcode: function(named) {
|
64 |
+
return named.list
|
65 |
+
}
|
66 |
+
},
|
67 |
+
table: {
|
68 |
+
type: 'integer',
|
69 |
+
shortcode: function(named) {
|
70 |
+
return named.table
|
71 |
+
}
|
72 |
+
},
|
73 |
+
default_category_id: {
|
74 |
+
type: 'integer',
|
75 |
+
shortcode: function(named) {
|
76 |
+
return named.default_category_id
|
77 |
+
}
|
78 |
+
},
|
79 |
+
default_product_id: {
|
80 |
+
type: 'integer',
|
81 |
+
shortcode: function(named) {
|
82 |
+
return named.default_product_id
|
83 |
+
}
|
84 |
+
},
|
85 |
+
category_view: {
|
86 |
+
type: 'string',
|
87 |
+
shortcode: function(named) {
|
88 |
+
return named.category_view
|
89 |
+
}
|
90 |
+
},
|
91 |
+
search_view: {
|
92 |
+
type: 'string',
|
93 |
+
shortcode: function(named) {
|
94 |
+
return named.search_view
|
95 |
+
}
|
96 |
+
},
|
97 |
+
minicart_layout: {
|
98 |
+
type: 'string',
|
99 |
+
shortcode: function(named) {
|
100 |
+
return named.minicart_layout
|
101 |
+
}
|
102 |
+
}
|
103 |
+
},
|
104 |
+
priority: 10
|
105 |
+
}]
|
106 |
+
},
|
107 |
+
};
|
108 |
+
blocks.registerBlockType( EcwidGutenbergParams.storeBlock, ecwidStoreParams);
|
109 |
+
|
110 |
+
} )(
|
111 |
+
window.wp.blocks,
|
112 |
+
window.wp.components,
|
113 |
+
window.wp.i18n,
|
114 |
+
window.wp.element,
|
115 |
+
window._
|
116 |
+
);
|
117 |
+
ecwid_pb_defaults = EcwidGutenbergParams.ecwid_pb_defaults;
|
js/importer.js
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function() {
|
2 |
+
$wrapper = jQuery('.ecwid-importer');
|
3 |
+
|
4 |
+
var status = {
|
5 |
+
'success' : [],
|
6 |
+
'error': [],
|
7 |
+
'errorMessages': {},
|
8 |
+
'planLimitHit': false
|
9 |
+
};
|
10 |
+
|
11 |
+
jQuery('#ecwid-importer-woo').click(function() {
|
12 |
+
|
13 |
+
window.location.hash="woo";
|
14 |
+
|
15 |
+
jQuery.getJSON(ajaxurl, { action: ecwid_importer.check_token_action }, function(data) {
|
16 |
+
if (data.has_good_token == false) {
|
17 |
+
$wrapper.removeClass('state-landing').addClass('state-no-token');
|
18 |
+
} else {
|
19 |
+
$wrapper.removeClass('state-landing').addClass('state-woo');
|
20 |
+
jQuery('.ecwid-total-products', '.state-woo').text(data.ecwid_total_products);
|
21 |
+
jQuery('.ecwid-total-categories', '.state-woo').text(data.ecwid_total_categories);
|
22 |
+
jQuery('.woo-total-products', '.state-woo').text(data.woo_total_products);
|
23 |
+
jQuery('.woo-total-categories', '.state-woo').text(data.woo_total_categories);
|
24 |
+
}
|
25 |
+
console.log(data);
|
26 |
+
})
|
27 |
+
.done(function() {
|
28 |
+
console.log( "second success" );
|
29 |
+
})
|
30 |
+
.fail(function() {
|
31 |
+
console.log( "error" );
|
32 |
+
})
|
33 |
+
.always(function() {
|
34 |
+
console.log( "complete" );
|
35 |
+
});
|
36 |
+
});
|
37 |
+
|
38 |
+
jQuery('#ecwid-importer-woo-go').click(function() {
|
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) {
|
45 |
+
settings[el.name] = true;
|
46 |
+
}
|
47 |
+
jQuery(el).attr('onclick', 'return false').closest('label').addClass('readonly');
|
48 |
+
});
|
49 |
+
|
50 |
+
do_import = function () {
|
51 |
+
jQuery.ajax({
|
52 |
+
'url': ajaxurl,
|
53 |
+
'data': {'action': ecwid_importer.do_woo_import_action, settings: settings},
|
54 |
+
'success': function (json) {
|
55 |
+
debugger;
|
56 |
+
data = jQuery.parseJSON(json);
|
57 |
+
|
58 |
+
for (var i = 0; i < data.success.length; i++) {
|
59 |
+
if (typeof status.success[data.success[i]] == 'undefined') {
|
60 |
+
status.success[data.success[i]] = 1;
|
61 |
+
} else {
|
62 |
+
status.success[data.success[i]]++;
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
|
67 |
+
for (var i = 0; i < data.error.length; i++) {
|
68 |
+
if (typeof status.error[data.error[i]] == 'undefined') {
|
69 |
+
status.error[data.error[i]] = 1;
|
70 |
+
} else {
|
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 |
+
}
|
85 |
+
|
86 |
+
for ( var message in messages ) {
|
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();
|
102 |
+
}
|
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";
|
121 |
+
for (var message in status.errorMessages[importType]) {
|
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 |
+
jQuery('.ecwid-importer .errors .btn-details').click(function() {
|
135 |
+
jQuery('.ecwid-importer .errors .details').toggle();
|
136 |
+
});
|
137 |
+
});
|
js/products-list.js
CHANGED
@@ -131,6 +131,8 @@ jQuery.widget('ecwid.productsList', {
|
|
131 |
}
|
132 |
|
133 |
jQuery('.' + this._prefix + '-name', container).text(product.name);
|
|
|
|
|
134 |
jQuery('.' + this._prefix + '-price.ecwid-productBrowser-price', container).text(product.price);
|
135 |
|
136 |
},
|
131 |
}
|
132 |
|
133 |
jQuery('.' + this._prefix + '-name', container).text(product.name);
|
134 |
+
|
135 |
+
price = product.defaultDisplayedPrice ? product.defaultDisplayedPrice : product.price;
|
136 |
jQuery('.' + this._prefix + '-price.ecwid-productBrowser-price', container).text(product.price);
|
137 |
|
138 |
},
|
js/store-editor-gutenberg.js
ADDED
@@ -0,0 +1,233 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function() {
|
2 |
+
$popup = jQuery('#ecwid-store-popup-content');
|
3 |
+
|
4 |
+
/*
|
5 |
+
jQuery('.media-modal-content', $popup)
|
6 |
+
.attr('data-mode', 'store-settings')
|
7 |
+
.attr('data-active-dialog', 'store-settings');
|
8 |
+
|
9 |
+
jQuery('.media-menu-item')
|
10 |
+
.removeClass('active')
|
11 |
+
.filter('[data-content=store-settings]').addClass('active');
|
12 |
+
*/
|
13 |
+
|
14 |
+
|
15 |
+
/*
|
16 |
+
* Media buttons handlers
|
17 |
+
*/
|
18 |
+
jQuery('#update-ecwid-button,#insert-ecwid-button').click(ecwid_open_store_popup);
|
19 |
+
|
20 |
+
/*
|
21 |
+
* Close button handler
|
22 |
+
*/
|
23 |
+
jQuery('.media-modal-close', $popup).click(function() {
|
24 |
+
|
25 |
+
$popup.data('block-props').attributes.meta1 = 'good' + Math.random();
|
26 |
+
$popup.removeClass('open');
|
27 |
+
return false;
|
28 |
+
});
|
29 |
+
|
30 |
+
jQuery(document).keydown(function(e) {
|
31 |
+
if (e.keyCode == 27 && $popup.hasClass('open')) {
|
32 |
+
$popup.removeClass('open');
|
33 |
+
return false;
|
34 |
+
}
|
35 |
+
});
|
36 |
+
|
37 |
+
/*
|
38 |
+
* Returns default parameters object
|
39 |
+
*/
|
40 |
+
getDefaultParams = function() {
|
41 |
+
return {
|
42 |
+
'show_search': true,
|
43 |
+
'show_minicart': true,
|
44 |
+
'show_categories': true,
|
45 |
+
'categories_per_row': 3,
|
46 |
+
'grid_rows': ecwid_pb_defaults.grid_rows,
|
47 |
+
'grid_columns': ecwid_pb_defaults.grid_columns,
|
48 |
+
'table_rows': ecwid_pb_defaults.table_rows,
|
49 |
+
'list_rows': ecwid_pb_defaults.list_rows,
|
50 |
+
'default_category_id': 0,
|
51 |
+
'default_product_id': 0,
|
52 |
+
'category_view': 'grid',
|
53 |
+
'search_view': 'list',
|
54 |
+
'minicart_layout': 'MiniAttachToProductBrowser'
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
/*
|
59 |
+
* Handles media modal menus
|
60 |
+
*/
|
61 |
+
jQuery('.media-menu-item', $popup).click(function() {
|
62 |
+
jQuery('.media-menu .media-menu-item', $popup).removeClass('active');
|
63 |
+
jQuery(this).addClass('active');
|
64 |
+
|
65 |
+
jQuery('.media-modal-content', $popup).attr('data-active-dialog', jQuery(this).attr('data-content'));
|
66 |
+
jQuery('.media-menu').removeClass('visible');
|
67 |
+
return false;
|
68 |
+
});
|
69 |
+
|
70 |
+
jQuery('h1', $popup).click(function() {
|
71 |
+
jQuery('.media-menu').toggleClass('visible');
|
72 |
+
})
|
73 |
+
|
74 |
+
/*
|
75 |
+
* Main button click
|
76 |
+
*/
|
77 |
+
jQuery('.button-primary', $popup).click(function() {
|
78 |
+
|
79 |
+
var result = {}, defaults = getDefaultParams();
|
80 |
+
|
81 |
+
result.widgets = 'productbrowser';
|
82 |
+
for (var i in {search:1, categories:1, minicart:1}) {
|
83 |
+
if (jQuery('input[name=show_' + i + ']').prop('checked')) {
|
84 |
+
result.widgets += ' ' + i;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
getNumber = function(name, fallback) {
|
89 |
+
var value = parseInt(jQuery('[name=' + name + ']', $popup).val());
|
90 |
+
|
91 |
+
if (isNaN(value) || value < 0) {
|
92 |
+
value = fallback;
|
93 |
+
}
|
94 |
+
|
95 |
+
return value;
|
96 |
+
}
|
97 |
+
|
98 |
+
getString = function(name, values, fallback) {
|
99 |
+
var value = jQuery('[name=' + name + ']', $popup).val();
|
100 |
+
|
101 |
+
if (jQuery.inArray(value, values) == -1) {
|
102 |
+
value = fallback;
|
103 |
+
}
|
104 |
+
|
105 |
+
return value;
|
106 |
+
}
|
107 |
+
|
108 |
+
result.categories_per_row = getNumber('categories_per_row', defaults.categories_per_row);
|
109 |
+
result.grid = getNumber('grid_rows', defaults.grid_rows) + ',' + getNumber('grid_columns', defaults.grid_columns);
|
110 |
+
result.list = getNumber('list_rows', defaults.list_rows);
|
111 |
+
result.table = getNumber('table_rows', defaults.table_rows);
|
112 |
+
result.default_category_id = getNumber('default_category_id', defaults.default_category_id);
|
113 |
+
result.default_product_id = getNumber('default_product_id', defaults.default_product_id);
|
114 |
+
result.category_view = getString('category_view', ['list', 'grid', 'table'], defaults.category_view);
|
115 |
+
result.search_view = getString('search_view', ['list', 'grid', 'table'], defaults.search_view);
|
116 |
+
result.minicart_layout = defaults.minicart_layout;
|
117 |
+
|
118 |
+
$popup.data('block-props').setAttributes(result);
|
119 |
+
|
120 |
+
jQuery('#ecwid-store-popup-content').removeClass('open');
|
121 |
+
});
|
122 |
+
|
123 |
+
updatePreview = function() {
|
124 |
+
jQuery('.store-settings input[type=checkbox]', $popup).each(function(idx, el) {
|
125 |
+
var widget = jQuery(el).parent().attr('data-ecwid-widget');
|
126 |
+
var preview = jQuery('.store-settings-preview svg path.' + widget, $popup);
|
127 |
+
if (jQuery(el).prop('checked')) {
|
128 |
+
jQuery('.store-settings-wrapper').addClass('ecwid-' + widget);
|
129 |
+
} else {
|
130 |
+
jQuery('.store-settings-wrapper').removeClass('ecwid-' + widget);
|
131 |
+
}
|
132 |
+
});
|
133 |
+
}
|
134 |
+
|
135 |
+
jQuery('.store-settings-wrapper label', $popup).hover(
|
136 |
+
function() {
|
137 |
+
jQuery('.store-settings-wrapper').attr('data-ecwid-widget-hover', jQuery(this).attr('data-ecwid-widget'));
|
138 |
+
},
|
139 |
+
function() {
|
140 |
+
jQuery('.store-settings-wrapper').attr('data-ecwid-widget-hover', '');
|
141 |
+
}
|
142 |
+
);
|
143 |
+
|
144 |
+
jQuery('.store-settings input[type=checkbox]', $popup).change(updatePreview);
|
145 |
+
});
|
146 |
+
|
147 |
+
buildParams = function(attributes) {
|
148 |
+
|
149 |
+
if (jQuery.inArray(attributes.category_view, ['grid', 'list', 'table']) == -1) {
|
150 |
+
attributes.category_view = undefined;
|
151 |
+
}
|
152 |
+
|
153 |
+
if (!jQuery.inArray(attributes.search_view, ['grid', 'list', 'table']) == -1) {
|
154 |
+
attributes.search_view = undefined;
|
155 |
+
}
|
156 |
+
|
157 |
+
var defaults = getDefaultParams();
|
158 |
+
|
159 |
+
if (!attributes.grid || attributes.grid.match(/^\d+,\d+$/) === null) {
|
160 |
+
attributes.grid = defaults.grid_columns + ',' + defaults.grid_rows;
|
161 |
+
}
|
162 |
+
|
163 |
+
var grid = attributes.grid.match(/^(\d+),(\d+)/);
|
164 |
+
attributes.grid_rows = grid[1];
|
165 |
+
attributes.grid_columns = grid[2];
|
166 |
+
|
167 |
+
for (var i in {'categories_per_row': defaults.categories_per_row, 'list': defaults.list_rows, 'table': defaults.table_rows, 'grid_rows': defaults.grid_rows, 'grid_columns': defaults.grid_columns, 'default_category_id': 0, 'default_product_id': 0}) {
|
168 |
+
parsed = parseInt(attributes[i]);
|
169 |
+
if (isNaN(parsed) || parsed < 0) {
|
170 |
+
attributes[i] = undefined;
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
var widgets = attributes.widgets;
|
175 |
+
if (typeof widgets == 'undefined') {
|
176 |
+
widgets = "productbrowser search categories minicart";
|
177 |
+
}
|
178 |
+
|
179 |
+
widgets = widgets.split(/[^a-z^A-Z^0-9^-^_]/);
|
180 |
+
|
181 |
+
return {
|
182 |
+
'show_search': jQuery.inArray('search', widgets) != -1,
|
183 |
+
'show_categories': jQuery.inArray('categories', widgets) != -1,
|
184 |
+
'show_minicart': jQuery.inArray('minicart', widgets) != -1,
|
185 |
+
'categories_per_row': attributes.categories_per_row,
|
186 |
+
'category_view': attributes.category_view,
|
187 |
+
'search_view': attributes.search_view,
|
188 |
+
'list_rows': attributes.list,
|
189 |
+
'table_rows': attributes.table,
|
190 |
+
'grid_rows': grid[1],
|
191 |
+
'grid_columns': grid[2],
|
192 |
+
'default_category_id': attributes.default_category_id,
|
193 |
+
'default_product_id': attributes.default_product_id,
|
194 |
+
'minicart_layout': 'attachToCategories'
|
195 |
+
};
|
196 |
+
|
197 |
+
}
|
198 |
+
|
199 |
+
ecwid_open_store_popup = function( props ) {
|
200 |
+
|
201 |
+
$popup.data('block-props', props);
|
202 |
+
var attributes = buildParams(props.attributes);
|
203 |
+
|
204 |
+
params = {};
|
205 |
+
jQuery.extend(params,
|
206 |
+
getDefaultParams(),
|
207 |
+
attributes
|
208 |
+
);
|
209 |
+
|
210 |
+
for (var i in params) {
|
211 |
+
var el = jQuery('[name=' + i + ']', $popup);
|
212 |
+
if (el.attr('type') == 'checkbox') {
|
213 |
+
el.prop('checked', params[i]);
|
214 |
+
} else {
|
215 |
+
el.val(params[i]);
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
// mode determines whether it is a new store or not, and active dialog is the current tab
|
220 |
+
// in other words, mode = [add-store,store-settings] and active dialog is [add-store|store-settings, appearance]
|
221 |
+
// buttons and menu items are for mode, current title and content are for dialog
|
222 |
+
jQuery('.media-modal-content', $popup).attr('data-mode', 'store-settings');
|
223 |
+
jQuery('.media-modal-content', $popup).attr('data-active-dialog', 'store-settings');
|
224 |
+
jQuery('.media-menu-item')
|
225 |
+
.removeClass('active')
|
226 |
+
.filter('[data-content=store-settings]').addClass('active');
|
227 |
+
|
228 |
+
updatePreview();
|
229 |
+
|
230 |
+
$popup.addClass('open');
|
231 |
+
|
232 |
+
return false;
|
233 |
+
};
|
js/store-editor-page.js
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
jQuery(document).ready(function() {
|
2 |
$popup = jQuery('#ecwid-store-popup-content');
|
3 |
|
@@ -261,9 +263,18 @@ jQuery(document).ready(function() {
|
|
261 |
shortcode.shortcode.attrs.named[i] = result[i];
|
262 |
}
|
263 |
|
|
|
|
|
264 |
if (existingShortcode) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
jQuery('#content').val(
|
266 |
-
jQuery('#content').val().replace(
|
267 |
);
|
268 |
if (tinyMCE.activeEditor) {
|
269 |
jQuery(tinymce.activeEditor.getBody()).find('.ecwid-store-editor').attr('data-ecwid-shortcode', shortcode.shortcode.string());
|
@@ -271,7 +282,7 @@ jQuery(document).ready(function() {
|
|
271 |
} else {
|
272 |
|
273 |
if (tinymce.activeEditor && !tinymce.activeEditor.isHidden()) {
|
274 |
-
tinymce.activeEditor.execCommand('mceInsertContent', false,
|
275 |
tinymce.activeEditor.execCommand('mceSetContent', false, tinymce.activeEditor.getBody().innerHTML);
|
276 |
} else {
|
277 |
|
@@ -292,7 +303,7 @@ jQuery(document).ready(function() {
|
|
292 |
var el = jQuery('#content');
|
293 |
var cursorPosition = getCursorPosition(el.get(0));
|
294 |
|
295 |
-
el.val(el.val().substr(0, cursorPosition) +
|
296 |
|
297 |
}
|
298 |
}
|
@@ -301,6 +312,20 @@ jQuery(document).ready(function() {
|
|
301 |
jQuery('#ecwid-store-popup-content').removeClass('open');
|
302 |
});
|
303 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
updatePreview = function() {
|
305 |
jQuery('.store-settings input[type=checkbox]', $popup).each(function(idx, el) {
|
306 |
var widget = jQuery(el).parent().attr('data-ecwid-widget');
|
1 |
+
var createGutenbergedShortcodeString;
|
2 |
+
|
3 |
jQuery(document).ready(function() {
|
4 |
$popup = jQuery('#ecwid-store-popup-content');
|
5 |
|
263 |
shortcode.shortcode.attrs.named[i] = result[i];
|
264 |
}
|
265 |
|
266 |
+
var stringToInsert = createGutenbergedShortcodeString(shortcode.shortcode);
|
267 |
+
|
268 |
if (existingShortcode) {
|
269 |
+
|
270 |
+
stringToReplace = existingShortcode.content;
|
271 |
+
var match = jQuery('#content').val().match(/<!-- wp:ecwid\/store-block([^!]+)!-- \/wp:ecwid\/store-block -->/);
|
272 |
+
if (match && match[1].indexOf(existingShortcode.content) > 0) {
|
273 |
+
stringToReplace = match[0];
|
274 |
+
}
|
275 |
+
|
276 |
jQuery('#content').val(
|
277 |
+
jQuery('#content').val().replace(stringToReplace, stringToInsert)
|
278 |
);
|
279 |
if (tinyMCE.activeEditor) {
|
280 |
jQuery(tinymce.activeEditor.getBody()).find('.ecwid-store-editor').attr('data-ecwid-shortcode', shortcode.shortcode.string());
|
282 |
} else {
|
283 |
|
284 |
if (tinymce.activeEditor && !tinymce.activeEditor.isHidden()) {
|
285 |
+
tinymce.activeEditor.execCommand('mceInsertContent', false, stringToInsert);
|
286 |
tinymce.activeEditor.execCommand('mceSetContent', false, tinymce.activeEditor.getBody().innerHTML);
|
287 |
} else {
|
288 |
|
303 |
var el = jQuery('#content');
|
304 |
var cursorPosition = getCursorPosition(el.get(0));
|
305 |
|
306 |
+
el.val(el.val().substr(0, cursorPosition) + stringToInsert + el.val().substr(cursorPosition));
|
307 |
|
308 |
}
|
309 |
}
|
312 |
jQuery('#ecwid-store-popup-content').removeClass('open');
|
313 |
});
|
314 |
|
315 |
+
createGutenbergedShortcodeString = function( shortcode ) {
|
316 |
+
var result = '<!-- wp:ecwid/store-block ';
|
317 |
+
|
318 |
+
result += JSON.stringify(shortcode.attrs.named);
|
319 |
+
|
320 |
+
result += ' -->';
|
321 |
+
|
322 |
+
result += shortcode.string();
|
323 |
+
|
324 |
+
result += '<!-- /wp:ecwid/store-block -->';
|
325 |
+
|
326 |
+
return result;
|
327 |
+
}
|
328 |
+
|
329 |
updatePreview = function() {
|
330 |
jQuery('.store-settings input[type=checkbox]', $popup).each(function(idx, el) {
|
331 |
var widget = jQuery(el).parent().attr('data-ecwid-widget');
|
languages/ecwid-shopping-cart-ru_RU.mo
CHANGED
Binary file
|
languages/ecwid-shopping-cart-ru_RU.po
CHANGED
@@ -1659,10 +1659,28 @@ msgstr "Новые товары"
|
|
1659 |
msgid "Displays the latest added products from your store. Show new products to returning customers to drive repeat sales."
|
1660 |
msgstr "Список последних добавленных товаров из магазина."
|
1661 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1662 |
#. Plugin Name of the plugin/theme
|
1663 |
msgid "Ecwid Shopping Cart"
|
1664 |
msgstr "Интернет-магазин Эквид"
|
1665 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1666 |
#. #-#-#-#-# ecwid-shopping-cart.pot (Ecwid Shopping Cart 5.2) #-#-#-#-#
|
1667 |
#. Plugin URI of the plugin/theme
|
1668 |
#. #-#-#-#-# ecwid-shopping-cart.pot (Ecwid Shopping Cart 5.2) #-#-#-#-#
|
1659 |
msgid "Displays the latest added products from your store. Show new products to returning customers to drive repeat sales."
|
1660 |
msgstr "Список последних добавленных товаров из магазина."
|
1661 |
|
1662 |
+
msgid "%s Blog"
|
1663 |
+
msgstr "Блог %s"
|
1664 |
+
|
1665 |
+
msgid "Knowledge Base"
|
1666 |
+
msgstr "База знаний"
|
1667 |
+
|
1668 |
+
msgid "https://www.ecwid.com/blog"
|
1669 |
+
msgstr "https://www.ecwid.ru/blog"
|
1670 |
+
|
1671 |
+
msgid "https://support.ecwid.com/hc/en-us"
|
1672 |
+
msgstr "https://support.ecwid.com/hc/ru"
|
1673 |
+
|
1674 |
#. Plugin Name of the plugin/theme
|
1675 |
msgid "Ecwid Shopping Cart"
|
1676 |
msgstr "Интернет-магазин Эквид"
|
1677 |
|
1678 |
+
msgid "%s products and categories"
|
1679 |
+
msgstr "Товары и категории магазина %s"
|
1680 |
+
|
1681 |
+
msgid "Bulk import products and categories to your %s store"
|
1682 |
+
msgstr "Загрузка товаров и категорий в магазин из внешних источников или других e-commerce решений"
|
1683 |
+
|
1684 |
#. #-#-#-#-# ecwid-shopping-cart.pot (Ecwid Shopping Cart 5.2) #-#-#-#-#
|
1685 |
#. Plugin URI of the plugin/theme
|
1686 |
#. #-#-#-#-# ecwid-shopping-cart.pot (Ecwid Shopping Cart 5.2) #-#-#-#-#
|
lib/ecwid_api_v3.php
CHANGED
@@ -10,6 +10,8 @@ class Ecwid_Api_V3
|
|
10 |
const TOKEN_OPTION_NAME = 'ecwid_oauth_token';
|
11 |
|
12 |
const PROFILE_CACHE_NAME = 'apiv3_store_profile';
|
|
|
|
|
13 |
|
14 |
public $store_id = null;
|
15 |
|
@@ -261,13 +263,18 @@ class Ecwid_Api_V3
|
|
261 |
{
|
262 |
$params = array('token');
|
263 |
|
264 |
-
$passthru = array( 'updatedFrom', 'offset', 'limit', 'sortBy', 'keyword' );
|
265 |
|
266 |
foreach ($passthru as $name) {
|
267 |
if ( array_key_exists( $name, $input_params ) ) {
|
268 |
$params[$name] = $input_params[$name];
|
269 |
}
|
270 |
}
|
|
|
|
|
|
|
|
|
|
|
271 |
|
272 |
$result = EcwidPlatform::fetch_url(
|
273 |
$this->build_request_url(
|
@@ -400,16 +407,41 @@ class Ecwid_Api_V3
|
|
400 |
}
|
401 |
|
402 |
$profile = json_decode($result['data']);
|
403 |
-
|
404 |
-
EcwidPlatform::cache_set( self::PROFILE_CACHE_NAME, $profile, 60 * 5 );
|
405 |
|
|
|
|
|
406 |
if ($profile && isset($profile->settings) && isset($profile->settings->hideOutOfStockProductsInStorefront)) {
|
407 |
EcwidPlatform::set('hide_out_of_stock', $profile->settings->hideOutOfStockProductsInStorefront);
|
408 |
}
|
409 |
|
410 |
return $profile;
|
411 |
}
|
412 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
public function create_store()
|
414 |
{
|
415 |
global $current_user;
|
@@ -513,6 +545,132 @@ class Ecwid_Api_V3
|
|
513 |
return $url . '?' . build_query($params);
|
514 |
}
|
515 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
516 |
protected function _maybe_remember_all_products($params, $result, $url)
|
517 |
{
|
518 |
$limiting_params = array(
|
10 |
const TOKEN_OPTION_NAME = 'ecwid_oauth_token';
|
11 |
|
12 |
const PROFILE_CACHE_NAME = 'apiv3_store_profile';
|
13 |
+
|
14 |
+
const FEATURE_NEW_PRODUCT_LIST = 'NEW_PRODUCT_LIST';
|
15 |
|
16 |
public $store_id = null;
|
17 |
|
263 |
{
|
264 |
$params = array('token');
|
265 |
|
266 |
+
$passthru = array( 'updatedFrom', 'offset', 'limit', 'sortBy', 'keyword', 'createdFrom', 'createdTo', 'sku' );
|
267 |
|
268 |
foreach ($passthru as $name) {
|
269 |
if ( array_key_exists( $name, $input_params ) ) {
|
270 |
$params[$name] = $input_params[$name];
|
271 |
}
|
272 |
}
|
273 |
+
|
274 |
+
if ( isset( $params['createdTo'] ) ) {
|
275 |
+
// For some reason createdTo does not include the exact timestamp while createdFrom does
|
276 |
+
$params['createdTo']++;
|
277 |
+
}
|
278 |
|
279 |
$result = EcwidPlatform::fetch_url(
|
280 |
$this->build_request_url(
|
407 |
}
|
408 |
|
409 |
$profile = json_decode($result['data']);
|
|
|
|
|
410 |
|
411 |
+
EcwidPlatform::cache_set( self::PROFILE_CACHE_NAME, $profile, 60 * 5 );
|
412 |
+
|
413 |
if ($profile && isset($profile->settings) && isset($profile->settings->hideOutOfStockProductsInStorefront)) {
|
414 |
EcwidPlatform::set('hide_out_of_stock', $profile->settings->hideOutOfStockProductsInStorefront);
|
415 |
}
|
416 |
|
417 |
return $profile;
|
418 |
}
|
419 |
+
|
420 |
+
public function is_store_feature_enabled( $feature_name ) {
|
421 |
+
|
422 |
+
static $features = array();
|
423 |
+
|
424 |
+
if ( array_key_exists( $feature_name, $features ) ) {
|
425 |
+
return $features[$feature_name]['enabled'];
|
426 |
+
}
|
427 |
+
|
428 |
+
$profile = $this->get_store_profile();
|
429 |
+
|
430 |
+
if (!$profile) {
|
431 |
+
return false;
|
432 |
+
}
|
433 |
+
|
434 |
+
foreach ( $profile->featureToggles as $feature ) {
|
435 |
+
if ( $feature->name == $feature_name ) {
|
436 |
+
$features[$feature_name]['enabled'] = $feature->enabled;
|
437 |
+
|
438 |
+
return $feature->enabled;
|
439 |
+
}
|
440 |
+
}
|
441 |
+
|
442 |
+
return false;
|
443 |
+
}
|
444 |
+
|
445 |
public function create_store()
|
446 |
{
|
447 |
global $current_user;
|
545 |
return $url . '?' . build_query($params);
|
546 |
}
|
547 |
|
548 |
+
public function create_product( $params ) {
|
549 |
+
$request_params = array(
|
550 |
+
'token'
|
551 |
+
);
|
552 |
+
$url = $this->build_request_url( $this->_products_api_url, $request_params );
|
553 |
+
|
554 |
+
$result = $this->_do_post( $url, $params );
|
555 |
+
|
556 |
+
return $result;
|
557 |
+
}
|
558 |
+
|
559 |
+
public function update_product( $params ) {
|
560 |
+
$request_params = array(
|
561 |
+
'token'
|
562 |
+
);
|
563 |
+
|
564 |
+
$id = $params['id'];
|
565 |
+
unset( $params['id'] );
|
566 |
+
|
567 |
+
$url = $this->build_request_url( $this->_products_api_url . '/' . $id, $request_params );
|
568 |
+
|
569 |
+
$result = $this->_do_put( $url, $params );
|
570 |
+
|
571 |
+
return $result;
|
572 |
+
}
|
573 |
+
|
574 |
+
public function create_category( $params ) {
|
575 |
+
$request_params = array(
|
576 |
+
'token'
|
577 |
+
);
|
578 |
+
$url = $this->build_request_url( $this->_categories_api_url, $request_params );
|
579 |
+
|
580 |
+
$result = $this->_do_post( $url, $params );
|
581 |
+
|
582 |
+
return $result;
|
583 |
+
}
|
584 |
+
|
585 |
+
public function delete_products( $ids )
|
586 |
+
{
|
587 |
+
$request_params = array( 'token' );
|
588 |
+
$requests = array();
|
589 |
+
foreach ( $ids as $id ) {
|
590 |
+
$requests[] = array(
|
591 |
+
'type' => Requests::DELETE,
|
592 |
+
'url' => $this->build_request_url( $this->_products_api_url . '/' . $id, $request_params )
|
593 |
+
);
|
594 |
+
}
|
595 |
+
|
596 |
+
$result = Requests::request_multiple( $requests );
|
597 |
+
|
598 |
+
die(var_dump($result));
|
599 |
+
|
600 |
+
return $result;
|
601 |
+
}
|
602 |
+
|
603 |
+
public function upload_category_image( $params )
|
604 |
+
{
|
605 |
+
$request_params = array(
|
606 |
+
'token'
|
607 |
+
);
|
608 |
+
$url = $this->build_request_url( $this->_categories_api_url . '/' . $params['categoryId'] . '/image', $request_params );
|
609 |
+
|
610 |
+
$result = $this->_do_post( $url, $params['data'], true );
|
611 |
+
|
612 |
+
return $result;
|
613 |
+
}
|
614 |
+
|
615 |
+
public function upload_product_image( $params )
|
616 |
+
{
|
617 |
+
$request_params = array(
|
618 |
+
'token'
|
619 |
+
);
|
620 |
+
$url = $this->build_request_url( $this->_products_api_url . '/' . $params['productId'] . '/image', $request_params );
|
621 |
+
|
622 |
+
$result = $this->_do_post( $url, $params['data'], true );
|
623 |
+
|
624 |
+
return $result;
|
625 |
+
}
|
626 |
+
|
627 |
+
protected function _do_post( $url, $data, $raw = false ) {
|
628 |
+
$result = wp_remote_post( $url,
|
629 |
+
array(
|
630 |
+
'body' => $raw ? $data : json_encode( $data ),
|
631 |
+
'timeout' => 20,
|
632 |
+
'headers' => array(
|
633 |
+
'Content-Type' => 'application/json;charset="utf-8"'
|
634 |
+
)
|
635 |
+
)
|
636 |
+
);
|
637 |
+
|
638 |
+
if ( is_array( $result ) ) {
|
639 |
+
$result['api_message'] = $this->_get_response_message_from_wp_remote_results( $result );
|
640 |
+
}
|
641 |
+
|
642 |
+
return $result;
|
643 |
+
}
|
644 |
+
|
645 |
+
protected function _do_put( $url, $data, $raw = false ) {
|
646 |
+
$result = wp_remote_post( $url,
|
647 |
+
array(
|
648 |
+
'body' => $raw ? $data : json_encode( $data ),
|
649 |
+
'timeout' => 20,
|
650 |
+
'headers' => array(
|
651 |
+
'Content-Type' => 'application/json;charset="utf-8"'
|
652 |
+
),
|
653 |
+
'method' => 'PUT'
|
654 |
+
)
|
655 |
+
);
|
656 |
+
|
657 |
+
if ( is_array( $result ) ) {
|
658 |
+
$result['api_message'] = $this->_get_response_message_from_wp_remote_results( $result );
|
659 |
+
}
|
660 |
+
|
661 |
+
return $result;
|
662 |
+
}
|
663 |
+
|
664 |
+
protected function _get_response_message_from_wp_remote_results( $result ) {
|
665 |
+
$raw = $result['http_response']->get_response_object()->raw;
|
666 |
+
$pattern = '!HTTP/1.1 [0-9][0-9][0-9] (.*)!';
|
667 |
+
if ( preg_match( $pattern, $raw, $matches ) ) {
|
668 |
+
return substr( $matches[1], 0, strlen($matches[1] ) - 1 );
|
669 |
+
}
|
670 |
+
|
671 |
+
return null;
|
672 |
+
}
|
673 |
+
|
674 |
protected function _maybe_remember_all_products($params, $result, $url)
|
675 |
{
|
676 |
$limiting_params = array(
|
lib/ecwid_platform.php
CHANGED
@@ -24,6 +24,79 @@ class EcwidPlatform {
|
|
24 |
}
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
static protected function _init_crypt()
|
28 |
{
|
29 |
self::$crypt->setIV( substr( md5( SECURE_AUTH_SALT . get_option('ecwid_store_id') ), 0, 16 ) );
|
24 |
}
|
25 |
}
|
26 |
|
27 |
+
/*
|
28 |
+
* @throws InvalidArgumentException if $file can't be slugified at all
|
29 |
+
*/
|
30 |
+
static public function enqueue_script( $file, $deps = array(), $in_footer = false, $handle = false ) {
|
31 |
+
|
32 |
+
$filename = $file;
|
33 |
+
|
34 |
+
if ( strpos( $file, '.js' ) == strlen( $file ) - 3 ) {
|
35 |
+
$filename = substr( $filename, 0, strlen( $file ) - 3 );
|
36 |
+
}
|
37 |
+
|
38 |
+
if ( !$handle ) {
|
39 |
+
$handle = self::slugify( $filename );
|
40 |
+
}
|
41 |
+
|
42 |
+
$handle = 'ecwid-' . $handle;
|
43 |
+
|
44 |
+
$file .= '.js';
|
45 |
+
|
46 |
+
if ( defined( 'WP_DEBUG' ) ) {
|
47 |
+
$path = ECWID_PLUGIN_DIR . 'js/' . $file;
|
48 |
+
|
49 |
+
$ver = filemtime( $path );
|
50 |
+
} else {
|
51 |
+
$ver = get_option( 'ecwid_plugin_version' );
|
52 |
+
}
|
53 |
+
|
54 |
+
wp_enqueue_script( $handle, ECWID_PLUGIN_URL . 'js/' . $file, $deps, $ver, $in_footer );
|
55 |
+
}
|
56 |
+
|
57 |
+
/*
|
58 |
+
* @throws InvalidArgumentException if $file can't be slugified at all
|
59 |
+
*/
|
60 |
+
static public function enqueue_style( $file, $deps = array(), $handle = false ) {
|
61 |
+
|
62 |
+
$filename = $file;
|
63 |
+
|
64 |
+
if ( strpos( $file, '.css' ) == strlen( $file ) - 4 ) {
|
65 |
+
$filename = substr( $filename, 0, strlen( $file ) - 4 );
|
66 |
+
}
|
67 |
+
|
68 |
+
if ( !$handle ) {
|
69 |
+
$handle = self::slugify( $filename );
|
70 |
+
}
|
71 |
+
|
72 |
+
$handle = 'ecwid-' . $handle;
|
73 |
+
|
74 |
+
$file = $filename . '.css';
|
75 |
+
|
76 |
+
if ( defined( 'WP_DEBUG' ) ) {
|
77 |
+
$path = ECWID_PLUGIN_DIR . 'css/' . $file;
|
78 |
+
|
79 |
+
$ver = filemtime( $path );
|
80 |
+
} else {
|
81 |
+
$ver = get_option( 'ecwid_plugin_version' );
|
82 |
+
}
|
83 |
+
|
84 |
+
wp_enqueue_style( $handle, ECWID_PLUGIN_URL . 'css/' . $file, $deps, $ver );
|
85 |
+
}
|
86 |
+
|
87 |
+
|
88 |
+
static public function slugify( $string ) {
|
89 |
+
$match = array();
|
90 |
+
$result = preg_match_all( '#[\p{L}0-9\-_]+#u', strtolower( $string ), $match );
|
91 |
+
|
92 |
+
if ( $result && count( @$match[0] ) > 0 ) {
|
93 |
+
$handle = implode('-', $match[0] );
|
94 |
+
} else {
|
95 |
+
throw new InvalidArgumentException( 'Can\'t make slug from ' . $file );
|
96 |
+
}
|
97 |
+
return $handle;
|
98 |
+
}
|
99 |
+
|
100 |
static protected function _init_crypt()
|
101 |
{
|
102 |
self::$crypt->setIV( substr( md5( SECURE_AUTH_SALT . get_option('ecwid_store_id') ), 0, 16 ) );
|
lib/html-catalog-templates/category.php
CHANGED
@@ -26,7 +26,7 @@
|
|
26 |
</a>
|
27 |
</span>
|
28 |
<span class="product-price">
|
29 |
-
<?php echo $product->
|
30 |
</span>
|
31 |
</div>
|
32 |
|
26 |
</a>
|
27 |
</span>
|
28 |
<span class="product-price">
|
29 |
+
<?php echo $product->defaultDisplayedPrice . ' ' . $formats->currency; ?>
|
30 |
</span>
|
31 |
</div>
|
32 |
|
lib/html-catalog-templates/product.php
CHANGED
@@ -6,9 +6,9 @@
|
|
6 |
<img itemprop="image" src="<?php echo EcwidPlatform::esc_attr( $product->originalImageUrl ); ?>" alt="<?php echo EcwidPlatform::esc_attr( $product->name . ' ' . $product->sku); ?>" />
|
7 |
<div itemprop="description"><?php echo isset( $product->seoDescription )&& !empty( $product->seoDescription ) ? $product->seoDescription : $product->description; ?></div>
|
8 |
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
|
9 |
-
<span itemprop="price" content="<?php echo EcwidPlatform::esc_html( $product->
|
10 |
echo EcwidPlatform::esc_html(
|
11 |
-
$formats->currencyPrefix . $product->
|
12 |
);
|
13 |
?></span>
|
14 |
<span itemprop="priceCurrency" content="<?php echo EcwidPlatform::esc_attr( $formats->currency ); ?>"></span>
|
6 |
<img itemprop="image" src="<?php echo EcwidPlatform::esc_attr( $product->originalImageUrl ); ?>" alt="<?php echo EcwidPlatform::esc_attr( $product->name . ' ' . $product->sku); ?>" />
|
7 |
<div itemprop="description"><?php echo isset( $product->seoDescription )&& !empty( $product->seoDescription ) ? $product->seoDescription : $product->description; ?></div>
|
8 |
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
|
9 |
+
<span itemprop="price" content="<?php echo EcwidPlatform::esc_html( $product->defaultDisplayedPrice ); ?>"><?php
|
10 |
echo EcwidPlatform::esc_html(
|
11 |
+
$formats->currencyPrefix . $product->defaultDisplayedPrice . $formats->currencySuffix
|
12 |
);
|
13 |
?></span>
|
14 |
<span itemprop="priceCurrency" content="<?php echo EcwidPlatform::esc_attr( $formats->currency ); ?>"></span>
|
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:
|
7 |
|
8 |
Powerful, easy to use ecommerce shopping cart. Bank level PCI DSS Level 1 security. iPhone & Android apps. Superb support. Free plan available.
|
9 |
|
@@ -149,6 +149,14 @@ You can use Ecwid’s built-in import tools to copy your store products from any
|
|
149 |
* [Ecwid eCommerce Forums](https://www.ecwid.com/forums/forumdisplay.php?f=19)
|
150 |
|
151 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
= 5.8.2 - Mar 9, 2018 =
|
153 |
- **Fixed an issue with the categories menu appeared in the version 5.8.1.**
|
154 |
|
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.0
|
7 |
|
8 |
Powerful, easy to use ecommerce shopping cart. Bank level PCI DSS Level 1 security. iPhone & Android apps. Superb support. Free plan available.
|
9 |
|
149 |
* [Ecwid eCommerce Forums](https://www.ecwid.com/forums/forumdisplay.php?f=19)
|
150 |
|
151 |
== Changelog ==
|
152 |
+
= 6.0 - Apr 11, 2018 =
|
153 |
+
- **Compatibility with Gutenberg.** Gutenberg editor is getting more and more popular and will soon be the default WordPress editor. To make sure Ecwid users are ready for that, we added Gutenberg support to our plugin. Now when you edit a page in Gutenberg, you will see a new "Ecwid online store" block in the editor toolbar — this can be used to add a store to a page. In future updates, we will add ability to add a product widget (or a buy now button) to a post or page in Gutenberg.
|
154 |
+
- **New product import tools.** Some sellers copy their products to Ecwid e-commerce plugin from WooCommerce, other shopping carts or local database or spreadsheet. We made it easier to do that in Ecwid. You can now see a separate Ecwid block under Tools -> Import in the WordPress admin backend. That block allows you to import products and categories to your store from WooCommerce or external CSV file.
|
155 |
+
- **New WordPress admin dashboard widget: help/educational materials for sellers.** We added a new Ecwid block to the WordPress admin dashboard — it features useful posts from the Ecwid ecommerce blog. The block refreshes itself automatically when we publish a new blog post. Check it to find fresh product updates and tips and recommendations from the Ecwid team on how to better set up your store and sell more.
|
156 |
+
- **Revamped Ecwid menu in WordPress admin backend.** This is step #2 of the menu changes implemented in the version 5.8. Historically, the Ecwid store management dashboard displayed navigation within the central page content when you open it in your WordPress admin backend. So, you open the “Ecwid” menu in your WP admin and then navigate through your store admin pages inside that general “Ecwid” page. We’re improving this process: now the store admin navigation menu will be a part of the WordPress admin menu. So now you will find management/settings/apps and other sections right in the WordPress left-hand navigation sidebar. This will align the Ecwid plugin navigation with the general WordPress navigation and provide more natural way to find the right page of your store dashboard. Also, this will free some space in the page central area to make it more convenient to manage your store, especially on mobile devices.
|
157 |
+
- Minor fixes and improvements.
|
158 |
+
|
159 |
+
|
160 |
= 5.8.2 - Mar 9, 2018 =
|
161 |
- **Fixed an issue with the categories menu appeared in the version 5.8.1.**
|
162 |
|
templates/admin-message.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
<div class="ecwid-message <?php echo esc_attr($type); ?>">
|
2 |
-
<?php if ($title): ?>
|
3 |
<div class="ecwid-message-title">
|
4 |
-
<?php echo esc_html($title); ?>
|
5 |
</div>
|
6 |
<?php endif; ?>
|
7 |
|
@@ -9,43 +9,44 @@
|
|
9 |
<?php echo $message; ?>
|
10 |
</div>
|
11 |
|
12 |
-
<?php if ($primary_button || $secondary_button || $do_not_show_again): ?>
|
13 |
<div class="ecwid-message-buttons">
|
14 |
<?php if ($primary_button): ?>
|
15 |
<div>
|
16 |
<a
|
17 |
class="button button-primary"
|
18 |
-
href="<?php echo esc_attr($primary_url); ?>"
|
19 |
-
<?php if ($primary_blank): ?>
|
20 |
target="_blank"
|
21 |
<?php endif; ?>
|
22 |
>
|
23 |
-
<?php echo esc_html($primary_title); ?>
|
24 |
</a>
|
25 |
</div>
|
26 |
<?php endif; ?>
|
27 |
|
28 |
-
<?php if ($secondary_button): ?>
|
29 |
<div>
|
30 |
<a
|
31 |
-
class="button"
|
32 |
-
href="<?php echo esc_attr($secondary_url); ?>"
|
33 |
-
<?php if ($secondary_blank): ?>
|
34 |
target="_blank"
|
35 |
<?php endif; ?>
|
36 |
>
|
37 |
-
<?php echo esc_html($secondary_title); ?>
|
38 |
</a>
|
39 |
</div>
|
40 |
<?php endif; ?>
|
41 |
|
42 |
-
|
43 |
-
|
|
|
44 |
<a class="ecwid-message-hide" name="<?php echo $name; ?>" href="javascript: void(0);">
|
45 |
<?php _e('Never show this message again', 'ecwid-shopping-cart'); ?>
|
46 |
</a>
|
47 |
-
</div>
|
48 |
<?php endif; ?>
|
|
|
49 |
</div>
|
50 |
<?php endif; ?>
|
51 |
</div>
|
1 |
+
<div class="ecwid-message <?php echo esc_attr( $type ); ?>">
|
2 |
+
<?php if ( $title ): ?>
|
3 |
<div class="ecwid-message-title">
|
4 |
+
<?php echo esc_html( $title ); ?>
|
5 |
</div>
|
6 |
<?php endif; ?>
|
7 |
|
9 |
<?php echo $message; ?>
|
10 |
</div>
|
11 |
|
12 |
+
<?php if ( $primary_button || $secondary_button || $do_not_show_again ): ?>
|
13 |
<div class="ecwid-message-buttons">
|
14 |
<?php if ($primary_button): ?>
|
15 |
<div>
|
16 |
<a
|
17 |
class="button button-primary"
|
18 |
+
href="<?php echo esc_attr( $primary_url ); ?>"
|
19 |
+
<?php if ( $primary_blank ): ?>
|
20 |
target="_blank"
|
21 |
<?php endif; ?>
|
22 |
>
|
23 |
+
<?php echo esc_html( $primary_title ); ?>
|
24 |
</a>
|
25 |
</div>
|
26 |
<?php endif; ?>
|
27 |
|
28 |
+
<?php if ( $secondary_button ): ?>
|
29 |
<div>
|
30 |
<a
|
31 |
+
class="button<?php if ( $secondary_hide ): ?> ecwid-message-hide<? endif; ?>"
|
32 |
+
href="<?php echo esc_attr( $secondary_url ); ?>"
|
33 |
+
<?php if ( $secondary_blank ): ?>
|
34 |
target="_blank"
|
35 |
<?php endif; ?>
|
36 |
>
|
37 |
+
<?php echo esc_html( $secondary_title ); ?>
|
38 |
</a>
|
39 |
</div>
|
40 |
<?php endif; ?>
|
41 |
|
42 |
+
<div class="hide-wrapper">
|
43 |
+
<?php if ( $do_not_show_again ): ?>
|
44 |
+
|
45 |
<a class="ecwid-message-hide" name="<?php echo $name; ?>" href="javascript: void(0);">
|
46 |
<?php _e('Never show this message again', 'ecwid-shopping-cart'); ?>
|
47 |
</a>
|
|
|
48 |
<?php endif; ?>
|
49 |
+
</div>
|
50 |
</div>
|
51 |
<?php endif; ?>
|
52 |
</div>
|
templates/advanced-settings.php
CHANGED
@@ -71,7 +71,7 @@
|
|
71 |
<div class="upgrade-note">
|
72 |
<a
|
73 |
class="button ecwid-button button-green" target="_blank"
|
74 |
-
href="<?php echo Ecwid_Admin::get_dashboard_url(); ?>&
|
75 |
<?php _e( 'Upgrade to get this feature', 'ecwid-shopping-cart' ); ?>
|
76 |
</a>
|
77 |
<div class="note grayed-links">
|
71 |
<div class="upgrade-note">
|
72 |
<a
|
73 |
class="button ecwid-button button-green" target="_blank"
|
74 |
+
href="<?php echo Ecwid_Admin::get_dashboard_url(); ?>&ec-page=<?php echo urlencode(ecwid_get_admin_iframe_upgrade_page()); ?>">
|
75 |
<?php _e( 'Upgrade to get this feature', 'ecwid-shopping-cart' ); ?>
|
76 |
</a>
|
77 |
<div class="note grayed-links">
|
templates/dashboard-blog-posts.tpl.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="template-container">
|
2 |
+
<div class="ecwid-blog-post">
|
3 |
+
<div class="ecwid-blog-post-image-container">
|
4 |
+
<a class="ecwid-blog-post-link" target="_blank"><div class="ecwid-blog-post-image"></div></a>
|
5 |
+
</div>
|
6 |
+
<div class="ecwid-blog-post-text-container">
|
7 |
+
<a class="ecwid-blog-post-title ecwid-blog-post-link" target="_blank"></a>
|
8 |
+
<p class="ecwid-blog-post-excerpt"></p>
|
9 |
+
</div>
|
10 |
+
</div>
|
11 |
+
</div>
|
12 |
+
<div class="ecwid-blog-posts"></div>
|
13 |
+
<div class="ecwid-blog-footer">
|
14 |
+
<a href="<?php _e( 'https://www.ecwid.com/blog', 'ecwid-shopping-cart' ); ?>">
|
15 |
+
<?php echo sprintf( __( '%s Blog', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand() ); ?>
|
16 |
+
<span aria-hidden="true" class="dashicons dashicons-external"></span>
|
17 |
+
</a>
|
18 |
+
|
|
19 |
+
<a href="<?php _e( 'https://support.ecwid.com/hc/en-us', 'ecwid-shopping-cart' ); ?>">
|
20 |
+
<?php echo _e( 'Knowledge Base', 'ecwid-shopping-cart' ); ?>
|
21 |
+
<span aria-hidden="true" class="dashicons dashicons-external"></span>
|
22 |
+
</a>
|
23 |
+
</div>
|
templates/ecwid-admin.php
CHANGED
@@ -30,12 +30,19 @@
|
|
30 |
jQuery('li[data-ecwid-dynamic-menu]').remove();
|
31 |
ecwidAddMenuItems(jQuery.parseJSON(result));
|
32 |
ecwidRefreshEcwidMenuItemSelection();
|
|
|
|
|
|
|
33 |
}
|
34 |
});
|
35 |
|
36 |
|
37 |
//ecwidUpdateAdminMenus(e.data.data.navigationMenuItems);
|
38 |
}
|
|
|
|
|
|
|
|
|
39 |
},false);
|
40 |
|
41 |
$('#ecwid-frame').attr('src', '<?php echo $iframe_src; ?>');
|
@@ -89,4 +96,4 @@
|
|
89 |
);
|
90 |
});
|
91 |
</script>
|
92 |
-
<?php require_once ECWID_PLUGIN_DIR . 'templates/admin-footer.php'; ?>
|
30 |
jQuery('li[data-ecwid-dynamic-menu]').remove();
|
31 |
ecwidAddMenuItems(jQuery.parseJSON(result));
|
32 |
ecwidRefreshEcwidMenuItemSelection();
|
33 |
+
if (typeof wpResponsive == 'object' && wpResponsive.activate) {
|
34 |
+
wpResponsive.trigger(); // prevent 'sticky-menu' from being applied incorrectly
|
35 |
+
}
|
36 |
}
|
37 |
});
|
38 |
|
39 |
|
40 |
//ecwidUpdateAdminMenus(e.data.data.navigationMenuItems);
|
41 |
}
|
42 |
+
|
43 |
+
if (typeof wpResponsive == 'object' && wpResponsive.trigger) {
|
44 |
+
wpResponsive.trigger(); // prevent 'sticky-menu' from being applied incorrectly
|
45 |
+
}
|
46 |
},false);
|
47 |
|
48 |
$('#ecwid-frame').attr('src', '<?php echo $iframe_src; ?>');
|
96 |
);
|
97 |
});
|
98 |
</script>
|
99 |
+
<?php require_once ECWID_PLUGIN_DIR . 'templates/admin-footer.php'; ?>
|
templates/importer/import-no-token.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<a class="button button-primary" href="<?php echo $this->_get_reconnect_url(); ?>"><?php _e( 'Connect', 'ecwid-shopping-cart' ); ?></a>
|
templates/importer/landing.tpl.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap"><h1><?php _e( 'Import products to your Ecwid store', 'ecwid-shopping-cart' ); ?></h1>
|
2 |
+
|
3 |
+
<p>
|
4 |
+
<?php _e( 'Here, we will help you uploading your product catalog to Ecwid from another shopping cart or other sources.', 'ecwid-shopping-cart' ); ?>
|
5 |
+
</p>
|
6 |
+
|
7 |
+
<?php if ( $this->_need_to_show_woo() ): ?>
|
8 |
+
<div class="card">
|
9 |
+
<h2><?php _e( 'Import product catalog from WooCommerce', 'ecwid-shopping-cart' ); ?></h2>
|
10 |
+
|
11 |
+
<p>
|
12 |
+
<?php printf(__(
|
13 |
+
'We found you have a WooCommerce installed. Your WooCommerce store has %1$s products and %2$s categories. Would you like to import them to Ecwid?',
|
14 |
+
'ecwid-shopping-cart'
|
15 |
+
),
|
16 |
+
Ecwid_Importer::count_woo_products(), Ecwid_Importer::count_woo_categories()
|
17 |
+
); ?>
|
18 |
+
</p>
|
19 |
+
<a href="admin.php?page=<?php echo self::PAGE_SLUG_WOO; ?>">
|
20 |
+
<?php _e( 'Import your WooCommerce products to Ecwid', 'ecwid-shopping-cart' ); ?>
|
21 |
+
</a>
|
22 |
+
|
23 |
+
<p><?php _e('(You will be able to confirm the changes before the actual import)', 'ecwid-shopping-cart' ); ?></p>
|
24 |
+
</div>
|
25 |
+
<?php endif; ?>
|
26 |
+
|
27 |
+
<div class="card">
|
28 |
+
<h2><?php _e( 'Import product catalog from other sources', 'ecwid-shopping-cart' ); ?></h2>
|
29 |
+
|
30 |
+
<p><?php _e( 'Ecwid allows you to upload your products in a form of CSV file. Learn more about this tool in the Ecwid Help Center', 'ecwid-shopping-cart'); ?></p>
|
31 |
+
<p>
|
32 |
+
<a href="<? _e( 'https://support.ecwid.com/hc/en-us/articles/208079105-Importing-products', 'ecwid-shopping-cart' ); ?>"><?php _e( 'Learn more', 'ecwid-shopping-cart' ); ?></a>
|
33 |
+
</p>
|
34 |
+
</div>
|
35 |
+
|
36 |
+
</div>
|
templates/importer/woo-complete.tpl.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2><?php _e( 'Import complete.', 'ecwid-shopping-cart' ); ?></h2>
|
2 |
+
|
3 |
+
<p class="plan-limit-message">
|
4 |
+
<?php echo sprintf( __ ( 'Not all products have been copied to %1$s because you reached the product count limit on your pricing plan in %1$s. If you want to import more products, please consider <a %2$s>upgrading your %1$s plan</a>.', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand(), 'href="' . $this->_get_billing_page_url() .'"' ); ?>
|
5 |
+
</p>
|
6 |
+
|
7 |
+
<ul>
|
8 |
+
<li>
|
9 |
+
<?php echo sprintf( __( 'Imported products: %s', 'ecwid-shopping-cart' ), '<span id="import-results-products"></span>' ); ?>
|
10 |
+
</li>
|
11 |
+
<li>
|
12 |
+
<?php echo sprintf( __( 'Imported categories: %s', 'ecwid-shopping-cart' ), '<span id="import-results-categories"></span>' ); ?>
|
13 |
+
</li>
|
14 |
+
</ul>
|
15 |
+
|
16 |
+
<p>
|
17 |
+
<a class="button button-primary" href="admin.php?page=<?php echo Ecwid_Admin::ADMIN_SLUG; ?>-admin-products">
|
18 |
+
<?php echo sprintf( __('Go to your %s Products', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand() ); ?>
|
19 |
+
</a>
|
20 |
+
</p>
|
21 |
+
|
22 |
+
<div class="errors">
|
23 |
+
<?php _e( 'Some of the products 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-in-progress.tpl.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="progress-indicator">
|
2 |
+
<div class="icon">
|
3 |
+
<?php ecwid_embed_svg('update'); ?>
|
4 |
+
</div>
|
5 |
+
<div class="inline-note">
|
6 |
+
<?php _e( 'copying products and categories', 'ecwid-shopping-cart' ); ?>
|
7 |
+
</div>
|
8 |
+
</div>
|
9 |
+
<div class="progress-message">
|
10 |
+
<?php echo sprintf(
|
11 |
+
__( 'Importing %s of %s items', 'ecwid-shopping-cart' ),
|
12 |
+
'<span id="import-progress-current">0</span>',
|
13 |
+
'<span id="import-progress-total">' . (Ecwid_Importer::count_woo_products() + Ecwid_Importer::count_woo_categories()) . '</span>' );
|
14 |
+
?>
|
15 |
+
</div>
|
templates/importer/woo-initial.tpl.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<button class="button button-primary" id="ecwid-importer-woo-go"><?php _e( 'Import', 'ecwid-shopping-cart' ); ?></button>
|
templates/importer/woo-main.tpl.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap ecwid-importer state-<?php echo $this->_is_token_ok() ? 'woo-initial' : 'no-token'; ?>">
|
2 |
+
<h1><?php echo sprintf( __( 'Import your products from WooCommerce to %s', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand() ); ?></h1>
|
3 |
+
|
4 |
+
<p><?php echo sprintf( __( 'This import will copy your WooCommerce products and categories to your %s store.', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand() ); ?></p>
|
5 |
+
|
6 |
+
<p><?php echo sprintf( __( '<b>Important note:</b> import creates new products. please mind the maximum number of products and categories you can add to your store. This import tool will automatically stop when you reach the limit. To learn the current store limit or increase it, please see the "<a %s>Billing & Plans</a>" page in your store control panel. ', 'ecwid-shopping-cart' ), 'href="admin.php?page=ec-store-admin-billing"' ); ?></p>
|
7 |
+
|
8 |
+
<h2><?php _e( 'Import summary.', 'ecwid-shopping-cart' ); ?></h2>
|
9 |
+
<p>
|
10 |
+
<?php
|
11 |
+
echo sprintf(
|
12 |
+
__( 'Your WooCommerce store has %s products and %s categories', 'ecwid-shopping-cart' ),
|
13 |
+
Ecwid_Importer::count_woo_products(),
|
14 |
+
Ecwid_Importer::count_woo_categories()
|
15 |
+
);
|
16 |
+
?>
|
17 |
+
</p>
|
18 |
+
<p>
|
19 |
+
<?php
|
20 |
+
echo sprintf(
|
21 |
+
__( 'Your %s store has %s products and %s categories', 'ecwid-shopping-cart' ),
|
22 |
+
Ecwid_Config::get_brand(),
|
23 |
+
Ecwid_Importer::count_ecwid_products(),
|
24 |
+
Ecwid_Importer::count_ecwid_categories()
|
25 |
+
);
|
26 |
+
?>
|
27 |
+
</p>
|
28 |
+
<p>
|
29 |
+
<?php
|
30 |
+
echo sprintf(
|
31 |
+
__( 'After import, your %s store will have %s products and %s categories', 'ecwid-shopping-cart' ),
|
32 |
+
Ecwid_Config::get_brand(),
|
33 |
+
Ecwid_Importer::count_ecwid_products() + Ecwid_Importer::count_woo_products(),
|
34 |
+
Ecwid_Importer::count_ecwid_categories() + Ecwid_Importer::count_woo_categories()
|
35 |
+
);
|
36 |
+
?>
|
37 |
+
</p>
|
38 |
+
|
39 |
+
<h2><?php _e( 'Import settings.', 'ecwid-shopping-cart' ); ?></h2>
|
40 |
+
<?php if ( Ecwid_Import::allow_delete_demo_products() && Ecwid_Importer::count_ecwid_demo_products() < Ecwid_Importer::count_ecwid_products() ): ?>
|
41 |
+
<p>
|
42 |
+
<label><input type="checkbox" class="import-settings" name="<?php echo Ecwid_Importer::SETTING_DELETE_DEMO; ?>"><?php _e( 'Remove demo products', 'ecwid-shopping-cart' ); ?></label>
|
43 |
+
</p>
|
44 |
+
<?php endif; ?>
|
45 |
+
<p>
|
46 |
+
<label><input type="checkbox" class="import-settings" name="<?php echo Ecwid_Importer::SETTING_UPDATE_BY_SKU; ?>"><?php _e( 'Overwrite existing products with matching SKU', 'ecwid-shopping-cart' ); ?></label>
|
47 |
+
</p>
|
48 |
+
|
49 |
+
<div class="importer-state importer-state-woo-initial">
|
50 |
+
<?php require __DIR__ . '/woo-initial.tpl.php'; ?>
|
51 |
+
</div>
|
52 |
+
|
53 |
+
<div class="importer-state importer-state-no-token">
|
54 |
+
<?php require __DIR__ . '/import-no-token.php'; ?>
|
55 |
+
</div>
|
56 |
+
|
57 |
+
<div class="importer-state importer-state-woo-in-progress">
|
58 |
+
<?php require __DIR__ . '/woo-in-progress.tpl.php'; ?>
|
59 |
+
</div>
|
60 |
+
|
61 |
+
<div class="importer-state importer-state-woo-complete">
|
62 |
+
<?php require __DIR__ . '/woo-complete.tpl.php'; ?>
|
63 |
+
</div>
|
64 |
+
</div>
|
templates/store-popup.php
CHANGED
@@ -5,71 +5,71 @@
|
|
5 |
<div class="media-modal wp-core-ui">
|
6 |
<div class="media-modal-content">
|
7 |
<a class="media-modal-close" href="#" title="Close"><span class="media-modal-icon"></span></a>
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
</div>
|
17 |
-
|
18 |
|
19 |
-
|
20 |
-
|
21 |
<?php _e('Add Store', 'ecwid-shopping-cart'); ?><span class="dashicons dashicons-arrow-down"></span>
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
<?php _e('Store elements', 'ecwid-shopping-cart'); ?><span class="dashicons dashicons-arrow-down"></span>
|
28 |
-
|
29 |
-
|
30 |
|
31 |
<?php if (ecwid_is_legacy_appearance_used()): ?>
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
|
39 |
-
|
40 |
|
41 |
-
|
42 |
-
|
43 |
<?php ecwid_embed_svg('add-store'); ?>
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
<?php _e('Show search', 'ecwid-shopping-cart'); ?>
|
57 |
-
|
58 |
-
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
<?php _e('Show minicart', 'ecwid-shopping-cart'); ?>
|
64 |
-
|
65 |
-
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
<?php _e('Show categories', 'ecwid-shopping-cart'); ?>
|
71 |
-
|
72 |
-
|
73 |
|
74 |
<div class="note">
|
75 |
<?php echo sprintf(
|
@@ -91,7 +91,7 @@
|
|
91 |
|
92 |
<select name="default_category_id" id="ecwid_default_category_id">
|
93 |
<option value="0"<?php if (!get_option('ecwid_default_category_id')): ?> selected="selected"<?php endif; ?>>
|
94 |
-
|
95 |
</option>
|
96 |
<?php foreach ($categories as $category): ?>
|
97 |
<option
|
@@ -108,153 +108,152 @@
|
|
108 |
|
109 |
<?php endif; ?>
|
110 |
</div>
|
111 |
-
|
112 |
</div>
|
113 |
-
|
114 |
|
115 |
<?php if (ecwid_is_legacy_appearance_used()): ?>
|
116 |
-
|
117 |
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
|
163 |
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
|
183 |
-
|
184 |
-
|
185 |
-
<div class="pure-control-group params-list">
|
186 |
-
<label for="ecwid_pb_categoriesperrow">
|
187 |
-
<?php _e('Number of categories per row', 'ecwid-shopping-cart'); ?>
|
188 |
-
</label>
|
189 |
-
<input
|
190 |
-
id="ecwid_pb_categoriesperrow"
|
191 |
-
name="categories_per_row"
|
192 |
-
type="text"
|
193 |
-
class="number"
|
194 |
-
value="<?php echo esc_attr(get_option('ecwid_pb_categoriesperrow')); ?>"
|
195 |
-
/>
|
196 |
-
</div>
|
197 |
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
<?php _e('Table', 'ecwid-shopping-cart'); ?>
|
211 |
-
</option>
|
212 |
-
</select>
|
213 |
-
</div>
|
214 |
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
<option value="list" <?php if(get_option('ecwid_pb_searchview') == 'list') echo 'selected="selected"' ?> >
|
225 |
-
<?php _e('List', 'ecwid-shopping-cart'); ?>
|
226 |
-
</option>
|
227 |
-
<option value="table" <?php if(get_option('ecwid_pb_searchview') == 'table') echo 'selected="selected"' ?> >
|
228 |
-
<?php _e('Table', 'ecwid-shopping-cart'); ?>
|
229 |
-
</option>
|
230 |
-
</select>
|
231 |
-
</div>
|
232 |
-
</div>
|
233 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
<?php endif; ?>
|
235 |
|
236 |
<div class="media-frame-toolbar">
|
237 |
<div class="media-toolbar">
|
238 |
<div class="media-toolbar-secondary">
|
239 |
-
<?php if (
|
240 |
<div class="store-id"><?php _e('Store ID', 'ecwid-shopping-cart'); ?>: <?php echo esc_attr(get_ecwid_store_id()); ?></div>
|
241 |
<?php else: ?>
|
242 |
-
|
243 |
<?php endif; ?>
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
</div>
|
258 |
</div>
|
259 |
<div class="media-modal-backdrop"></div>
|
260 |
</div>
|
5 |
<div class="media-modal wp-core-ui">
|
6 |
<div class="media-modal-content">
|
7 |
<a class="media-modal-close" href="#" title="Close"><span class="media-modal-icon"></span></a>
|
8 |
+
<div class="media-frame wp-core-ui hide-router">
|
9 |
+
<div class="media-frame-menu">
|
10 |
+
<div class="media-menu">
|
11 |
+
<a href="#" class="media-menu-item" data-content="add-store"><?php _e('Add Store', 'ecwid-shopping-cart'); ?></a>
|
12 |
+
<a href="#" class="media-menu-item" data-content="store-settings"><?php _e('Store elements', 'ecwid-shopping-cart'); ?></a>
|
13 |
+
<?php if (ecwid_is_legacy_appearance_used()): ?>
|
14 |
+
<a href="#" class="media-menu-item" data-content="appearance"><?php _e('Appearance', 'ecwid-shopping-cart'); ?></a>
|
15 |
+
<?php endif; ?>
|
16 |
</div>
|
17 |
+
</div>
|
18 |
|
19 |
+
<div class="media-frame-title add-store">
|
20 |
+
<h1>
|
21 |
<?php _e('Add Store', 'ecwid-shopping-cart'); ?><span class="dashicons dashicons-arrow-down"></span>
|
22 |
+
</h1>
|
23 |
+
</div>
|
24 |
|
25 |
+
<div class="media-frame-title store-settings">
|
26 |
+
<h1>
|
27 |
<?php _e('Store elements', 'ecwid-shopping-cart'); ?><span class="dashicons dashicons-arrow-down"></span>
|
28 |
+
</h1>
|
29 |
+
</div>
|
30 |
|
31 |
<?php if (ecwid_is_legacy_appearance_used()): ?>
|
32 |
+
<div class="media-frame-title appearance">
|
33 |
+
<h1>
|
34 |
+
<?php _e('Appearance', 'ecwid-shopping-cart'); ?><span class="dashicons dashicons-arrow-down"></span>
|
35 |
+
</h1>
|
36 |
+
</div>
|
37 |
+
<?php endif; ?>
|
38 |
|
39 |
+
<div class="media-frame-content ecwid-store-editor store-settings">
|
40 |
|
41 |
+
<div class="store-settings-wrapper">
|
42 |
+
<div class="store-settings-preview">
|
43 |
<?php ecwid_embed_svg('add-store'); ?>
|
44 |
+
<label for="show_search" class="ecwid-search" data-ecwid-widget="search"></label>
|
45 |
+
<label for="show_categories" class="ecwid-categories" data-ecwid-widget="categories"></label>
|
46 |
+
<label for="show_minicart" class="ecwid-minicart" data-ecwid-widget="minicart"></label>
|
47 |
+
</div>
|
48 |
|
49 |
+
<div class="store-settings">
|
50 |
+
<h3><?php _e('Choose widgets to show', 'ecwid-shopping-cart'); ?></h3>
|
51 |
+
<p class="note"><?php _e('Product catalog will be shown automatically', 'ecwid-shopping-cart'); ?></p>
|
52 |
|
53 |
+
<div class="pure-control-group">
|
54 |
+
<label data-ecwid-widget="search">
|
55 |
+
<input type="checkbox" name="show_search" id="show_search" />
|
56 |
<?php _e('Show search', 'ecwid-shopping-cart'); ?>
|
57 |
+
</label>
|
58 |
+
</div>
|
59 |
|
60 |
+
<div class="pure-control-group">
|
61 |
+
<label data-ecwid-widget="minicart">
|
62 |
+
<input type="checkbox" name="show_minicart" id="show_minicart" />
|
63 |
<?php _e('Show minicart', 'ecwid-shopping-cart'); ?>
|
64 |
+
</label>
|
65 |
+
</div>
|
66 |
|
67 |
+
<div class="pure-control-group">
|
68 |
+
<label data-ecwid-widget="categories">
|
69 |
+
<input type="checkbox" name="show_categories" id="show_categories" />
|
70 |
<?php _e('Show categories', 'ecwid-shopping-cart'); ?>
|
71 |
+
</label>
|
72 |
+
</div>
|
73 |
|
74 |
<div class="note">
|
75 |
<?php echo sprintf(
|
91 |
|
92 |
<select name="default_category_id" id="ecwid_default_category_id">
|
93 |
<option value="0"<?php if (!get_option('ecwid_default_category_id')): ?> selected="selected"<?php endif; ?>>
|
94 |
+
<?php _e('Store root category', 'ecwid-shopping-cart'); ?>
|
95 |
</option>
|
96 |
<?php foreach ($categories as $category): ?>
|
97 |
<option
|
108 |
|
109 |
<?php endif; ?>
|
110 |
</div>
|
111 |
+
</div>
|
112 |
</div>
|
113 |
+
</div>
|
114 |
|
115 |
<?php if (ecwid_is_legacy_appearance_used()): ?>
|
116 |
+
<div class="media-frame-content ecwid-store-editor appearance">
|
117 |
|
118 |
+
<div class="pure-control-group pb-views">
|
119 |
+
<label class="products-per-page-label"><?php _e('Number of products per page', 'ecwid-shopping-cart'); ?></label>
|
120 |
+
<div class="ecwid-pb-view-size grid active" tabindex="1">
|
121 |
+
<div class="title"><?php _e('Grid view', 'ecwid-shopping-cart'); ?></div>
|
122 |
+
<div class="main-area">
|
123 |
+
<?php ecwid_embed_svg('grid'); ?>
|
124 |
+
</div>
|
125 |
+
<div class="right">
|
126 |
+
<div class="ruler"></div>
|
127 |
+
<input
|
128 |
+
type="text"
|
129 |
+
size="2"
|
130 |
+
name="grid_rows"
|
131 |
+
class="number"
|
132 |
+
value="<?php echo esc_attr(get_option('ecwid_pb_productspercolumn_grid')); ?>"
|
133 |
+
/>
|
134 |
+
</div>
|
135 |
+
<div class="bottom">
|
136 |
+
<div class="ruler"></div>
|
137 |
+
<input
|
138 |
+
type="text"
|
139 |
+
size="2"
|
140 |
+
name="grid_columns"
|
141 |
+
class="number"
|
142 |
+
value="<?php echo esc_attr(get_option('ecwid_pb_productsperrow_grid')); ?>"
|
143 |
+
/>
|
144 |
+
</div>
|
145 |
+
</div>
|
146 |
|
147 |
+
<div class="ecwid-pb-view-size list" tabindex="1">
|
148 |
+
<div class="title"><?php _e('List view', 'ecwid-shopping-cart'); ?></div>
|
149 |
+
<div class="main-area">
|
150 |
+
<?php ecwid_embed_svg('list'); ?>
|
151 |
+
</div>
|
152 |
+
<div class="right">
|
153 |
+
<div class="ruler"></div>
|
154 |
+
<input
|
155 |
+
type="text"
|
156 |
+
size="2"
|
157 |
+
name="list_rows"
|
158 |
+
class="number"
|
159 |
+
value="<?php echo esc_attr(get_option('ecwid_pb_productsperpage_list')); ?>" />
|
160 |
+
</div>
|
161 |
+
</div>
|
162 |
|
163 |
|
164 |
+
<div class="ecwid-pb-view-size table" tabindex="1">
|
165 |
+
<div class="title"><?php _e('Table view', 'ecwid-shopping-cart'); ?></div>
|
166 |
+
<div class="main-area">
|
167 |
+
<?php ecwid_embed_svg('table'); ?>
|
168 |
+
</div>
|
169 |
+
<div class="right">
|
170 |
+
<div class="ruler"></div>
|
171 |
+
<input
|
172 |
+
type="text"
|
173 |
+
size="2"
|
174 |
+
name="table_rows"
|
175 |
+
class="number"
|
176 |
+
value="<?php echo esc_attr(get_option('ecwid_pb_productsperpage_table')); ?>"
|
177 |
+
/>
|
178 |
+
</div>
|
179 |
+
</div>
|
180 |
+
<p class="note pb-note"><?php printf( __( 'Here you can control how many products will be displayed per page. These options define maximum values. If there is not enough space to show all product columns, %s will adapt the number of columns to hold all products.', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand() ); ?></p>
|
181 |
+
</div>
|
182 |
|
183 |
+
<hr class="after-pb" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
|
185 |
+
<div class="pure-control-group params-list">
|
186 |
+
<label for="ecwid_pb_categoriesperrow">
|
187 |
+
<?php _e('Number of categories per row', 'ecwid-shopping-cart'); ?>
|
188 |
+
</label>
|
189 |
+
<input
|
190 |
+
id="ecwid_pb_categoriesperrow"
|
191 |
+
name="categories_per_row"
|
192 |
+
type="text"
|
193 |
+
class="number"
|
194 |
+
value="<?php echo esc_attr(get_option('ecwid_pb_categoriesperrow')); ?>"
|
195 |
+
/>
|
196 |
+
</div>
|
|
|
|
|
|
|
|
|
197 |
|
198 |
+
<div class="pure-control-group params-list">
|
199 |
+
<label for="ecwid_pb_defaultview">
|
200 |
+
<?php _e('Default view mode on product pages', 'ecwid-shopping-cart'); ?>
|
201 |
+
</label>
|
202 |
+
<select id="ecwid_pb_defaultview" name="category_view">
|
203 |
+
<option value="grid" <?php if(get_option('ecwid_pb_defaultview') == 'grid') echo 'selected="selected"' ?> >
|
204 |
+
<?php _e('Grid', 'ecwid-shopping-cart'); ?>
|
205 |
+
</option>
|
206 |
+
<option value="list" <?php if(get_option('ecwid_pb_defaultview') == 'list') echo 'selected="selected"' ?> >
|
207 |
+
<?php _e('List', 'ecwid-shopping-cart'); ?>
|
208 |
+
</option>
|
209 |
+
<option value="table" <?php if(get_option('ecwid_pb_defaultview') == 'table') echo 'selected="selected"' ?> >
|
210 |
+
<?php _e('Table', 'ecwid-shopping-cart'); ?>
|
211 |
+
</option>
|
212 |
+
</select>
|
213 |
+
</div>
|
214 |
|
215 |
+
<div class="pure-control-group params-list">
|
216 |
+
<label for="ecwid_pb_searchview">
|
217 |
+
<?php _e('Default view mode on search results', 'ecwid-shopping-cart'); ?>
|
218 |
+
</label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
|
220 |
+
<select id="ecwid_pb_searchview" name="search_view">
|
221 |
+
<option value="grid" <?php if(get_option('ecwid_pb_searchview') == 'grid') echo 'selected="selected"' ?> >
|
222 |
+
<?php _e('Grid', 'ecwid-shopping-cart'); ?>
|
223 |
+
</option>
|
224 |
+
<option value="list" <?php if(get_option('ecwid_pb_searchview') == 'list') echo 'selected="selected"' ?> >
|
225 |
+
<?php _e('List', 'ecwid-shopping-cart'); ?>
|
226 |
+
</option>
|
227 |
+
<option value="table" <?php if(get_option('ecwid_pb_searchview') == 'table') echo 'selected="selected"' ?> >
|
228 |
+
<?php _e('Table', 'ecwid-shopping-cart'); ?>
|
229 |
+
</option>
|
230 |
+
</select>
|
231 |
+
</div>
|
232 |
+
</div>
|
233 |
+
|
234 |
<?php endif; ?>
|
235 |
|
236 |
<div class="media-frame-toolbar">
|
237 |
<div class="media-toolbar">
|
238 |
<div class="media-toolbar-secondary">
|
239 |
+
<?php if ( !ecwid_is_demo_store() ): ?>
|
240 |
<div class="store-id"><?php _e('Store ID', 'ecwid-shopping-cart'); ?>: <?php echo esc_attr(get_ecwid_store_id()); ?></div>
|
241 |
<?php else: ?>
|
242 |
+
<div class="store-id"><?php _e('Demo store', 'ecwid-shopping-cart'); ?></div>
|
243 |
<?php endif; ?>
|
244 |
+
<div class="setting-link">
|
245 |
+
<a target="_blank" href="<?php echo Ecwid_Admin::get_dashboard_url(); ?>"><?php _e('Open store dashboard', 'ecwid-shopping-cart'); ?>
|
246 |
+
</div>
|
247 |
+
</div>
|
248 |
+
<div class="media-toolbar-primary add-store">
|
249 |
+
<a href="#" class="button media-button button-primary button-large media-button-select"><?php _e('Insert into page'); ?></a>
|
250 |
+
</div>
|
251 |
+
<div class="media-toolbar-primary store-settings">
|
252 |
+
<a href="#" class="button media-button button-primary button-large media-button-select"><?php _e('Update'); ?></a>
|
253 |
+
</div>
|
254 |
+
</div>
|
255 |
+
</div>
|
256 |
+
</div> </div>
|
|
|
257 |
</div>
|
258 |
<div class="media-modal-backdrop"></div>
|
259 |
</div>
|
templates/store-svg.php
CHANGED
@@ -1,15 +1,14 @@
|
|
1 |
<?php
|
2 |
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
|
3 |
echo '<?xml-stylesheet type="text/css" href="http://fonts.googleapis.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&subset=latin%2Clatin-ext&ver=3.9.2" ?>';
|
4 |
-
echo '<?xml-stylesheet type="text/css" href="http://localhost/2.css" ?>';
|
5 |
?><!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
6 |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
7 |
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
8 |
viewBox="0 0 500 220" enable-background="new 0 0 500 220" xml:space="preserve">
|
9 |
|
10 |
-
<text x="
|
11 |
-
<text x="
|
12 |
-
<?php if (
|
13 |
<?php _e('Demo Store', 'ecwid-shopping-cart'); ?>
|
14 |
<?php else: ?>
|
15 |
<?php _e('Store ID', 'ecwid-shopping-cart'); ?>: <?php echo esc_attr(get_ecwid_store_id()); ?>
|
1 |
<?php
|
2 |
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
|
3 |
echo '<?xml-stylesheet type="text/css" href="http://fonts.googleapis.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&subset=latin%2Clatin-ext&ver=3.9.2" ?>';
|
|
|
4 |
?><!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
5 |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
6 |
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
7 |
viewBox="0 0 500 220" enable-background="new 0 0 500 220" xml:space="preserve">
|
8 |
|
9 |
+
<text x="250" y="93" text-anchor="middle" fill="#050303" font-family="Open Sans,Helvetica Neue,sans-serif" font-size="20"><?php _e('Your store will be shown here!', 'ecwid-shopping-cart'); ?></text>
|
10 |
+
<text x="250" y="115" text-anchor="middle" fill="#999999" font-family="Open Sans,Helvetica Neue,sans-serif" font-size="14">
|
11 |
+
<?php if ( ecwid_is_demo_store() ): ?>
|
12 |
<?php _e('Demo Store', 'ecwid-shopping-cart'); ?>
|
13 |
<?php else: ?>
|
14 |
<?php _e('Store ID', 'ecwid-shopping-cart'); ?>: <?php echo esc_attr(get_ecwid_store_id()); ?>
|
templates/sync.php
CHANGED
@@ -115,7 +115,7 @@ jQuery('#sync-button-slow').click(function() {
|
|
115 |
<div class="sync-block" id="sync-buttons">
|
116 |
<a id="sync-button-slow"><?php _e('Synchronize products', 'ecwid-shopping-cart'); ?></a>
|
117 |
</div>
|
118 |
-
<div class="sync-block" id="updating">
|
119 |
<div class="sync-icon">
|
120 |
<?php ecwid_embed_svg('update'); ?>
|
121 |
</div>
|
115 |
<div class="sync-block" id="sync-buttons">
|
116 |
<a id="sync-button-slow"><?php _e('Synchronize products', 'ecwid-shopping-cart'); ?></a>
|
117 |
</div>
|
118 |
+
<div class="sync-block progress-indicator" id="updating">
|
119 |
<div class="sync-icon">
|
120 |
<?php ecwid_embed_svg('update'); ?>
|
121 |
</div>
|
templates/wp-toolbox.tpl.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
<div class="card">
|
3 |
+
<h2 class="title"><?php esc_html_e( 'Extensions for your Store', 'ecwid-shopping-cart' ); ?></h2>
|
4 |
+
<p><?php _e( 'Take advantage of powerful apps and extensions designed to enhance your store.', 'ecwid-shopping-cart' ); ?></p>
|
5 |
+
<a class="button button-primary" href="admin.php?page=<?php echo Ecwid_Admin::ADMIN_SLUG; ?>-admin-appmarket">Browse the App Market</a>
|
6 |
+
<p></p>
|
7 |
+
</div>
|
8 |
+
</div>
|