Skip to content

Add a checkbox to disable order import. Default is to enable for new … #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 25 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6abfd15
issue/74034 : wip
stephane-gillot Sep 13, 2024
3722746
add tests
stephane-gillot Sep 24, 2024
2f228e6
feat(shipment-tracking): add new shipment tracking code
petitphp Aug 12, 2024
d98324b
feat(shipment-tracking): refactor tracking data methods to use new code
petitphp Aug 12, 2024
48241df
feat(shipment-tracking): refactor shipment tracking options
petitphp Aug 12, 2024
4c22dfb
feat(shipment-tracking): remove old shipment tracking code
petitphp Aug 12, 2024
cd528d8
feat(shipment-tracking): update shipment tracking provider rewrite
petitphp Sep 16, 2024
c284075
feat(shipment-tracking): fix CS errors in src/Admin/Notices.php
petitphp Sep 25, 2024
3a1dce1
feat(shimpent-tracking): handle back-compat with ShoppingFeed Advance…
petitphp Sep 25, 2024
3b067ba
issue/74026 : add attribute to parent if not visible on variations
stephane-gillot Sep 25, 2024
4fcaf94
feat(shimpent-tracking): shipment tracking tests
petitphp Sep 25, 2024
ee4d5ae
issue/74026 : add tests for atributes
stephane-gillot Sep 26, 2024
8224cce
issue/74034 : add test for dimensions
stephane-gillot Oct 1, 2024
02083c5
issue/74034 : fix psalm
stephane-gillot Oct 1, 2024
a6525b1
fix cs issues
stephane-gillot Oct 1, 2024
05690ca
issue/74026 fix cs issue
stephane-gillot Oct 8, 2024
929cf3c
feat(shimpent-tracking): set tracking provider based on previous config
petitphp Nov 13, 2024
88c7b07
issue/74026 : rm comment
stephane-gillot Nov 26, 2024
4f3e570
Merge pull request #123 from BeAPI/issue/74026
stephane-gillot Nov 26, 2024
26b4467
Merge branch 'issue/74034' into fix-issue-74034
stephane-gillot Nov 29, 2024
76b6826
Merge pull request #125 from BeAPI/fix-issue-74034
stephane-gillot Nov 29, 2024
75c83cf
Merge pull request #119 from BeAPI/issue/72879
petitphp Dec 12, 2024
e4248ad
fix incorrect timestamp value when scheduling action
petitphp Oct 17, 2023
1ab14da
Merge pull request #92 from BeAPI/fix/cron-schedule
petitphp Dec 12, 2024
56fc0cc
Add a checkbox to disable order import. Default is to enable for new …
ecorica Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions shoppingfeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
define( 'SF_VERSION', '6.8.0' );
define( 'SF_DB_VERSION_SLUG', 'SF_DB_VERSION' );
define( 'SF_DB_VERSION', '1.0.0' );
define( 'SF_UPGRADE_VERSION', '6.9.0' );
define( 'SF_UPGRADE_RUNNING', 'SF_UPGRADE_RUNNING' );
define( 'SF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'SF_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
Expand Down
3 changes: 3 additions & 0 deletions src/Actions/Actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public static function register_feed_generation() {
* Register new action to get orders
*/
public static function register_get_orders() {
if ( ShoppingFeedHelper::is_disable_order_import() ) {
return;
}
$sf_accounts = ShoppingFeedHelper::get_sf_account_options();
if ( empty( $sf_accounts ) ) {
ShoppingFeedHelper::get_logger()->error(
Expand Down
12 changes: 0 additions & 12 deletions src/Addons/Addons.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,10 @@ class Addons {
*/
private $chained_products_plugin;

/**
* @var ASTPlugin
*/
private $ast_plugin;

/**
* @var PhWoocommerceShipmentTrackingProPlugin
*/
private $woocommerce_shipment_tracking_pro;

public function __construct() {
$this->shipping = new Shipping();
$this->inventory = new Inventory();
$this->marketplaces = new Marketplaces();
$this->chained_products_plugin = new ChainedProducts();
$this->ast_plugin = new ASTPlugin();
$this->woocommerce_shipment_tracking_pro = new PhWoocommerceShipmentTrackingProPlugin();
}
}
95 changes: 0 additions & 95 deletions src/Addons/Plugins/ASTPlugin/ASTPlugin.php

This file was deleted.

This file was deleted.

24 changes: 24 additions & 0 deletions src/Admin/Notices.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
class Notices {

public function __construct() {
add_action( 'admin_notices', array( $this, 'unavailable_selected_shipping_tracking_provider' ) );
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
}
Expand Down Expand Up @@ -66,4 +67,27 @@ public function display_notice() {
<?php
}

public function unavailable_selected_shipping_tracking_provider(): void {
$manager = ShoppingFeedHelper::wc_tracking_provider_manager();
$selected_provider = $manager->get_selected_provider( false );
if ( ! $selected_provider->is_available() ) {
?>
<div class="notice notice-error">
<p>
<span class="dashicons dashicons-warning"></span>
<?php
echo wp_kses_post(
sprintf(
// translators: 1: the provider name, 2: the plugin settings link
__( 'The selected shipment tracking provider <strong>"%1$s"</strong> is not available. Please go the <a href="%2$s">shipping settings</a> to choose a new one.', 'shopping-feed' ),
$selected_provider->name(),
add_query_arg( 'tab', 'shipping-settings', ShoppingFeedHelper::get_setting_link() )
)
);
?>
</p>
</div>
<?php
}
}
}
68 changes: 56 additions & 12 deletions src/Admin/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use ShoppingFeed\ShoppingFeedWC\Orders\Operations;
use ShoppingFeed\ShoppingFeedWC\Sdk\Sdk;
use ShoppingFeed\ShoppingFeedWC\Orders\Orders;
use ShoppingFeed\ShoppingFeedWC\ShipmentTracking\ShipmentTrackingManager;
use ShoppingFeed\ShoppingFeedWC\ShoppingFeedHelper;
use ShoppingFeed\ShoppingFeedWC\Admin;

Expand Down Expand Up @@ -1232,25 +1233,44 @@ function () {
},
self::SF_SHIPPING_SETTINGS_PAGE
);

add_settings_field(
'shipping_is_compatible_with_addons',
__( 'Retrieval mode', 'shopping-feed' ),
'shipping_tracking_provider',
__( 'Tracking provider', 'shopping-feed' ),
function () {
$manager = ShoppingFeedHelper::wc_tracking_provider_manager();
$selected_provider = $this->sf_shipping_options['tracking_provider'] ?? '';
?>
<select id="retrieval_mode"
name="<?php echo esc_html( sprintf( '%s[retrieval_mode]', self::SF_SHIPPING_OPTIONS ) ); ?>">
<option value="ADDONS"
<?php selected( 'ADDONS', $this->sf_shipping_options['retrieval_mode'] ? $this->sf_shipping_options['retrieval_mode'] : false ); ?>>
Addons
</option>
<option value="METAS"
<?php selected( 'METAS', $this->sf_shipping_options['retrieval_mode'] ? $this->sf_shipping_options['retrieval_mode'] : false ); ?>>
Métas
<select id="tracking_provider" name="<?php echo esc_html( sprintf( '%s[tracking_provider]', self::SF_SHIPPING_OPTIONS ) ); ?>">
<option value=""><?php esc_html_e( 'Disable', 'shopping-feed' ); ?></option>
<?php foreach ( $manager->get_providers() as $provider ) : ?>
<option value="<?php echo esc_attr( $provider->id() ); ?>"
<?php selected( $selected_provider, $provider->id() ); ?>
<?php disabled( ! $provider->is_available() ); ?>>
<?php echo esc_html( $provider->name() ); ?>
<?php
if ( ! $provider->is_available() ) {
echo esc_html(
sprintf(
' (%s)',
__( 'not installed/activated ', 'shopping-feed' )
)
);
}
?>
</option>
<?php endforeach; ?>
</select>
<?php if ( ! $manager->get_selected_provider( false )->is_available() ) : ?>
<p class="description"
id="tagline-description">
<?php echo esc_attr_e( 'How shipping information will be retrieved', 'shopping-feed' ); ?>
<span class="dashicons dashicons-warning"></span>
<strong><?php esc_attr_e( 'The selected provider is not available.', 'shopping-feed' ); ?></strong>
</p>
<?php endif; ?>
<p class="description"
id="tagline-description">
<?php esc_attr_e( 'Choose the provider used to retrieve tracking information.', 'shopping-feed' ); ?>
</p>
<?php
},
Expand Down Expand Up @@ -1403,6 +1423,30 @@ function () {
);
}

add_settings_field(
'disable_orders_import_option',
__( 'Disable order import', 'shopping-feed' ),
function () {
?>
<label for="disable_order_import">
<input
type="checkbox"
id="disable_order_import"
name="<?php echo esc_attr( sprintf( '%s[disable_order_import]', self::SF_ORDERS_OPTIONS ) ); ?>"
value="yes"
<?php checked( 1, isset( $this->sf_orders_options['disable_order_import'] ) ? $this->sf_orders_options['disable_order_import'] : 0 ); ?>
>
<?php esc_html_e( 'Would you like to deactivate order import ?', 'shopping-feed' ); ?>
</label>
<p class="description" id="tagline-description">
<?php esc_html_e( 'If the box is checked, item import will be disabled.', 'shopping-feed' ); ?>
</p>
<?php
},
self::SF_ORDERS_SETTINGS_PAGE,
'sf_orders_settings_import_options'
);

add_settings_field(
'Frequency',
__( 'Frequency', 'shopping-feed' ),
Expand Down
Loading
Loading