Skip to content

Commit c7eaeca

Browse files
authored
packaged version 4.9.0 (#260)
1 parent d100587 commit c7eaeca

35 files changed

+636
-149
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [4.9.0]
4+
5+
### Added
6+
- Added support for Product Category images
7+
- Added additional error message when attempting to create a channel with an existing name
8+
9+
310
## [4.8.0]
411

512
### Fixed
@@ -1364,6 +1371,7 @@
13641371
in fact, reset postdata, so far as Gutenberg 3.2.0 is concerned.
13651372

13661373

1374+
[4.9.0]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/4.8.0...4.9.0
13671375
[4.8.0]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/4.7.0...4.8.0
13681376
[4.7.0]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/4.6.0...4.7.0
13691377
[4.6.0]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/4.5.0...4.6.0

assets/css/master.css

+7-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/master.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/pcss/content/loop/_products.pcss

+7
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,10 @@
88
padding: 0 30px;
99
}
1010
}
11+
12+
.attachment-bc-category-image {
13+
display: block;
14+
max-width: 100%;
15+
height: auto;
16+
margin: 0.5em 0 1em;
17+
}

bigcommerce.php

+1-1
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: 4.8.0
6+
Version: 4.9.0
77
Author URI: https://www.bigcommerce.com/wordpress
88
Requires PHP: 7.2.0
99
Text Domain: bigcommerce

build-timestamp.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?php
2-
define('BIGCOMMERCE_ASSETS_BUILD_TIMESTAMP', '5.54.02.05.2021');
2+
define('BIGCOMMERCE_ASSETS_BUILD_TIMESTAMP', '3.59.03.19.2021');

readme.txt

+1-1
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: 5.2
55
Tested up to: 5.5
6-
Stable tag: 4.8.0
6+
Stable tag: 4.9.0
77
Requires PHP: 7.2.0
88
License: GPLv2 or later
99
License URI: https://www.gnu.org/licenses/gpl-2.0.html

src/BigCommerce/Assets/Theme/Image_Sizes.php

