Skip to content

Commit

Permalink
Merge pull request #293 from Ecwid/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
meteor-ec authored Aug 19, 2024
2 parents 17cf9bf + 4042be6 commit f6ff62e
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 42 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
== Changelog ==
= 6.12.18 - Aug 19, 2024 =
- Improved compatibility with pages created using the Jetpack plugin. Now ecommerce blocks added to Portfolio and Testimonial pages work as well as on regular pages.
- Fixed an issue with product option fields working on product pages. In some cases, product options were not clickable. We've fixed this.

= 6.12.17 - Aug 5, 2024 =
- Internal improvements and optimizations.

Expand Down
3 changes: 2 additions & 1 deletion ecwid-shopping-cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Description: Ecwid by Lightspeed 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.
Text Domain: ecwid-shopping-cart
Author: Ecwid Ecommerce
Version: 6.12.17
Version: 6.12.18
Author URI: https://ecwid.to/ecwid-site
License: GPLv2 or later
*/
Expand Down Expand Up @@ -209,6 +209,7 @@ function ecwid_init_integrations() {
'litespeed-cache/litespeed-cache.php' => 'litespeed-cache',
'sg-cachepress/sg-cachepress.php' => 'sg-optimizer',
'google-sitemap-generator/sitemap.php' => 'google-sitemap-generator',
'jetpack/jetpack.php' => 'jetpack',
);

$old_wordpress = version_compare( get_bloginfo( 'version' ), '5.0', '<' );
Expand Down
56 changes: 31 additions & 25 deletions includes/class-ecwid-config.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<?php

