Skip to content

Commit

Permalink
Merge pull request #14 from BeAPI/fix/brand
Browse files Browse the repository at this point in the history
Fix/brand
  • Loading branch information
petitphp authored Sep 11, 2024
2 parents 06d84f7 + 583f2f6 commit a724259
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Admin/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function () {
?>
<input type="hidden" name="action" value="sfa_migrate">
<?php
if ( 'pending' !== $migration['status'] && 'in-progress' !== $migration['status'] ) {
if ( ! isset( $migration['status'] ) || ! in_array( $migration['status'], [ 'pending', 'in-progress' ], true ) ) {
submit_button( __( 'Migrate Old Data', 'shopping-feed-advanced' ) );
}
?>
Expand Down
14 changes: 7 additions & 7 deletions src/Admin/Orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
8 changes: 2 additions & 6 deletions src/Admin/Taxonomies.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -59,5 +56,4 @@ public function add_brand() {
}
register_taxonomy( self::BRAND_TAXONOMY_SLUG, array( 'product' ), $args );
}

}

0 comments on commit a724259

Please sign in to comment.