diff --git a/CHANGELOG.md b/CHANGELOG.md index 492e0ed2..59da2291 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [5.0.4] + +### Fixed +- Fix import stuck problem on step 6 - Updating Brands + ## [5.0.3] ### Fixed @@ -1894,6 +1899,7 @@ in fact, reset postdata, so far as Gutenberg 3.2.0 is concerned. +[5.0.4]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/5.0.3...5.0.4 [5.0.3]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/5.0.2...5.0.3 [5.0.2]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/5.0.1...5.0.2 [5.0.1]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/5.0.0...5.0.1 diff --git a/bigcommerce.php b/bigcommerce.php index cd0c731c..825568f4 100644 --- a/bigcommerce.php +++ b/bigcommerce.php @@ -3,7 +3,7 @@ Plugin Name: BigCommerce for WordPress 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. Author: BigCommerce -Version: 5.0.3 +Version: 5.0.4 Author URI: https://www.bigcommerce.com/wordpress Requires PHP: 7.4.0 Text Domain: bigcommerce diff --git a/build-timestamp.php b/build-timestamp.php index b9d819d6..edaec32b 100644 --- a/build-timestamp.php +++ b/build-timestamp.php @@ -1,2 +1,2 @@ get_source_data( $response ); + return $this->get_source_data( $response ); } return array_merge( $response, $this->get_option( self::BRANDS_CHECKPOINT, [] ) ); @@ -77,9 +77,9 @@ protected function get_fallback_terms() { return $this->batch; } catch ( \Throwable $e ) { - do_action( 'bigcommerce/import/error', $e->getMessage(), [ - 'response' => $e->getResponseBody(), - 'headers' => $e->getResponseHeaders(), + do_action( 'bigcommerce/log', Error_Log::DEBUG, $e->getMessage(), [ + 'response' => method_exists( $e, 'getResponseBody' ) ? $e->getResponseBody() : $e->getTraceAsString(), + 'headers' => method_exists( $e, 'getResponseHeaders' ) ? $e->getResponseHeaders() : '', ] ); do_action( 'bigcommerce/log', Error_Log::DEBUG, $e->getTraceAsString(), [] ); diff --git a/src/BigCommerce/Import/Processors/Term_Import.php b/src/BigCommerce/Import/Processors/Term_Import.php index 4e7b35e4..e54d593d 100644 --- a/src/BigCommerce/Import/Processors/Term_Import.php +++ b/src/BigCommerce/Import/Processors/Term_Import.php @@ -11,6 +11,7 @@ use BigCommerce\Import\Runner\Status; use BigCommerce\Logging\Error_Log; use BigCommerce\Taxonomies\Brand\Brand; +use BigCommerce\Taxonomies\Product_Category\Product_Category; abstract class Term_Import implements Import_Processor { use No_Cache_Options; @@ -76,22 +77,27 @@ public function run() { try { $terms = $this->get_source_data(); + // Fallback to old categories pull + if ( empty( $terms ) && $this->taxonomy() === Product_Category::NAME ) { + $terms = $this->get_fallback_terms(); + $rest_fallback = true; + } } catch ( \Throwable $e ) { - do_action( 'bigcommerce/log', $e->getMessage(), [ - 'response' => $e->getResponseBody(), - 'headers' => $e->getResponseHeaders(), + do_action( 'bigcommerce/log', Error_Log::DEBUG, $e->getMessage(), [ + 'response' => method_exists( $e, 'getResponseBody' ) ? $e->getResponseBody() : $e->getTraceAsString(), + 'headers' => method_exists( $e, 'getResponseHeaders' ) ? $e->getResponseHeaders() : '', ] ); $terms = $this->get_fallback_terms(); $rest_fallback = true; + } - if ( empty( $terms ) ) { - do_action( 'bigcommerce/log', Error_Log::DEBUG, sprintf( __( 'Could not find terms for %s. Wrapping up step and go to the next one', 'bigcommerce' ), $this->taxonomy() ), [] ); - $status->set_status( $this->completed_state() ); - $this->clear_state(); + if ( empty( $terms ) ) { + do_action( 'bigcommerce/log', Error_Log::DEBUG, sprintf( __( 'Could not find terms for %s. Wrapping up step and go to the next one', 'bigcommerce' ), $this->taxonomy() ), [] ); + $status->set_status( $this->completed_state() ); + $this->clear_state(); - return; - } + return; } // Allow more HTML in term descriptions than WP default diff --git a/src/BigCommerce/Plugin.php b/src/BigCommerce/Plugin.php index 1759c4b2..b8231865 100644 --- a/src/BigCommerce/Plugin.php +++ b/src/BigCommerce/Plugin.php @@ -4,7 +4,7 @@ namespace BigCommerce; class Plugin { - const VERSION = '5.0.3'; + const VERSION = '5.0.4'; protected static $_instance;