Version Description
- Jun 08, 2020 =
- Integration with the Elementor page builder. Elementor is one of the most popular page builders. We added Elementor support to Ecwid, so you can add online store functionality to your site pages in Elementor. We added two ecommerce widgets to the Elementor toolbar: the store home page to display the whole storefront and the buy now button to add buy buttons to pages and posts. To try the new widgets, open the Elementor editor in your WordPress admin backend and find the "Ecwid Store" section there.
- Minor fixes and improvements.
See full changelog
Download this release
Release Info
Developer | Ecwid |
Plugin | Ecwid Ecommerce Shopping Cart |
Version | 6.10 |
Comparing to | |
See all releases |
Code changes from version 6.9.7 to 6.10
- css/shortcode-stub.css +4 -0
- css/themes/twentytwenty.css +4 -0
- ecwid-shopping-cart.php +4 -4
- includes/class-ecwid-admin-storefront-page.php +12 -0
- includes/class-ecwid-admin.php +3 -1
- includes/class-ecwid-message-manager.php +1 -1
- includes/class-ecwid-static-page.php +1 -1
- includes/class-ecwid-stub-renderer.php +17 -4
- includes/integrations/class-ecwid-integration-elementor.php +72 -22
- includes/integrations/elementor/class-ec-elementor-widget-buynow.php +112 -0
- includes/integrations/elementor/class-ec-elementor-widget-store.php +138 -0
- includes/shortcodes/class-ecwid-shortcode-base.php +4 -0
- includes/shortcodes/class-ecwid-shortcode-product.php +0 -2
- lib/ecwid_platform.php +4 -4
- readme.txt +4 -4
- templates/admin/storefront/main.php +1 -1
- templates/shortcode-stub-buynow.tpl.php +3 -0
- templates/shortcode-stub-store.tpl.php +19 -0
css/shortcode-stub.css
CHANGED
@@ -25,4 +25,8 @@
|
|
25 |
.ecwid-shortcode-stub-header svg {
|
26 |
max-height: 20px;
|
27 |
margin-right: 1ch;
|
|
|
|
|
|
|
|
|
28 |
}
|
25 |
.ecwid-shortcode-stub-header svg {
|
26 |
max-height: 20px;
|
27 |
margin-right: 1ch;
|
28 |
+
}
|
29 |
+
|
30 |
+
.ec-store-block-buynow {
|
31 |
+
display: block;
|
32 |
}
|
css/themes/twentytwenty.css
CHANGED
@@ -1,3 +1,7 @@
|
|
1 |
#dynamic-ec-store, #static-ec-store {
|
2 |
max-width: 120rem;
|
|
|
|
|
|
|
|
|
3 |
}
|
1 |
#dynamic-ec-store, #static-ec-store {
|
2 |
max-width: 120rem;
|
3 |
+
}
|
4 |
+
|
5 |
+
#ecwid_body .entry-content > [data-elementor-type] {
|
6 |
+
max-width: 120rem !important;
|
7 |
}
|
ecwid-shopping-cart.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.ecwid.com?partner=wporg
|
|
5 |
Description: Ecwid is a free full-featured shopping cart. It can be easily integrated with any Wordpress blog and takes less than 5 minutes to set up.
|
6 |
Text Domain: ecwid-shopping-cart
|
7 |
Author: Ecwid Ecommerce
|
8 |
-
Version: 6.
|
9 |
Author URI: https://ecwid.to/ecwid-site
|
10 |
License: GPLv2 or later
|
11 |
*/
|
@@ -2147,10 +2147,10 @@ function ecwid_get_register_link()
|
|
2147 |
. Ecwid_Config::get_channel_id()
|
2148 |
. '%s#register';
|
2149 |
|
|
|
2150 |
/*
|
2151 |
$current_user = wp_get_current_user();
|
2152 |
-
|
2153 |
-
$user_data = '';
|
2154 |
if ($current_user->ID && function_exists('get_user_meta')) {
|
2155 |
$meta = get_user_meta($current_user->ID);
|
2156 |
|
@@ -2282,7 +2282,7 @@ function ecwid_get_iframe_src($time, $page)
|
|
2282 |
}
|
2283 |
|
2284 |
$url .= '&hide_staff_accounts_header_menu=true';
|
2285 |
-
$url .= '&
|
2286 |
$url .= '&website_manage_url=' . Ecwid_Store_Page::get_store_url();
|
2287 |
|
2288 |
return $url;
|
5 |
Description: Ecwid is a free full-featured shopping cart. It can be easily integrated with any Wordpress blog and takes less than 5 minutes to set up.
|
6 |
Text Domain: ecwid-shopping-cart
|
7 |
Author: Ecwid Ecommerce
|
8 |
+
Version: 6.10
|
9 |
Author URI: https://ecwid.to/ecwid-site
|
10 |
License: GPLv2 or later
|
11 |
*/
|
2147 |
. Ecwid_Config::get_channel_id()
|
2148 |
. '%s#register';
|
2149 |
|
2150 |
+
$user_data = '';
|
2151 |
/*
|
2152 |
$current_user = wp_get_current_user();
|
2153 |
+
|
|
|
2154 |
if ($current_user->ID && function_exists('get_user_meta')) {
|
2155 |
$meta = get_user_meta($current_user->ID);
|
2156 |
|
2282 |
}
|
2283 |
|
2284 |
$url .= '&hide_staff_accounts_header_menu=true';
|
2285 |
+
$url .= '&set_dashboard_website_section_type=wordpress';
|
2286 |
$url .= '&website_manage_url=' . Ecwid_Store_Page::get_store_url();
|
2287 |
|
2288 |
return $url;
|
includes/class-ecwid-admin-storefront-page.php
CHANGED
@@ -69,6 +69,18 @@ class Ecwid_Admin_Storefront_Page
|
|
69 |
}
|
70 |
|
71 |
$need_show_draft_warning = time() - get_option( 'ecwid_installation_date' ) > 3 * DAY_IN_SECONDS;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
}
|
73 |
|
74 |
wp_enqueue_script('ecwid-admin-storefront-js', ECWID_PLUGIN_URL . 'js/admin-storefront.js', array(), get_option('ecwid_plugin_version'));
|
69 |
}
|
70 |
|
71 |
$need_show_draft_warning = time() - get_option( 'ecwid_installation_date' ) > 3 * DAY_IN_SECONDS;
|
72 |
+
} else {
|
73 |
+
$store_on_front = false;
|
74 |
+
$page_edit_link = false;
|
75 |
+
$page_data = false;
|
76 |
+
$design_edit_link = false;
|
77 |
+
$page_slug = false;
|
78 |
+
$minicart_hide = false;
|
79 |
+
$categories = false;
|
80 |
+
$products_total = false;
|
81 |
+
$customizer_minicart_link = false;
|
82 |
+
|
83 |
+
if( !isset($page_link) ) $page_link = false;
|
84 |
}
|
85 |
|
86 |
wp_enqueue_script('ecwid-admin-storefront-js', ECWID_PLUGIN_URL . 'js/admin-storefront.js', array(), get_option('ecwid_plugin_version'));
|
includes/class-ecwid-admin.php
CHANGED
@@ -281,7 +281,9 @@ class Ecwid_Admin {
|
|
281 |
$hidden_items_path = array(
|
282 |
'dashboard',
|
283 |
'starter-site',
|
284 |
-
'website'
|
|
|
|
|
285 |
);
|
286 |
|
287 |
if( class_exists('Ecwid_Admin_Storefront_Page') && Ecwid_Admin_Storefront_Page::is_gutenberg_active() ) {
|
281 |
$hidden_items_path = array(
|
282 |
'dashboard',
|
283 |
'starter-site',
|
284 |
+
'website',
|
285 |
+
'website-overview',
|
286 |
+
'website-design',
|
287 |
);
|
288 |
|
289 |
if( class_exists('Ecwid_Admin_Storefront_Page') && Ecwid_Admin_Storefront_Page::is_gutenberg_active() ) {
|
includes/class-ecwid-message-manager.php
CHANGED
@@ -407,7 +407,7 @@ HTML
|
|
407 |
return
|
408 |
is_plugin_active( 'woocommerce/woocommerce.php' )
|
409 |
&& strpos( $admin_page, Ecwid_Import::PAGE_SLUG ) === false
|
410 |
-
&& $_GET['import'] != 'ec-store-import'
|
411 |
&& !$this->need_to_show_message( 'on_activate' )
|
412 |
&& Ecwid_Api_V3::is_available()
|
413 |
&& !ecwid_is_demo_store()
|
407 |
return
|
408 |
is_plugin_active( 'woocommerce/woocommerce.php' )
|
409 |
&& strpos( $admin_page, Ecwid_Import::PAGE_SLUG ) === false
|
410 |
+
&& (isset($_GET['import']) && $_GET['import'] != 'ec-store-import')
|
411 |
&& !$this->need_to_show_message( 'on_activate' )
|
412 |
&& Ecwid_Api_V3::is_available()
|
413 |
&& !ecwid_is_demo_store()
|
includes/class-ecwid-static-page.php
CHANGED
@@ -274,7 +274,7 @@ class Ecwid_Static_Page {
|
|
274 |
$api = new Ecwid_Api_V3();
|
275 |
$profile = $api->get_store_profile();
|
276 |
|
277 |
-
if( $profile->settings->closed ) {
|
278 |
return false;
|
279 |
}
|
280 |
|
274 |
$api = new Ecwid_Api_V3();
|
275 |
$profile = $api->get_store_profile();
|
276 |
|
277 |
+
if( isset($profile->settings->closed) && $profile->settings->closed ) {
|
278 |
return false;
|
279 |
}
|
280 |
|
includes/class-ecwid-stub-renderer.php
CHANGED
@@ -25,8 +25,22 @@ abstract class Ecwid_Stub_Renderer {
|
|
25 |
ob_start();
|
26 |
|
27 |
$message = __( 'Product', 'ecwid-shopping-cart' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
require ECWID_TEMPLATES_DIR . '/
|
30 |
|
31 |
$contents = ob_get_contents();
|
32 |
ob_end_clean();
|
@@ -35,9 +49,7 @@ abstract class Ecwid_Stub_Renderer {
|
|
35 |
} else if ( is_array( $args ) ) {
|
36 |
ob_start();
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
require ECWID_TEMPLATES_DIR . '/shortcode-stub.tpl.php';
|
41 |
|
42 |
$contents = ob_get_contents();
|
43 |
ob_end_clean();
|
@@ -75,6 +87,7 @@ abstract class Ecwid_Stub_Renderer {
|
|
75 |
abstract protected function _should_apply();
|
76 |
|
77 |
public function enqueue_scripts() {
|
|
|
78 |
EcwidPlatform::enqueue_style( 'shortcode-stub' );
|
79 |
EcwidPlatform::enqueue_style( 'widget-stub' );
|
80 |
}
|
25 |
ob_start();
|
26 |
|
27 |
$message = __( 'Product', 'ecwid-shopping-cart' );
|
28 |
+
$template_file = 'shortcode-stub.tpl.php';
|
29 |
+
|
30 |
+
// detect Buy Now
|
31 |
+
$params = $args->get_params();
|
32 |
+
if( isset($params['display']) ) {
|
33 |
+
|
34 |
+
$display_items = explode( ' ', $params['display'] );
|
35 |
+
$display_buynow = array('addtobag', 'price');
|
36 |
+
|
37 |
+
if( !array_diff( $display_items, $display_buynow ) ) {
|
38 |
+
$message = __( 'Buy Now', 'ecwid-shopping-cart' );
|
39 |
+
$template_file = 'shortcode-stub-buynow.tpl.php';
|
40 |
+
}
|
41 |
+
}
|
42 |
|
43 |
+
require ECWID_TEMPLATES_DIR . '/' . $template_file;
|
44 |
|
45 |
$contents = ob_get_contents();
|
46 |
ob_end_clean();
|
49 |
} else if ( is_array( $args ) ) {
|
50 |
ob_start();
|
51 |
|
52 |
+
require ECWID_TEMPLATES_DIR . '/shortcode-stub-store.tpl.php';
|
|
|
|
|
53 |
|
54 |
$contents = ob_get_contents();
|
55 |
ob_end_clean();
|
87 |
abstract protected function _should_apply();
|
88 |
|
89 |
public function enqueue_scripts() {
|
90 |
+
wp_enqueue_style( 'ec-shortcode-stub', ECWID_PLUGIN_URL . 'css/gutenberg/blocks.editor.build.css' );
|
91 |
EcwidPlatform::enqueue_style( 'shortcode-stub' );
|
92 |
EcwidPlatform::enqueue_style( 'widget-stub' );
|
93 |
}
|
includes/integrations/class-ecwid-integration-elementor.php
CHANGED
@@ -2,44 +2,94 @@
|
|
2 |
|
3 |
require_once ECWID_PLUGIN_DIR . '/includes/class-ecwid-stub-renderer.php';
|
4 |
|
5 |
-
class Ecwid_Integration_Elementor
|
|
|
|
|
6 |
|
7 |
public function __construct() {
|
8 |
-
parent::__construct();
|
9 |
|
10 |
-
$
|
|
|
11 |
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
14 |
|
15 |
protected function _should_apply() {
|
16 |
-
|
|
|
17 |
}
|
18 |
-
|
19 |
-
public function
|
20 |
-
|
|
|
|
|
21 |
}
|
22 |
-
}
|
23 |
|
24 |
-
|
|
|
|
|
|
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
public function __construct() {
|
29 |
|
30 |
-
if(
|
31 |
-
|
32 |
}
|
33 |
-
|
|
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
38 |
}
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
protected function _should_apply() {
|
42 |
-
|
43 |
-
return !(is_admin() && $pagenow == 'widgets.php');
|
44 |
}
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
require_once ECWID_PLUGIN_DIR . '/includes/class-ecwid-stub-renderer.php';
|
4 |
|
5 |
+
class Ecwid_Integration_Elementor {
|
6 |
+
|
7 |
+
const EC_WIDGETS_PATH = '/includes/integrations/elementor';
|
8 |
|
9 |
public function __construct() {
|
|
|
10 |
|
11 |
+
$is_needed_php_version = version_compare( phpversion(), '5.6', '>=' );
|
12 |
+
$is_needed_wp_version = version_compare( get_bloginfo('version'), '5.4.1', '>=' );
|
13 |
|
14 |
+
if ( $is_needed_php_version && $is_needed_wp_version ) {
|
15 |
+
add_action( 'init', array( $this, 'init_custom_widgets') );
|
16 |
+
}
|
17 |
+
|
18 |
+
if( $this->_should_apply() ) {
|
19 |
+
add_action( 'widgets_init', array( $this, 'init_sidebar_widgets') );
|
20 |
+
}
|
21 |
+
|
22 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
23 |
}
|
24 |
|
25 |
protected function _should_apply() {
|
26 |
+
global $pagenow;
|
27 |
+
return !(is_admin() && $pagenow == 'widgets.php');
|
28 |
}
|
29 |
+
|
30 |
+
public function init_sidebar_widgets() {
|
31 |
+
if( class_exists( 'Ecwid_Widget_Product_Browser' ) ) {
|
32 |
+
register_widget('Ecwid_Widget_Product_Browser');
|
33 |
+
}
|
34 |
}
|
|
|
35 |
|
36 |
+
private function include_custom_widgets_files() {
|
37 |
+
require_once ECWID_PLUGIN_DIR . self::EC_WIDGETS_PATH . '/class-ec-elementor-widget-store.php';
|
38 |
+
require_once ECWID_PLUGIN_DIR . self::EC_WIDGETS_PATH . '/class-ec-elementor-widget-buynow.php';
|
39 |
+
}
|
40 |
|
41 |
+
public function init_custom_widgets() {
|
|
|
|
|
42 |
|
43 |
+
if( !class_exists('\Elementor\Plugin') || !class_exists('\Elementor\Widget_Base') ) {
|
44 |
+
return;
|
45 |
}
|
46 |
+
|
47 |
+
add_action( 'elementor/elements/categories_registered', array( $this, 'add_custom_widget_categories' ) );
|
48 |
|
49 |
+
$this->include_custom_widgets_files();
|
50 |
+
|
51 |
+
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Ec_Elementor_Widget_Store() );
|
52 |
+
|
53 |
+
if( !ecwid_is_demo_store() ) {
|
54 |
+
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Ec_Elementor_Widget_Buynow() );
|
55 |
}
|
56 |
}
|
57 |
|
58 |
+
public function add_custom_widget_categories( $elements_manager ) {
|
59 |
+
|
60 |
+
$elements_manager->add_category(
|
61 |
+
'ec-store',
|
62 |
+
array(
|
63 |
+
'title' => sprintf(
|
64 |
+
__( '%s Store', 'ecwid-shopping-cart'),
|
65 |
+
Ecwid_Config::get_brand()
|
66 |
+
),
|
67 |
+
'icon' => 'fa fa-plug',
|
68 |
+
)
|
69 |
+
);
|
70 |
+
}
|
71 |
+
|
72 |
+
public function enqueue_scripts() {
|
73 |
+
wp_enqueue_style('ec-elementor', ECWID_PLUGIN_URL . 'css/integrations/elementor.css', array(), get_option('ecwid_plugin_version'));
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
class Ec_Integration_Elementor_Stub_Renderer extends Ecwid_Stub_Renderer {
|
79 |
+
|
80 |
+
public function __construct() {
|
81 |
+
parent::__construct();
|
82 |
+
}
|
83 |
+
|
84 |
protected function _should_apply() {
|
85 |
+
return @$_REQUEST['action'] == 'elementor_ajax' || @$_REQUEST['action'] == 'elementor' || isset( $_GET['elementor-preview'] );
|
|
|
86 |
}
|
87 |
+
|
88 |
+
public function enqueue_scripts() {
|
89 |
+
parent::enqueue_scripts();
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
|
94 |
+
$__ecwid_integration_elementor = new Ecwid_Integration_Elementor();
|
95 |
+
$__ecwid_integration_elementor_stub_render = new Ec_Integration_Elementor_Stub_Renderer();
|
includes/integrations/elementor/class-ec-elementor-widget-buynow.php
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ec_Elementor_Widget_Buynow extends \Elementor\Widget_Base {
|
4 |
+
|
5 |
+
public function get_name() {
|
6 |
+
return 'ec_buynow';
|
7 |
+
}
|
8 |
+
|
9 |
+
public function get_title() {
|
10 |
+
return __( 'Buy Now Button', 'ecwid-shopping-cart' );
|
11 |
+
}
|
12 |
+
|
13 |
+
public function get_icon() {
|
14 |
+
return 'eicon-button';
|
15 |
+
}
|
16 |
+
|
17 |
+
public function get_categories() {
|
18 |
+
return array( 'ec-store' );
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _register_controls() {
|
22 |
+
|
23 |
+
$this->start_controls_section(
|
24 |
+
'section_product',
|
25 |
+
array( 'label' => __( 'Linked product', 'ecwid-shopping-cart' ) )
|
26 |
+
);
|
27 |
+
|
28 |
+
$this->add_control(
|
29 |
+
'product_id',
|
30 |
+
array(
|
31 |
+
'label' => __( 'Choose product', 'ecwid-shopping-cart' ),
|
32 |
+
'type' => Elementor\Controls_Manager::SELECT,
|
33 |
+
'default' => 1,
|
34 |
+
'options' => $this->_get_products_for_selector()
|
35 |
+
)
|
36 |
+
);
|
37 |
+
|
38 |
+
$this->end_controls_section();
|
39 |
+
|
40 |
+
|
41 |
+
$this->start_controls_section(
|
42 |
+
'section_appearance',
|
43 |
+
array(
|
44 |
+
'label' => __( 'Appearance', 'ecwid-shopping-cart' ),
|
45 |
+
'tab' => \Elementor\Controls_Manager::TAB_STYLE
|
46 |
+
)
|
47 |
+
);
|
48 |
+
|
49 |
+
$this->add_control(
|
50 |
+
'show_price_on_button',
|
51 |
+
array(
|
52 |
+
'label' => __( 'Show price inside the «Buy now» button', 'ecwid-shopping-cart' ),
|
53 |
+
'type' => Elementor\Controls_Manager::SWITCHER,
|
54 |
+
'default' => 1,
|
55 |
+
'return_value' => 1
|
56 |
+
)
|
57 |
+
);
|
58 |
+
|
59 |
+
$this->add_control(
|
60 |
+
'center_align',
|
61 |
+
array(
|
62 |
+
'label' => __( 'Center align on a page', 'ecwid-shopping-cart' ),
|
63 |
+
'type' => Elementor\Controls_Manager::SWITCHER,
|
64 |
+
'default' => 1,
|
65 |
+
'return_value' => 1
|
66 |
+
)
|
67 |
+
);
|
68 |
+
|
69 |
+
$this->end_controls_section();
|
70 |
+
}
|
71 |
+
|
72 |
+
protected function render() {
|
73 |
+
$settings = $this->get_settings_for_display();
|
74 |
+
|
75 |
+
$is_editor_page = @$_REQUEST['action'] == 'elementor_ajax' || @$_REQUEST['action'] == 'elementor';
|
76 |
+
if( !$is_editor_page && intval($settings['product_id']) <= 1 ) {
|
77 |
+
return;
|
78 |
+
}
|
79 |
+
|
80 |
+
$shortcode_name = Ecwid_Shortcode_Product::get_shortcode_name();
|
81 |
+
|
82 |
+
$shortcode = sprintf( '[%s id="%s" display="price addtobag" show_border="" show_price_on_button="%s" center_align="%s" version="2"]',
|
83 |
+
$shortcode_name,
|
84 |
+
$settings['product_id'],
|
85 |
+
$settings['show_price_on_button'],
|
86 |
+
$settings['center_align']
|
87 |
+
);
|
88 |
+
|
89 |
+
echo do_shortcode( $shortcode );
|
90 |
+
}
|
91 |
+
|
92 |
+
protected function _get_products_for_selector() {
|
93 |
+
|
94 |
+
$api = new Ecwid_Api_V3();
|
95 |
+
$products = $api->get_products( array() );
|
96 |
+
|
97 |
+
if( !$products ) {
|
98 |
+
return array();
|
99 |
+
}
|
100 |
+
|
101 |
+
$result[1] = __( 'Choose product', 'ecwid-shopping-cart' );
|
102 |
+
|
103 |
+
if( count( $products->items ) ) {
|
104 |
+
foreach ($products->items as $product) {
|
105 |
+
$result[ $product->id ] = $product->name;
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
return $result;
|
110 |
+
}
|
111 |
+
|
112 |
+
}
|
includes/integrations/elementor/class-ec-elementor-widget-store.php
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ec_Elementor_Widget_Store extends \Elementor\Widget_Base {
|
4 |
+
|
5 |
+
public function get_name() {
|
6 |
+
return 'ec_store';
|
7 |
+
}
|
8 |
+
|
9 |
+
public function get_title() {
|
10 |
+
return __('Online store', 'ecwid-shopping-cart');
|
11 |
+
}
|
12 |
+
|
13 |
+
public function get_icon() {
|
14 |
+
return 'eicon-basket-medium';
|
15 |
+
}
|
16 |
+
|
17 |
+
public function get_categories() {
|
18 |
+
return array( 'ec-store' );
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _register_controls() {
|
22 |
+
|
23 |
+
$categories = $this->_get_categories_for_selector();
|
24 |
+
$dashboard_link = admin_url( 'admin.php?page=ec-store' );
|
25 |
+
|
26 |
+
$this->start_controls_section(
|
27 |
+
'content_section',
|
28 |
+
array(
|
29 |
+
'label' => __( 'Online Store', 'ecwid-shopping-cart' ),
|
30 |
+
'tab' => \Elementor\Controls_Manager::TAB_CONTENT
|
31 |
+
)
|
32 |
+
);
|
33 |
+
|
34 |
+
if( count($categories) ) {
|
35 |
+
$this->add_control(
|
36 |
+
'default_category_id',
|
37 |
+
array(
|
38 |
+
'label' => __( 'Default category', 'ecwid-shopping-cart' ),
|
39 |
+
'description' => __( 'The category that is shown by default on the Store Front Page', 'ecwid-shopping-cart' ),
|
40 |
+
'type' => Elementor\Controls_Manager::SELECT,
|
41 |
+
'default' => 0,
|
42 |
+
'options' => $categories
|
43 |
+
)
|
44 |
+
);
|
45 |
+
}
|
46 |
+
|
47 |
+
if( ecwid_is_demo_store() ) {
|
48 |
+
$html_raw = sprintf(
|
49 |
+
'<a href="%s" target="_blank" class="elementor-button elementor-button-default elementor-button-success elementor-input-style" style="text-align: center;">%s</a>',
|
50 |
+
$dashboard_link,
|
51 |
+
__( 'Set up your store', 'ecwid-shopping-cart' )
|
52 |
+
);
|
53 |
+
} else {
|
54 |
+
$html_raw = sprintf(
|
55 |
+
__( 'To manage your store, go to <a %s>the Store Dashboard page</a>', 'ecwid-shopping-cart' ),
|
56 |
+
'href="' . $dashboard_link . '" target="_blank"'
|
57 |
+
);
|
58 |
+
}
|
59 |
+
|
60 |
+
$this->add_control(
|
61 |
+
'content',
|
62 |
+
array(
|
63 |
+
'label' => __( 'Store', 'ecwid-shopping-cart' ),
|
64 |
+
'show_label' => false,
|
65 |
+
'type' => Elementor\Controls_Manager::RAW_HTML,
|
66 |
+
'raw' => $html_raw
|
67 |
+
)
|
68 |
+
);
|
69 |
+
|
70 |
+
$this->end_controls_section();
|
71 |
+
|
72 |
+
|
73 |
+
if( !ecwid_is_demo_store() ) {
|
74 |
+
|
75 |
+
$this->start_controls_section(
|
76 |
+
'section_appearance',
|
77 |
+
array(
|
78 |
+
'label' => __( 'Appearance', 'ecwid-shopping-cart' ),
|
79 |
+
'tab' => \Elementor\Controls_Manager::TAB_STYLE
|
80 |
+
)
|
81 |
+
);
|
82 |
+
|
83 |
+
$design_edit_link = get_admin_url( null, 'admin.php?page=' . Ecwid_Admin::ADMIN_SLUG . '-admin-design' );
|
84 |
+
|
85 |
+
$this->add_control(
|
86 |
+
'design',
|
87 |
+
array(
|
88 |
+
'label' => __( 'Design', 'ecwid-shopping-cart' ),
|
89 |
+
'show_label' => false,
|
90 |
+
'type' => Elementor\Controls_Manager::RAW_HTML,
|
91 |
+
'raw' => sprintf(
|
92 |
+
__("You can control your store look and feel on the <a %s>Design settings page</a> in your store control panel.", 'ecwid-shopping-cart'),
|
93 |
+
'href="' . $design_edit_link . '" target="_blank"'
|
94 |
+
)
|
95 |
+
)
|
96 |
+
);
|
97 |
+
|
98 |
+
$this->end_controls_section();
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
protected function render() {
|
103 |
+
$settings = $this->get_settings_for_display();
|
104 |
+
|
105 |
+
if( !isset($settings['default_category_id']) ) {
|
106 |
+
$settings['default_category_id'] = '';
|
107 |
+
}
|
108 |
+
|
109 |
+
$shortcode_name = Ecwid_Shortcode_Base::get_shortcode_name();
|
110 |
+
|
111 |
+
$shortcode = sprintf( '[%s widgets="productbrowser" default_category_id="%s"]',
|
112 |
+
$shortcode_name,
|
113 |
+
$settings['default_category_id']
|
114 |
+
);
|
115 |
+
|
116 |
+
echo do_shortcode( $shortcode );
|
117 |
+
}
|
118 |
+
|
119 |
+
protected function _get_categories_for_selector() {
|
120 |
+
|
121 |
+
$categories = ecwid_get_categories_for_selector();
|
122 |
+
|
123 |
+
if( !count($categories) || ecwid_is_demo_store() ) {
|
124 |
+
return array();
|
125 |
+
}
|
126 |
+
|
127 |
+
$result[] = __( 'Store root category', 'ecwid-shopping-cart' );
|
128 |
+
|
129 |
+
if( count( $categories ) ) {
|
130 |
+
foreach ($categories as $category) {
|
131 |
+
$result[ $category->id ] = $category->name;
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
return $result;
|
136 |
+
}
|
137 |
+
|
138 |
+
}
|
includes/shortcodes/class-ecwid-shortcode-base.php
CHANGED
@@ -160,4 +160,8 @@ HTML;
|
|
160 |
|
161 |
return '"' . implode('","', $pieces) . '"';
|
162 |
}
|
|
|
|
|
|
|
|
|
163 |
}
|
160 |
|
161 |
return '"' . implode('","', $pieces) . '"';
|
162 |
}
|
163 |
+
|
164 |
+
public function get_params() {
|
165 |
+
return $this->_params;
|
166 |
+
}
|
167 |
}
|
includes/shortcodes/class-ecwid-shortcode-product.php
CHANGED
@@ -34,12 +34,10 @@ class Ecwid_Shortcode_Product extends Ecwid_Shortcode_Base {
|
|
34 |
return;
|
35 |
}
|
36 |
|
37 |
-
|
38 |
if ($attributes['link'] == 'yes' && !ecwid_is_store_page_available()) {
|
39 |
$attributes['link'] = 'no';
|
40 |
}
|
41 |
|
42 |
-
|
43 |
$version = $attributes['version'];
|
44 |
if (!in_array($version, array('1', '2'))) {
|
45 |
$attributes['version'] = 1;
|
34 |
return;
|
35 |
}
|
36 |
|
|
|
37 |
if ($attributes['link'] == 'yes' && !ecwid_is_store_page_available()) {
|
38 |
$attributes['link'] = 'no';
|
39 |
}
|
40 |
|
|
|
41 |
$version = $attributes['version'];
|
42 |
if (!in_array($version, array('1', '2'))) {
|
43 |
$attributes['version'] = 1;
|
lib/ecwid_platform.php
CHANGED
@@ -419,7 +419,7 @@ class EcwidPlatform {
|
|
419 |
)
|
420 |
);
|
421 |
|
422 |
-
if ( $result['time'] > EcwidPlatform::get( self::CATEGORIES_CACHE_VALID_FROM ) ) {
|
423 |
return $result['data'];
|
424 |
}
|
425 |
|
@@ -440,8 +440,8 @@ class EcwidPlatform {
|
|
440 |
'valid_from' => EcwidPlatform::get( self::CATEGORIES_CACHE_VALID_FROM )
|
441 |
)
|
442 |
);
|
443 |
-
|
444 |
-
if ( $result['time'] > EcwidPlatform::get( self::PRODUCTS_CACHE_VALID_FROM ) ) {
|
445 |
return $result['data'];
|
446 |
}
|
447 |
|
@@ -470,7 +470,7 @@ class EcwidPlatform {
|
|
470 |
)
|
471 |
);
|
472 |
|
473 |
-
if ( EcwidPlatform::get( self::CATALOG_CACHE_VALID_FROM ) > $valid_from ) {
|
474 |
return $result['data'];
|
475 |
}
|
476 |
|
419 |
)
|
420 |
);
|
421 |
|
422 |
+
if ( $result && $result['time'] > EcwidPlatform::get( self::CATEGORIES_CACHE_VALID_FROM ) ) {
|
423 |
return $result['data'];
|
424 |
}
|
425 |
|
440 |
'valid_from' => EcwidPlatform::get( self::CATEGORIES_CACHE_VALID_FROM )
|
441 |
)
|
442 |
);
|
443 |
+
|
444 |
+
if ( $result && $result['time'] > EcwidPlatform::get( self::PRODUCTS_CACHE_VALID_FROM ) ) {
|
445 |
return $result['data'];
|
446 |
}
|
447 |
|
470 |
)
|
471 |
);
|
472 |
|
473 |
+
if ( $result && EcwidPlatform::get( self::CATALOG_CACHE_VALID_FROM ) > $valid_from ) {
|
474 |
return $result['data'];
|
475 |
}
|
476 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: Ecwid
|
|
3 |
Tags: ecommerce, e-commerce, storefront, online store, sell
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 5.4
|
6 |
-
Stable tag: 6.
|
7 |
|
8 |
Powerful, easy to use ecommerce shopping cart. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.
|
9 |
|
@@ -154,8 +154,8 @@ You can use Ecwid’s built-in import tools to copy your store products from any
|
|
154 |
|
155 |
== Changelog ==
|
156 |
|
157 |
-
= 6.
|
158 |
-
-
|
159 |
-
-
|
160 |
|
161 |
[See full changelog](https://raw.githubusercontent.com/Ecwid/ecwid-wordpress-plugin/master/CHANGELOG.txt)
|
3 |
Tags: ecommerce, e-commerce, storefront, online store, sell
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 5.4
|
6 |
+
Stable tag: 6.10
|
7 |
|
8 |
Powerful, easy to use ecommerce shopping cart. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.
|
9 |
|
154 |
|
155 |
== Changelog ==
|
156 |
|
157 |
+
= 6.10 - Jun 08, 2020 =
|
158 |
+
- **Integration with the Elementor page builder.** Elementor is one of the most popular page builders. We added Elementor support to Ecwid, so you can add online store functionality to your site pages in Elementor. We added two ecommerce widgets to the Elementor toolbar: the store home page to display the whole storefront and the buy now button to add buy buttons to pages and posts. To try the new widgets, open the Elementor editor in your WordPress admin backend and find the "Ecwid Store" section there.
|
159 |
+
- Minor fixes and improvements.
|
160 |
|
161 |
[See full changelog](https://raw.githubusercontent.com/Ecwid/ecwid-wordpress-plugin/master/CHANGELOG.txt)
|
templates/admin/storefront/main.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
</div>
|
7 |
|
8 |
<?php
|
9 |
-
if( $need_show_draft_warning ) {
|
10 |
?>
|
11 |
<div class="a-card a-card--compact a-card--warning" data-ec-state="draft">
|
12 |
<div class="a-card__paddings">
|
6 |
</div>
|
7 |
|
8 |
<?php
|
9 |
+
if( isset($need_show_draft_warning) && $need_show_draft_warning ) {
|
10 |
?>
|
11 |
<div class="a-card a-card--compact a-card--warning" data-ec-state="draft">
|
12 |
<div class="a-card__paddings">
|
templates/shortcode-stub-buynow.tpl.php
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<div class="ec-store-block ec-store-block-buynow">
|
2 |
+
<div class="image"></div>
|
3 |
+
</div>
|
templates/shortcode-stub-store.tpl.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="ec-store-generic-block ec-store-block">
|
2 |
+
<div class="ec-store-block-header">
|
3 |
+
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1"><g id="Typography" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="gutenberg-widgets-icons" transform="translate(-234.000000, -324.000000)" fill="#555D66" fill-rule="nonzero"><g id="store-icon" transform="translate(234.000000, 324.000000)"><path d="M9,20.4893188 L7,20.4893188 L7,14 C7,13.4477153 7.44771525,13 8,13 L16,13 C16.5522847,13 17,13.4477153 17,14 L17,20.4893188 C16.260376,20.4893188 15.5929565,20.4893188 15,20.4893188 L15,15 L9,15 L9,20.4893188 Z" id="Rectangle-3"></path><path d="M20,10 L22,10 L22,21.0006104 C22,21.5528951 21.5522847,22.0006104 21,22.0006104 L3,22.0006104 C2.44771525,22.0006104 2,21.5528951 2,21.0006104 L2,10 L4,10 L4,20.0006104 L20,20.0006104 L20,10 Z" id="Rectangle-3"></path><path d="M2,6.5 C2,7.88071187 3.11928813,9 4.5,9 C5.18185515,9 5.81786053,8.72707728 6.28575907,8.24959145 L7,7.52071565 L7.71424093,8.24959145 C8.18213947,8.72707728 8.81814485,9 9.5,9 C10.1818552,9 10.8178605,8.72707728 11.2857591,8.24959145 L12,7.52071565 L12.7142409,8.24959145 C13.1821395,8.72707728 13.8181448,9 14.5,9 C15.1818552,9 15.8178605,8.72707728 16.2857591,8.24959145 L17,7.52071565 L17.7142409,8.24959145 C18.1821395,8.72707728 18.8181448,9 19.5,9 C20.8807119,9 22,7.88071187 22,6.5 C22,5.81342077 21.7917279,4.97737648 21.3637104,4 L2.63518632,4 C2.20791709,4.97255801 2,5.80837301 2,6.5 Z M4.5,11 C2.01471863,11 4.4408921e-16,8.98528137 0,6.5 C0,5.33310646 0.374574518,4.02209564 1.10468286,2.55457075 L1.38058736,2 L22.6207487,2 L22.8961752,2.55629959 C23.6256977,4.02977127 24,5.33982925 24,6.5 C24,8.98528137 21.9852814,11 19.5,11 C18.5937006,11 17.7289225,10.73006 17,10.2422809 C16.2710775,10.73006 15.4062994,11 14.5,11 C13.5937006,11 12.7289225,10.73006 12,10.2422809 C11.2710775,10.73006 10.4062994,11 9.5,11 C8.59370056,11 7.72892246,10.73006 7,10.2422809 C6.27107754,10.73006 5.40629944,11 4.5,11 Z" id="Combined-Shape"></path></g></g></g></svg>
|
4 |
+
<?php _e( 'Store Home Page', 'ecwid-shopping-cart' ); ?>
|
5 |
+
</div>
|
6 |
+
<div class="ec-store-block-content">
|
7 |
+
<div class="ec-store-products">
|
8 |
+
<div class="ec-store-product1"></div>
|
9 |
+
<div class="ec-store-product2"></div>
|
10 |
+
<div class="ec-store-product3"></div>
|
11 |
+
</div>
|
12 |
+
<div class="ec-store-products">
|
13 |
+
<div class="ec-store-product4"></div>
|
14 |
+
<div class="ec-store-product5"></div>
|
15 |
+
<div class="ec-store-product6"></div>
|
16 |
+
</div>
|
17 |
+
</div>
|
18 |
+
<div><?php _e( 'Your store will be shown here', 'ecwid-shopping-cart' ); ?></div>
|
19 |
+
</div>
|