+12-6
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ class Image_Sizes {
88
const VERSION = 2;
99
const STATE_META = 'bigcommerce_sizing';
1010

11-
const BC_THUMB = 'bc-thumb';
12-
const BC_THUMB_LARGE = 'bc-thumb-large';
13-
const BC_SMALL = 'bc-small';
14-
const BC_MEDIUM = 'bc-medium';
15-
const BC_EXTRA_MEDIUM = 'bc-xmedium';
16-
const BC_LARGE = 'bc-large';
11+
const BC_THUMB = 'bc-thumb';
12+
const BC_THUMB_LARGE = 'bc-thumb-large';
13+
const BC_SMALL = 'bc-small';
14+
const BC_MEDIUM = 'bc-medium';
15+
const BC_EXTRA_MEDIUM = 'bc-xmedium';
16+
const BC_LARGE = 'bc-large';
17+
const BC_CATEGORY_IMAGE = 'bc-category-image';
1718

1819
// Increment self::VERSION above when adding/changing this list
1920
private $sizes = [
@@ -47,6 +48,11 @@ class Image_Sizes {
4748
'height' => 1280,
4849
'crop' => true,
4950
],
51+
self::BC_CATEGORY_IMAGE => [
52+
'width' => 1600,
53+
'height' => 0,
54+
'crop' => false,
55+
],
5056
];
5157

5258
/**

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

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ protected function save_wp_term( \ArrayAccess $bc_term ) {
2222

2323
protected function save_wp_termmeta( \ArrayAccess $bc_term ) {
2424
update_term_meta( $this->term_id, 'bigcommerce_id', $bc_term[ 'id' ] );
25+
update_term_meta( $this->term_id, 'sort_order', $bc_term[ 'sort_order' ] );
2526
}
2627

2728
}

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

+32
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace BigCommerce\Import\Importers\Terms;
55

66
use BigCommerce\Import\Import_Strategy;
7+
use BigCommerce\Import\Image_Importer;
78

89
abstract class Term_Saver implements Import_Strategy {
910
/** @var \ArrayAccess */
@@ -29,6 +30,7 @@ public function __construct( \ArrayAccess $bc_term, $taxonomy, $term_id = 0 ) {
2930
public function do_import() {
3031
$this->term_id = $this->save_wp_term( $this->bc_term );
3132
$this->save_wp_termmeta( $this->bc_term );
33+
$this->import_image( $this->bc_term );
3234

3335
return $this->term_id;
3436
}
@@ -143,4 +145,34 @@ protected function determine_parent_term_id( \ArrayAccess $bc_term ) {
143145

144146
return 0;
145147
}
148+
149+
protected function import_image( \ArrayAccess $bc_term ) {
150+
$image_url = $bc_term[ 'image_url' ];
151+
152+
// find an existing image
153+
$existing = get_posts( [
154+
'post_type' => 'attachment',
155+
'meta_query' => [
156+
[
157+
'key' => Image_Importer::SOURCE_URL,
158+
'value' => $image_url,
159+
'compare' => '=',
160+
],
161+
],
162+
'fields' => 'ids',
163+
'posts_per_page' => 1,
164+
] );
165+
166+
if ( ! empty( $existing ) ) {
167+
$post_id = reset( $existing );
168+
} else {
169+
$importer = new Image_Importer( $image_url );
170+
$post_id = $importer->import();
171+
}
172+
if ( ! empty( $post_id ) ) {
173+
update_term_meta( $this->term_id, 'thumbnail_id', $post_id );
174+
} else {
175+
delete_term_meta( $this->term_id, 'thumbnail_id' );
176+
}
177+
}
146178
}

src/BigCommerce/Plugin.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace BigCommerce;
55

66
class Plugin {
7-
const VERSION = '4.8.0';
7+
const VERSION = '4.9.0';
88

99
protected static $_instance;
1010

src/BigCommerce/Taxonomies/Channel/Channel_Connector.php

+4
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ private function create_channel( $name ) {
8383
try {
8484
$response = $this->channels->createChannel( $request );
8585
} catch ( ApiException $e ) {
86+
$resp_body = $e->getResponseBody();
87+
if ( ! empty( $resp_body->title ) ) {
88+
add_settings_error( Channel_Select::NEW_CHANNEL, 'api_channel_error', $resp_body->title );
89+
}
8690
do_action( 'bigcommerce/channel/error/could_not_create_channel', $e, $request );
8791

8892
return 0;

src/BigCommerce/Templates/Product_Archive.php

+36-11
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,38 @@
33

44
namespace BigCommerce\Templates;
55

6-
76
use BigCommerce\Customizer;
87
use BigCommerce\Post_Types\Product\Product;
98
use BigCommerce\Taxonomies\Brand\Brand;
109
use BigCommerce\Taxonomies\Product_Category\Product_Category;
1110
use BigCommerce\Settings\Sections\Api_Credentials;
11+
use BigCommerce\Assets\Theme\Image_Sizes;
1212

1313
class Product_Archive extends Controller {
1414
const QUERY = 'query';
1515

16-
const POSTS = 'posts';
17-
const NO_RESULTS = 'no_results';
18-
const TITLE = 'title';
19-
const DESCRIPTION = 'description';
20-
const REFINERY = 'refinery';
21-
const PAGINATION = 'pagination';
22-
const COLUMNS = 'columns';
16+
const POSTS = 'posts';
17+
const NO_RESULTS = 'no_results';
18+
const TITLE = 'title';
19+
const DESCRIPTION = 'description';
20+
const THUMBNAIL = 'thumbnail';
21+
const THUMBNAIL_SIZE = 'thumbnail';
22+
const REFINERY = 'refinery';
23+
const PAGINATION = 'pagination';
24+
const COLUMNS = 'columns';
2325

2426
protected $template = 'components/catalog/product-archive.php';
2527

2628
protected function parse_options( array $options ) {
2729
$defaults = [
28-
self::QUERY => null, // \WP_Query
29-
self::COLUMNS => absint( get_option( Customizer\Sections\Product_Archive::GRID_COLUMNS, 4 ) ),
30+
self::QUERY => null, // \WP_Query
31+
self::COLUMNS => absint( get_option( Customizer\Sections\Product_Archive::GRID_COLUMNS, 4 ) ),
32+
/**
33+
* Filter the thumbnail size
34+
*
35+
* @param string $size The image size to use
36+
*/
37+
self::THUMBNAIL_SIZE => apply_filters( 'bigcommerce/template/product_archive/thumbnail_size', Image_Sizes::BC_CATEGORY_IMAGE ),
3038
];
3139

3240
return wp_parse_args( $options, $defaults );
@@ -40,6 +48,7 @@ public function get_data() {
4048
self::POSTS => $this->get_posts( $query ),
4149
self::TITLE => $this->get_title( $query ),
4250
self::DESCRIPTION => $this->get_description(),
51+
self::THUMBNAIL => $this->get_thumbnail(),
4352
self::REFINERY => $this->get_refinery( $query ),
4453
self::PAGINATION => $this->get_pagination( $query ),
4554
self::COLUMNS => $this->options[ self::COLUMNS ],
@@ -98,6 +107,22 @@ private function get_description() {
98107
return $description;
99108
}
100109

110+
private function get_thumbnail() {
111+
$term = get_queried_object();
112+
113+
if ( ! is_a( $term, 'WP_Term' ) ) {
114+
return '';
115+
}
116+
117+
$attachment_id = get_term_meta( $term->term_id, 'thumbnail_id', true );
118+
119+
if ( $attachment_id ) {
120+
return wp_get_attachment_image( $attachment_id, $this->options[ self::THUMBNAIL_SIZE ] );
121+
}
122+
123+
return '';
124+
}
125+
101126
private function get_refinery( \WP_Query $query ) {
102127
$component = Refinery::factory( [
103128
Refinery::QUERY => $query,
@@ -120,4 +145,4 @@ private function get_no_results() {
120145
return $component->render();
121146
}
122147

123-
}
148+
}

templates/public/components/catalog/product-archive.php

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* @var string $no_results
77
* @var string $title
88
* @var string $description
9+
* @var string $thumbnail
910
* @var string $refinery
1011
* @var string $pagination
1112
* @var string $columns
@@ -16,6 +17,7 @@
1617

1718
<header class="bc-product-archive__header">
1819
<h2 class="bc-product-archive__title"><?php echo esc_html( $title ); ?></h2>
20+
<?php echo wp_kses_post( $thumbnail ); ?>
1921
<div><?php echo wp_kses_post( $description ); ?></div>
2022
</header>
2123

vendor/autoload.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

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

7-
return ComposerAutoloaderInitef8b243e8bac21b00e6d48497c7050eb::getLoader();
7+
return ComposerAutoloaderInitf629a677b821c24e4ef358484fa6c69d::getLoader();

vendor/composer/autoload_classmap.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,7 @@
853853
'Dotenv\\Validator' => $vendorDir . '/vlucas/phpdotenv/src/Validator.php',
854854
'Firebase\\JWT\\BeforeValidException' => $vendorDir . '/firebase/php-jwt/src/BeforeValidException.php',
855855
'Firebase\\JWT\\ExpiredException' => $vendorDir . '/firebase/php-jwt/src/ExpiredException.php',
856+
'Firebase\\JWT\\JWK' => $vendorDir . '/firebase/php-jwt/src/JWK.php',
856857
'Firebase\\JWT\\JWT' => $vendorDir . '/firebase/php-jwt/src/JWT.php',
857858
'Firebase\\JWT\\SignatureInvalidException' => $vendorDir . '/firebase/php-jwt/src/SignatureInvalidException.php',
858859
'Monolog\\ErrorHandler' => $vendorDir . '/monolog/monolog/src/Monolog/ErrorHandler.php',
@@ -977,7 +978,7 @@
977978
'Psr\\Log\\LoggerInterface' => $vendorDir . '/psr/log/Psr/Log/LoggerInterface.php',
978979
'Psr\\Log\\LoggerTrait' => $vendorDir . '/psr/log/Psr/Log/LoggerTrait.php',
979980
'Psr\\Log\\NullLogger' => $vendorDir . '/psr/log/Psr/Log/NullLogger.php',
980-
'Psr\\Log\\Test\\DummyTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
981+
'Psr\\Log\\Test\\DummyTest' => $vendorDir . '/psr/log/Psr/Log/Test/DummyTest.php',
981982
'Psr\\Log\\Test\\LoggerInterfaceTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
982983
'Psr\\Log\\Test\\TestLogger' => $vendorDir . '/psr/log/Psr/Log/Test/TestLogger.php',
983984
);

vendor/composer/autoload_real.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// autoload_real.php @generated by Composer
44

5-
class ComposerAutoloaderInitef8b243e8bac21b00e6d48497c7050eb
5+
class ComposerAutoloaderInitf629a677b821c24e4ef358484fa6c69d
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('ComposerAutoloaderInitef8b243e8bac21b00e6d48497c7050eb', 'loadClassLoader'), true, true);
22+
spl_autoload_register(array('ComposerAutoloaderInitf629a677b821c24e4ef358484fa6c69d', 'loadClassLoader'), true, true);
2323
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24-
spl_autoload_unregister(array('ComposerAutoloaderInitef8b243e8bac21b00e6d48497c7050eb', 'loadClassLoader'));
24+
spl_autoload_unregister(array('ComposerAutoloaderInitf629a677b821c24e4ef358484fa6c69d', '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\ComposerStaticInitef8b243e8bac21b00e6d48497c7050eb::getInitializer($loader));
30+
call_user_func(\Composer\Autoload\ComposerStaticInitf629a677b821c24e4ef358484fa6c69d::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\ComposerStaticInitef8b243e8bac21b00e6d48497c7050eb::$files;
42+
$includeFiles = Composer\Autoload\ComposerStaticInitf629a677b821c24e4ef358484fa6c69d::$files;
4343
} else {
4444
$includeFiles = require __DIR__ . '/autoload_files.php';
4545
}
4646
foreach ($includeFiles as $fileIdentifier => $file) {
47-
composerRequireef8b243e8bac21b00e6d48497c7050eb($fileIdentifier, $file);
47+
composerRequiref629a677b821c24e4ef358484fa6c69d($fileIdentifier, $file);
4848
}
4949

5050
return $loader;
5151
}
5252
}
5353

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

vendor/composer/autoload_static.php

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Composer\Autoload;
66

7-
class ComposerStaticInitef8b243e8bac21b00e6d48497c7050eb
7+
class ComposerStaticInitf629a677b821c24e4ef358484fa6c69d
88
{
99
public static $files = array (
1010
'5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php',
@@ -936,6 +936,7 @@ class ComposerStaticInitef8b243e8bac21b00e6d48497c7050eb
936936
'Dotenv\\Validator' => __DIR__ . '/..' . '/vlucas/phpdotenv/src/Validator.php',
937937
'Firebase\\JWT\\BeforeValidException' => __DIR__ . '/..' . '/firebase/php-jwt/src/BeforeValidException.php',
938938
'Firebase\\JWT\\ExpiredException' => __DIR__ . '/..' . '/firebase/php-jwt/src/ExpiredException.php',
939+
'Firebase\\JWT\\JWK' => __DIR__ . '/..' . '/firebase/php-jwt/src/JWK.php',
939940
'Firebase\\JWT\\JWT' => __DIR__ . '/..' . '/firebase/php-jwt/src/JWT.php',
940941
'Firebase\\JWT\\SignatureInvalidException' => __DIR__ . '/..' . '/firebase/php-jwt/src/SignatureInvalidException.php',
941942
'Monolog\\ErrorHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/ErrorHandler.php',
@@ -1060,18 +1061,18 @@ class ComposerStaticInitef8b243e8bac21b00e6d48497c7050eb
10601061
'Psr\\Log\\LoggerInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerInterface.php',
10611062
'Psr\\Log\\LoggerTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerTrait.php',
10621063
'Psr\\Log\\NullLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/NullLogger.php',
1063-
'Psr\\Log\\Test\\DummyTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
1064+
'Psr\\Log\\Test\\DummyTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/DummyTest.php',
10641065
'Psr\\Log\\Test\\LoggerInterfaceTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
10651066
'Psr\\Log\\Test\\TestLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/TestLogger.php',
10661067
);
10671068

10681069
public static function getInitializer(ClassLoader $loader)
10691070
{
10701071
return \Closure::bind(function () use ($loader) {
1071-
$loader->prefixLengthsPsr4 = ComposerStaticInitef8b243e8bac21b00e6d48497c7050eb::$prefixLengthsPsr4;
1072-
$loader->prefixDirsPsr4 = ComposerStaticInitef8b243e8bac21b00e6d48497c7050eb::$prefixDirsPsr4;
1073-
$loader->prefixesPsr0 = ComposerStaticInitef8b243e8bac21b00e6d48497c7050eb::$prefixesPsr0;
1074-
$loader->classMap = ComposerStaticInitef8b243e8bac21b00e6d48497c7050eb::$classMap;
1072+
$loader->prefixLengthsPsr4 = ComposerStaticInitf629a677b821c24e4ef358484fa6c69d::$prefixLengthsPsr4;
1073+
$loader->prefixDirsPsr4 = ComposerStaticInitf629a677b821c24e4ef358484fa6c69d::$prefixDirsPsr4;
1074+
$loader->prefixesPsr0 = ComposerStaticInitf629a677b821c24e4ef358484fa6c69d::$prefixesPsr0;
1075+
$loader->classMap = ComposerStaticInitf629a677b821c24e4ef358484fa6c69d::$classMap;
10751076

10761077
}, null, ClassLoader::class);
10771078
}

0 commit comments

Comments
 (0)