class Ecwid_Config {
const IS_WL = 'whitelabel_is_enabled';
const BRAND = 'whitelabel_brand';
const KB_URL = 'whitelabel_kb_url';
const CONTACT_US_URL = 'whitelabel_contact_us_url';
const REGISTRATION_URL = 'whitelabel_registration_url';
const CHANNEL_ID = 'whitelabel_channel_id';
const OAUTH_APPID = 'whitelabel_oauth_appid';
const OAUTH_APPSECRET = 'whitelabel_oauth_appsecret';
const OAUTH_TOKEN_URL = 'whitelabel_oauth_token_url';
const OAUTH_AUTH_URL = 'whitelabel_oauth_auth_url';
const TOKEN = 'config_token';
const STORE_ID = 'config_store_id';
const API_DOMAIN = 'config_api_domain';
const FRONTEND_DOMAIN = 'config_frontend_domain';
const CPANEL_DOMAIN = 'config_cpanel_domain';
const DEMO_STORE_ID = 'config_demo_store_id';
const IS_WL = 'whitelabel_is_enabled';
const BRAND = 'whitelabel_brand';
const KB_URL = 'whitelabel_kb_url';
const CONTACT_US_URL = 'whitelabel_contact_us_url';
const REGISTRATION_URL = 'whitelabel_registration_url';
const CHANNEL_ID = 'whitelabel_channel_id';
const OAUTH_APPID = 'whitelabel_oauth_appid';
const OAUTH_APPSECRET = 'whitelabel_oauth_appsecret';
const OAUTH_TOKEN_URL = 'whitelabel_oauth_token_url';
const OAUTH_AUTH_URL = 'whitelabel_oauth_auth_url';
const TOKEN = 'config_token';
const STORE_ID = 'config_store_id';
const API_DOMAIN = 'config_api_domain';
const STATIC_PAGES_API_DOMAIN = 'config_static_pages_api_domain';
const FRONTEND_DOMAIN = 'config_frontend_domain';
const CPANEL_DOMAIN = 'config_cpanel_domain';
const DEMO_STORE_ID = 'config_demo_store_id';

public static function is_wl() {
return EcwidPlatform::get( self::IS_WL, false );
Expand Down Expand Up @@ -86,6 +87,10 @@ public static function get_api_domain() {
return EcwidPlatform::get( self::API_DOMAIN, 'app.ecwid.com' );
}

public static function get_static_pages_api_domain() {
return EcwidPlatform::get( self::STATIC_PAGES_API_DOMAIN, 'storefront.ecwid.com' );
}

public static function get_scriptjs_domain() {
return EcwidPlatform::get( self::FRONTEND_DOMAIN, 'app.ecwid.com' );
}
Expand Down Expand Up @@ -171,15 +176,16 @@ protected static function _get_wl_config() {
*/
protected static function _get_common_config() {
$common_config = array(
self::OAUTH_APPID => 'oauth_appid',
self::OAUTH_APPSECRET => 'oauth_appsecret',
self::TOKEN => 'oauth_token',
self::STORE_ID => 'store_id',
self::CHANNEL_ID => 'channel_id',
self::API_DOMAIN => 'api_domain',
self::FRONTEND_DOMAIN => 'scriptjs_domain',
self::CPANEL_DOMAIN => 'cp_domain',
self::DEMO_STORE_ID => 'demo_store_id',
self::OAUTH_APPID => 'oauth_appid',
self::OAUTH_APPSECRET => 'oauth_appsecret',
self::TOKEN => 'oauth_token',
self::STORE_ID => 'store_id',
self::CHANNEL_ID => 'channel_id',
self::API_DOMAIN => 'api_domain',
self::STATIC_PAGES_API_DOMAIN => 'static_pages_api_domain',
self::FRONTEND_DOMAIN => 'scriptjs_domain',
self::CPANEL_DOMAIN => 'cp_domain',
self::DEMO_STORE_ID => 'demo_store_id',
);

return $common_config;
Expand Down
10 changes: 3 additions & 7 deletions includes/class-ecwid-products.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ public function join_out_of_stock( $join ) {
global $wpdb;

$join .= 'LEFT JOIN ' . $wpdb->postmeta . ' ' . self::DB_ALIAS_OUT_OF_STOCK
. ' ON ' . $wpdb->posts . '.id = ' . self::DB_ALIAS_OUT_OF_STOCK . '.post_id'
. ' AND ' . self::DB_ALIAS_OUT_OF_STOCK . '.meta_key="in_stock"'
. ' AND ' . self::DB_ALIAS_OUT_OF_STOCK . '.meta_value=1';
. ' ON ' . $wpdb->posts . '.id = ' . self::DB_ALIAS_OUT_OF_STOCK . '.post_id'
. ' AND ' . self::DB_ALIAS_OUT_OF_STOCK . '.meta_key="in_stock"'
. ' AND ' . self::DB_ALIAS_OUT_OF_STOCK . '.meta_value=1';

return $join;
}
Expand Down Expand Up @@ -325,12 +325,10 @@ public function sync( $settings = null ) {
}

if ( ! $settings || $settings['one_at_a_time'] && ! $did_something ) {

$did_something = $this->_process_products( $settings );
}

if ( ! $settings || $settings['one_at_a_time'] && ! $did_something ) {

$this->_status->update_last_sync_time( time() );

return true;
Expand Down Expand Up @@ -410,7 +408,6 @@ protected function _process_products( $settings ) {
}

while ( ! $over ) {

$this->_status_event(
array(
'event' => 'fetching_products',
Expand Down Expand Up @@ -551,7 +548,6 @@ protected function _process_deleted_products( $settings = array() ) {
}

while ( ! $over ) {

$this->_status_event(
array(
'event' => 'fetching_deleted_product_ids',
Expand Down
18 changes: 15 additions & 3 deletions includes/class-ecwid-seo-links.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,15 @@ public function build_rewrite_rules( $rules ) {
$patterns = self::get_seo_links_patterns();

$post = get_post( $page_id );

if ( ! $post ) {
continue;
}
if ( ! in_array( $post->post_type, array( 'page', 'post' ) ) ) {

$default_post_types = array( 'page', 'post' );
$allowed_post_types = apply_filters( 'ecwid_seo_allowed_post_types', $default_post_types );

if ( ! in_array( $post->post_type, $allowed_post_types ) ) {
continue;
}

Expand All @@ -358,9 +363,16 @@ public function build_rewrite_rules( $rules ) {
}

foreach ( $patterns as $pattern ) {
$additional_rules[ $link . '/' . $pattern . '.*' ] = 'index.php?' . $param_name . '=' . $link_page_id;
$query = 'index.php?' . $param_name . '=' . $link_page_id;

// adding post_type parameters for non-default types
if ( ! in_array( $post->post_type, $default_post_types ) ) {
$query .= '&post_type=' . $post->post_type;
}

$additional_rules[ $link . '/' . $pattern . '.*' ] = $query;
}
}
}//end foreach
}//end foreach

if ( self::is_store_on_home_page() ) {
Expand Down
3 changes: 1 addition & 2 deletions includes/class-ecwid-static-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class Ecwid_Static_Page {
const OPTION_VALUE_AUTO = '';

const HANDLE_STATIC_PAGE = 'static-page';
const API_URL = 'https://storefront.ecwid.com/';

protected static $cache_key;

Expand Down Expand Up @@ -68,7 +67,7 @@ protected static function get_endpoint_url( $params = false ) {
$params['mode'] = 'home';
}

$url = self::API_URL;
$url = 'https://' . Ecwid_Config::get_static_pages_api_domain() . '/';
$url .= sprintf( '%s-page/', $params['mode'] );
$url .= sprintf( '%s/', get_ecwid_store_id() );

Expand Down
17 changes: 17 additions & 0 deletions includes/integrations/class-ecwid-integration-jetpack.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

class Ecwid_Integration_Jetpack {
public $post_types = array( 'jetpack-portfolio', 'jetpack-testimonial' );

public function __construct() {
add_filter( 'ecwid_seo_allowed_post_types', array( $this, 'add_post_types' ), 10, 1 );
}

public function add_post_types( $types ) {
$types = array_merge( $types, $this->post_types );

return $types;
}
}

new Ecwid_Integration_Jetpack();
6 changes: 3 additions & 3 deletions includes/shortcodes/class-ecwid-shortcode-productbrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ public function render() {
add_filter( 'ecwid_is_defer_store_init_enabled', '__return_false' );
}

$code .= '<div id="static-ec-store-container">';
$code .= self::get_dynamic_html_code( $is_default_render, $classname );

$code .= '<div id="static-ec-store-container" style="margin-top:0;">';
$code .= htmlspecialchars_decode( Ecwid_Static_Page::get_html_code() );

$js_code = Ecwid_Static_Page::get_js_code();
Expand All @@ -67,8 +69,6 @@ public function render() {
}
$code .= '</div>';

$code .= self::get_dynamic_html_code( $is_default_render, $classname );

$force_dynamic_js_code = 'if( typeof window.ec.storefront.staticPages != "undefined" && typeof window.ec.storefront.staticPages.forceDynamicLoadingIfRequired != "undefined" ) {
window.ec.storefront.staticPages.forceDynamicLoadingIfRequired();
}';
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Requires at least: 4.4
Tested up to: 6.6
Stable tag: 6.12.17
Stable tag: 6.12.18

Powerful, easy to use ecommerce shopping cart for WordPress. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.

Expand Down Expand Up @@ -153,6 +153,10 @@ You can use Ecwid’s built-in import tools to copy your store products from any
* [Ecwid Help Center](http://help.ecwid.com "Ecwid Help")

== Changelog ==
= 6.12.18 - Aug 19, 2024 =
- Improved compatibility with pages created using the Jetpack plugin. Now ecommerce blocks added to Portfolio and Testimonial pages work as well as on regular pages.
- Fixed an issue with product option fields working on product pages. In some cases, product options were not clickable. We've fixed this.

= 6.12.17 - Aug 5, 2024 =
- Internal improvements and optimizations.

Expand Down

0 comments on commit f6ff62e

Please sign in to comment.