Skip to content

Commit 108f7f5

Browse files
authored
Merge pull request #216 from moderntribe/release/3.21.0
packaged version 3.21.0
2 parents 3a9f067 + f459474 commit 108f7f5

24 files changed

+1572
-4067
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## [3.21.0]
4+
5+
### Added
6+
- Added manuall site URL sync option in the Diagnostics panel
7+
8+
### Changed
9+
- Modified admin import timeout message
10+
- Update checkout SDK to 1.79.0
11+
12+
### Fixed
13+
- Fixed Best Selling sort on Product archive page
14+
- Fixed category sort not being reflected in the menu
15+
16+
317
## [3.20.0]
418

519
### Changed
@@ -1193,6 +1207,7 @@
11931207
in fact, reset postdata, so far as Gutenberg 3.2.0 is concerned.
11941208

11951209

1210+
[3.21.0]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/3.20.0...3.21.0
11961211
[3.20.0]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/3.19.0...3.20.0
11971212
[3.19.0]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/3.18.1...3.19.0
11981213
[3.18.1]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/3.18.0...3.18.1

assets/js/dist/scripts.js

Lines changed: 769 additions & 3445 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/dist/scripts.min.js

Lines changed: 3 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/dist/vendor.js

Lines changed: 671 additions & 528 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/dist/vendor.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/src/public/checkout/embedded-checkout.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import Cookie from 'js-cookie';
77
import _ from 'lodash';
8-
import { embedCheckout } from '@bigcommerce/checkout-sdk';
98
import * as tools from 'utils/tools';
109
import scrollTo from 'utils/dom/scroll-to';
1110
import { CART_ID_COOKIE_NAME, CART_ITEM_COUNT_COOKIE } from 'bcConstants/cookies';
@@ -56,7 +55,8 @@ const scrollIframe = () => {
5655
* @function loadEmbeddedCheckout
5756
* @description Create an instance of the BC embedded checkout.
5857
*/
59-
const loadEmbeddedCheckout = () => {
58+
const loadEmbeddedCheckout = async () => {
59+
const checkoutCDN = await checkoutKitLoader.load('embedded-checkout');
6060
// Load the config from the data attribute of the checkout container.
6161
const config = JSON.parse(el.container.dataset.config);
6262

@@ -71,7 +71,7 @@ const loadEmbeddedCheckout = () => {
7171
config.onComplete = scrollIframe;
7272

7373
// Embed the checkout.
74-
embedCheckout(config);
74+
checkoutCDN.embedCheckout(config);
7575
};
7676

7777
const init = () => {

bigcommerce.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Plugin Name: BigCommerce for WordPress
44
Description: Scale your ecommerce business with WordPress on the front-end and BigCommerce on the back end. Free up server resources from things like catalog management, processing payments, and managing fulfillment logistics.
55
Author: BigCommerce
6-
Version: 3.20.0
6+
Version: 3.21.0
77
Author URI: https://www.bigcommerce.com/wordpress
88
Requires PHP: 5.6.24
99
Text Domain: bigcommerce

build-timestamp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?php
2-
define('BIGCOMMERCE_ASSETS_BUILD_TIMESTAMP', '4.30.06.05.2020');
2+
define('BIGCOMMERCE_ASSETS_BUILD_TIMESTAMP', '3.04.07.03.2020');

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: bigcommerce, moderntribe, jbrinley, becomevocal, vincentlistrani,
33
Tags: ecommerce, online store, sell online, storefront, retail, online shop, bigcommerce, big commerce, e-commerce, physical products, buy buttons, commerce, shopping cart, checkout, cart, shop, headless commerce, shipping, payments, fulfillment
44
Requires at least: 4.6
55
Tested up to: 5.3
6-
Stable tag: 3.20.0
6+
Stable tag: 3.21.0
77
Requires PHP: 5.6.24
88
License: GPLv2 or later
99
License URI: https://www.gnu.org/licenses/gpl-2.0.html

src/BigCommerce/Assets/Admin/JS_Localization.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function get_data() {
3737
'sync' => [
3838
'success' => __( 'Products Successfully Synced', 'bigcommerce' ),
3939
'error' => __( 'There was an error syncing your products. Please try to import again. If the error persists, please contact support.', 'bigcommerce' ),
40-
'timeout' => __( 'The server is taking longer than expected to respond. We’ll keep trying, but it may take a few minutes to get things moving again. If the problem persists, try reducing the batch size in the Product Sync settings panel.', 'bigcommerce' ),
40+
'timeout' => __( "The server is taking longer than expected to respond. We’ll keep trying, so don't worry. If the problem persists, try reducing the batch size in the Product Sync settings panel.", 'bigcommerce' ),
4141
'server_error' => __( 'The server sent an unexpected response. We’ll keep trying, but it may take a few minutes to get things moving again. If the problem persists, try turning on error logging in the Diagnostics settings panel.', 'bigcommerce' ),
4242
'unauthorized' => __( 'An error occurred while validating your request. Please refresh the page and try again.', 'bigcommerce' ),
4343
],

src/BigCommerce/Assets/Theme/Scripts.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
namespace BigCommerce\Assets\Theme;
55

66

7+
use BigCommerce\Pages\Checkout_Page;
8+
79
class Scripts {
810
/**
911
* @var string Path to the plugin assets directory
@@ -48,6 +50,10 @@ public function enqueue_scripts() {
4850
$vendor_src = $this->directory . 'js/dist/' . $vendor_scripts;
4951
$plugin_src = $this->directory . 'js/dist/' . $plugin_scripts;
5052

53+
if ( is_page( get_option( Checkout_Page::NAME, 0 ) ) ) {
54+
wp_enqueue_script( 'bigcommerce-checkout-sdk', 'https://checkout-sdk.bigcommerce.com/v1/loader.js', [], $this->version, true );
55+
}
56+
5157
wp_register_script( 'bigcommerce-manifest', $manifest_src, [], $this->version, true );
5258
wp_register_script( 'bigcommerce-vendors', $vendor_src, [ 'bigcommerce-manifest', 'jquery' ], $this->version, true );
5359
wp_register_script( 'bigcommerce-scripts', $plugin_src, [ 'bigcommerce-vendors' ], $this->version, true );
@@ -57,4 +63,4 @@ public function enqueue_scripts() {
5763

5864
wp_enqueue_script( 'bigcommerce-scripts' );
5965
}
60-
}
66+
}

src/BigCommerce/Container/Settings.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
use BigCommerce\Settings\Sections\Reviews;
3939
use BigCommerce\Settings\Sections\Troubleshooting_Diagnostics;
4040
use BigCommerce\Settings\Site_Update;
41+
use BigCommerce\Settings\Site_URL_Sync;
4142
use BigCommerce\Settings\Start_Over;
4243
use BigCommerce\Taxonomies\Channel\Channel;
4344
use Pimple\Container;
@@ -77,6 +78,7 @@ class Settings extends Provider {
7778
const IMPORT_LIVE_STATUS = 'settings.import_status_live';
7879
const START_OVER = 'settings.start_over';
7980
const ONBOARDING_PROGRESS = 'settings.onboarding.progress_bar';
81+
const SITE_URL_SYNC = 'settings.site_url_sync';
8082

8183
const CONFIG_STATUS = 'settings.configuration_status';
8284
const CONFIG_DISPLAY_MENUS = 'settings.configuration_display_menus';
@@ -629,6 +631,10 @@ private function diagnostics( Container $container ) {
629631
$plugin_path = plugin_dir_path( $container['plugin_file'] );
630632
return new Troubleshooting_Diagnostics( $plugin_path );
631633
};
634+
635+
$container[ self::SITE_URL_SYNC ] = function ( Container $container ) {
636+
return new Site_URL_Sync( $container[ Taxonomies::ROUTES ] , $container[ self::SETTINGS_SCREEN ] );
637+
};
632638

633639
add_action( 'bigcommerce/settings/register/screen=' . Settings_Screen::NAME, $this->create_callback( 'diagnostics_settings_register', function () use ( $container ) {
634640
$container[ self::DIAGNOSTICS_SECTION ]->register_settings_section();
@@ -641,7 +647,10 @@ private function diagnostics( Container $container ) {
641647
add_action( 'wp_ajax_' . Troubleshooting_Diagnostics::AJAX_ACTION_IMPORT_ERRORS, $this->create_callback( 'diagnostics_settings_import_errors_action', function () use ( $container ) {
642648
$container[ self::DIAGNOSTICS_SECTION ]->get_import_errors( $container[ Log::LOGGER ] );
643649
} ), 10, 0 );
644-
650+
651+
add_action( 'admin_post_' . Troubleshooting_Diagnostics::SYNC_SITE_URL, $this->create_callback( 'diagnostics_settings_sync_site_url_action', function () use ( $container ) {
652+
$container[ self::SITE_URL_SYNC ]->sync();
653+
} ), 10, 0 );
645654
}
646655

647656
private function resources( Container $container ) {

src/BigCommerce/Import/Import_Strategy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace BigCommerce\Import;
44

55
interface Import_Strategy {
6-
const VERSION = '3.19.0';
6+
const VERSION = '3.21.0';
77

88
/**
99
* @return int The imported post ID

src/BigCommerce/Import/Importers/Terms/Term_Updater.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ protected function save_wp_term( \ArrayAccess $bc_term ) {
2424

2525
protected function save_wp_termmeta( \ArrayAccess $bc_term ) {
2626
update_term_meta( $this->term_id, 'bigcommerce_id', $bc_term[ 'id' ] );
27+
update_term_meta( $this->term_id, 'sort_order', $bc_term[ 'sort_order' ] );
2728
}
2829

2930
}

src/BigCommerce/Import/Runner/Cron_Runner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function ajax_continue_import() {
7676
// cron can continue to run if the user leaves the page and the Ajax
7777
// requests stop coming.
7878
} catch ( \Exception $e ) {
79-
$message = __( 'The server sent an unexpected response. We’ll keep trying, but it may take a few minutes to get things moving again. If the problem persists, try turning on error logging in the Diagnostics settings panel.', 'bigcommerce' );
79+
$message = __( 'The server sent an unexpected response. We’ll keep trying, so dont’t worry. If the problem persists, try turning on error logging in the Diagnostics settings panel.', 'bigcommerce' );
8080
if ( WP_DEBUG && $e->getMessage() ) {
8181
$message .= ' ' . sprintf( __( 'Error message: %s', 'bigcommerce' ), $e->getMessage() );
8282
}

src/BigCommerce/Nav_Menu/Dynamic_Menu_Items.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,17 @@ private function get_menu_item_children( $item ) {
7272
}
7373
$terms = get_terms( [
7474
'taxonomy' => $taxonomy->name,
75-
'orderby' => 'name',
76-
'order' => 'ASC',
7775
'hide_empty' => true,
7876
'hierarchical' => true,
7977
'parent' => 0,
78+
'meta_query' => [
79+
[
80+
'key' => 'sort_order',
81+
'type' => 'NUMERIC',
82+
]
83+
],
84+
'orderby' => 'sort_order',
85+
'order' => 'ASC',
8086
] );
8187
$index = 1;
8288
$items = array_map( function ( $term ) use ( $item, &$index ) {

src/BigCommerce/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace BigCommerce;
55

66
class Plugin {
7-
const VERSION = '3.20.0';
7+
const VERSION = '3.21.0';
88

99
protected static $_instance;
1010

src/BigCommerce/Post_Types/Product/Query.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function filter_queries( \WP_Query $query ) {
5656
break;
5757
case Product_Archive::SORT_FEATURED:
5858
// Product 'featured' tag in BC store has no effect on sorting
59-
$query->set( 'orderby', [ 'menu_order' => 'ASC', 'title' => 'ASC', 'date' => 'DESC' ] );
59+
$query->set( 'orderby', [ 'menu_order' => 'ASC', 'date' => 'DESC', 'title' => 'ASC' ] );
6060
break;
6161
case Product_Archive::SORT_PRICE_ASC:
6262
$meta_query = $query->get( 'meta_query' ) ?: [];
@@ -96,9 +96,16 @@ public function filter_queries( \WP_Query $query ) {
9696
$meta_query['bigcommerce_sales'] = [
9797
'key' => Product::SALES_META_KEY,
9898
'compare' => 'EXISTS',
99+
'type' => 'NUMERIC'
99100
];
101+
102+
$meta_query['bigcommerce_id'] = [
103+
'key' => Product::BIGCOMMERCE_ID,
104+
'type' => 'NUMERIC'
105+
];
106+
100107
$query->set( 'meta_query', $meta_query );
101-
$query->set( 'orderby', [ 'bigcommerce_sales' => 'DESC', 'title' => 'ASC' ] );
108+
$query->set( 'orderby', [ 'bigcommerce_sales' => 'DESC', 'bigcommerce_id' => 'DESC' ] );
102109
break;
103110
case 'bigcommerce_id__in':
104111
$meta_query = $query->get( 'meta_query' ) ?: [];

src/BigCommerce/Settings/Sections/Troubleshooting_Diagnostics.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class Troubleshooting_Diagnostics extends Settings_Section {
2727
const DIAGNOSTICS_NAME = 'bigcommerce_diagnostics_name';
2828
const TEXTBOX_NAME = 'bigcommerce_diagnostics_output';
2929
const LOG_ERRORS = 'bigcommerce_diagnostics_log_import_errors';
30+
const SYNC_SITE_URL = 'bigcommerce_diagnostics_sync_site_url';
3031

3132
const AJAX_ACTION = 'bigcommerce_support_data';
3233
const AJAX_ACTION_IMPORT_ERRORS = 'bigcommerce_import_errors_log';
@@ -55,11 +56,25 @@ public function register_settings_section() {
5556
Settings_Screen::NAME
5657
);
5758

59+
add_settings_field(
60+
self::SYNC_SITE_URL,
61+
esc_html( __( 'Sync Site URL', 'bigcommerce' ) ),
62+
[ $this, 'render_sync_site_url', ],
63+
Settings_Screen::NAME,
64+
self::NAME,
65+
[
66+
'type' => 'checkbox',
67+
'option' => self::SYNC_SITE_URL,
68+
'label' => __( 'Sync Site URL', 'bigcommerce' ),
69+
'description' => __( 'Manually sync site URL with BigCommerce.', 'bigcommerce' ),
70+
]
71+
);
72+
5873
register_setting(
5974
Settings_Screen::NAME,
6075
self::LOG_ERRORS
6176
);
62-
77+
6378
add_settings_field(
6479
self::LOG_ERRORS,
6580
esc_html( __( 'Log import errors', 'bigcommerce' ) ),
@@ -91,6 +106,12 @@ public function register_settings_section() {
91106

92107
}
93108

109+
public function render_sync_site_url( $args ) {
110+
$url = add_query_arg( [ 'action' => self::SYNC_SITE_URL, '_wpnonce' => wp_create_nonce( self::SYNC_SITE_URL ) ], admin_url( 'admin-post.php' ) );
111+
$link = sprintf( '<a href="%s" class="bc-admin-btn">%s</a>', esc_url( $url ), esc_attr( $args[ 'label' ] ) );
112+
printf( '%s<p class="description">%s</p>', $link, esc_html__( $args[ 'description' ], 'bigcommerce' ) );
113+
}
114+
94115
/**
95116
* @param array $args
96117
*/
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace BigCommerce\Settings;
4+
5+
6+
class Site_URL_Sync {
7+
8+
protected $routes;
9+
protected $screen_settings;
10+
11+
public function __construct( $routes, $screen_settings ) {
12+
$this->routes = $routes;
13+
$this->screen_settings = $screen_settings;
14+
}
15+
16+
public function sync() {
17+
$submission = filter_var_array( $_GET, [
18+
'_wpnonce' => FILTER_SANITIZE_STRING,
19+
] );
20+
21+
if ( empty( $submission['_wpnonce'] ) || ! wp_verify_nonce( $submission['_wpnonce'], Sections\Troubleshooting_Diagnostics::SYNC_SITE_URL ) ) {
22+
throw new \InvalidArgumentException( __( 'Invalid request. Please try again.', 'bigcommerce' ), 403 );
23+
}
24+
25+
$this->routes->update_site_home();
26+
27+
wp_safe_redirect( esc_url_raw( $this->screen_settings->get_url() ), 303 );
28+
exit();
29+
}
30+
}

vendor/autoload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
require_once __DIR__ . '/composer/autoload_real.php';
66

7-
return ComposerAutoloaderInit39b28582cfaf12bb36d8163a54330ec4::getLoader();
7+
return ComposerAutoloaderInit78ffef7991759664bfd69220bf9a5197::getLoader();

vendor/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@
599599
'BigCommerce\\Settings\\Sections\\Webhooks' => $baseDir . '/src/BigCommerce/Settings/Sections/Webhooks.php',
600600
'BigCommerce\\Settings\\Sections\\Wishlists' => $baseDir . '/src/BigCommerce/Settings/Sections/Wishlists.php',
601601
'BigCommerce\\Settings\\Sections\\WithPages' => $baseDir . '/src/BigCommerce/Settings/Sections/WithPages.php',
602+
'BigCommerce\\Settings\\Site_URL_Sync' => $baseDir . '/src/BigCommerce/Settings/Site_URL_Sync.php',
602603
'BigCommerce\\Settings\\Start_Over' => $baseDir . '/src/BigCommerce/Settings/Start_Over.php',
603604
'BigCommerce\\Shortcodes\\Account_Profile' => $baseDir . '/src/BigCommerce/Shortcodes/Account_Profile.php',
604605
'BigCommerce\\Shortcodes\\Address_List' => $baseDir . '/src/BigCommerce/Shortcodes/Address_List.php',

vendor/composer/autoload_real.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// autoload_real.php @generated by Composer
44

5-
class ComposerAutoloaderInit39b28582cfaf12bb36d8163a54330ec4
5+
class ComposerAutoloaderInit78ffef7991759664bfd69220bf9a5197
66
{
77
private static $loader;
88

@@ -19,15 +19,15 @@ public static function getLoader()
1919
return self::$loader;
2020
}
2121

22-
spl_autoload_register(array('ComposerAutoloaderInit39b28582cfaf12bb36d8163a54330ec4', 'loadClassLoader'), true, true);
22+
spl_autoload_register(array('ComposerAutoloaderInit78ffef7991759664bfd69220bf9a5197', 'loadClassLoader'), true, true);
2323
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24-
spl_autoload_unregister(array('ComposerAutoloaderInit39b28582cfaf12bb36d8163a54330ec4', 'loadClassLoader'));
24+
spl_autoload_unregister(array('ComposerAutoloaderInit78ffef7991759664bfd69220bf9a5197', 'loadClassLoader'));
2525

2626
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
2727
if ($useStaticLoader) {
2828
require_once __DIR__ . '/autoload_static.php';
2929

30-
call_user_func(\Composer\Autoload\ComposerStaticInit39b28582cfaf12bb36d8163a54330ec4::getInitializer($loader));
30+
call_user_func(\Composer\Autoload\ComposerStaticInit78ffef7991759664bfd69220bf9a5197::getInitializer($loader));
3131
} else {
3232
$classMap = require __DIR__ . '/autoload_classmap.php';
3333
if ($classMap) {
@@ -39,19 +39,19 @@ public static function getLoader()
3939
$loader->register(true);
4040

4141
if ($useStaticLoader) {
42-
$includeFiles = Composer\Autoload\ComposerStaticInit39b28582cfaf12bb36d8163a54330ec4::$files;
42+
$includeFiles = Composer\Autoload\ComposerStaticInit78ffef7991759664bfd69220bf9a5197::$files;
4343
} else {
4444
$includeFiles = require __DIR__ . '/autoload_files.php';
4545
}
4646
foreach ($includeFiles as $fileIdentifier => $file) {
47-
composerRequire39b28582cfaf12bb36d8163a54330ec4($fileIdentifier, $file);
47+
composerRequire78ffef7991759664bfd69220bf9a5197($fileIdentifier, $file);
4848
}
4949

5050
return $loader;
5151
}
5252
}
5353

54-
function composerRequire39b28582cfaf12bb36d8163a54330ec4($fileIdentifier, $file)
54+
function composerRequire78ffef7991759664bfd69220bf9a5197($fileIdentifier, $file)
5555
{
5656
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
5757
require $file;

0 commit comments

Comments
 (0)