From b33105724f2b27ef8a69d9219065d169d7514ecf Mon Sep 17 00:00:00 2001 From: Clement Boirie Date: Fri, 6 Sep 2024 22:08:25 +0200 Subject: [PATCH 1/3] fix(brand): brand taxonomy registration callback not called --- src/Admin/Taxonomies.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Admin/Taxonomies.php b/src/Admin/Taxonomies.php index 75212f3..0294d58 100644 --- a/src/Admin/Taxonomies.php +++ b/src/Admin/Taxonomies.php @@ -10,12 +10,9 @@ class Taxonomies { const BRAND_TAXONOMY_SLUG = 'product_brand'; public function __construct() { - - add_action( 'init', array( $this, 'add_brand' ) ); - + add_action( 'init', array( $this, 'add_brand' ), 50 ); } - public function add_brand() { if ( empty( ShoppingFeedAdvancedHelper::get_sfa_settings( BRAND_FIELD_SLUG ) ) ) { return; @@ -48,7 +45,7 @@ public function add_brand() { 'hierarchical' => false, 'public' => true, 'show_ui' => true, - 'show_admin_column' => false, + 'show_admin_column' => true, 'show_in_nav_menus' => false, 'show_tagcloud' => false, 'meta_box_cb' => false, @@ -59,5 +56,4 @@ public function add_brand() { } register_taxonomy( self::BRAND_TAXONOMY_SLUG, array( 'product' ), $args ); } - } From 1cac7d7327f33497b8d5da754c2122f7b68b65dc Mon Sep 17 00:00:00 2001 From: Clement Boirie Date: Fri, 6 Sep 2024 22:26:24 +0200 Subject: [PATCH 2/3] fix: fatal error that could occur when Woocommerce is using the new HPOS mode --- src/Admin/Orders.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Admin/Orders.php b/src/Admin/Orders.php index e13e70f..75d6bcf 100644 --- a/src/Admin/Orders.php +++ b/src/Admin/Orders.php @@ -17,21 +17,21 @@ class Orders { private $sf_reference_meta; public function __construct() { + add_action( 'admin_init', array( $this, 'register_columns' ) ); + $this->channel_name_meta = Query::WC_META_SF_CHANNEL_NAME; + $this->sf_reference_meta = Query::WC_META_SF_REFERENCE; + } + + public function register_columns() { if ( class_exists( 'Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController' ) && \wc_get_container()->get( CustomOrdersTableController::class )->custom_orders_table_usage_is_enabled() ) { $screen = \wc_get_page_screen_id( 'shop_order' ); add_filter( "manage_{$screen}_columns", [ $this, 'custom_shop_order_column' ] ); add_action( "manage_{$screen}_custom_column", [ $this, 'custom_orders_list_column_content' ], 10, 2 ); } else { add_filter( 'manage_edit-shop_order_columns', [ $this, 'custom_shop_order_column' ] ); - add_action( 'manage_shop_order_posts_custom_column', [ - $this, - 'custom_orders_list_column_content', - ], 10, 2 ); + add_action( 'manage_shop_order_posts_custom_column', [ $this, 'custom_orders_list_column_content' ], 10, 2 ); } - - $this->channel_name_meta = Query::WC_META_SF_CHANNEL_NAME; - $this->sf_reference_meta = Query::WC_META_SF_REFERENCE; } public function custom_shop_order_column( $columns ) { From 583f2f6075b6ec7e06eee92b77618282b5cbff72 Mon Sep 17 00:00:00 2001 From: Clement Boirie Date: Fri, 6 Sep 2024 22:28:02 +0200 Subject: [PATCH 3/3] fix: PHP warning in admin option page --- src/Admin/Options.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Admin/Options.php b/src/Admin/Options.php index fe1fdbe..c1b10dd 100644 --- a/src/Admin/Options.php +++ b/src/Admin/Options.php @@ -118,7 +118,7 @@ function () { ?>