Changeset 2542211
- Timestamp:
- 06/03/2021 07:03:38 PM (5 years ago)
- Location:
- shopping-feed
- Files:
-
- 12 added
- 46 edited
- 1 copied
-
tags/6.0.21 (copied) (copied from shopping-feed/trunk)
-
tags/6.0.21/languages/languages.pot (modified) (1 diff)
-
tags/6.0.21/languages/shopping-feed-fr_FR.mo (modified) (previous)
-
tags/6.0.21/languages/shopping-feed-fr_FR.po (modified) (3 diffs)
-
tags/6.0.21/readme.txt (modified) (2 diffs)
-
tags/6.0.21/shoppingfeed.php (modified) (2 diffs)
-
tags/6.0.21/src/Addons/Addons.php (modified) (2 diffs)
-
tags/6.0.21/src/Addons/Plugins (added)
-
tags/6.0.21/src/Addons/Plugins/ASTPlugin (added)
-
tags/6.0.21/src/Addons/Plugins/ASTPlugin/AstPlugin.php (added)
-
tags/6.0.21/src/Addons/Plugins/ChainedProductsPlugin (added)
-
tags/6.0.21/src/Addons/Plugins/ChainedProductsPlugin/ChainedProducts.php (added)
-
tags/6.0.21/src/Admin/Options.php (modified) (9 diffs)
-
tags/6.0.21/src/Admin/Requirements.php (modified) (3 diffs)
-
tags/6.0.21/src/Admin/WoocommerceActions.php (modified) (2 diffs)
-
tags/6.0.21/src/Feed/AsyncGenerator.php (added)
-
tags/6.0.21/src/Feed/Generator.php (modified) (5 diffs)
-
tags/6.0.21/src/Feed/Uri.php (modified) (1 diff)
-
tags/6.0.21/src/Orders/Operations.php (modified) (1 diff)
-
tags/6.0.21/src/Orders/Order.php (modified) (3 diffs)
-
tags/6.0.21/src/Orders/Order/Products.php (modified) (4 diffs)
-
tags/6.0.21/src/Products/Products.php (modified) (2 diffs)
-
tags/6.0.21/src/ShoppingFeed.php (modified) (2 diffs)
-
tags/6.0.21/src/ShoppingFeedHelper.php (modified) (5 diffs)
-
tags/6.0.21/vendor/autoload.php (modified) (1 diff)
-
tags/6.0.21/vendor/composer/InstalledVersions.php (modified) (2 diffs)
-
tags/6.0.21/vendor/composer/autoload_classmap.php (modified) (2 diffs)
-
tags/6.0.21/vendor/composer/autoload_real.php (modified) (5 diffs)
-
tags/6.0.21/vendor/composer/autoload_static.php (modified) (4 diffs)
-
tags/6.0.21/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/languages/languages.pot (modified) (1 diff)
-
trunk/languages/shopping-feed-fr_FR.mo (modified) (previous)
-
trunk/languages/shopping-feed-fr_FR.po (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/shoppingfeed.php (modified) (2 diffs)
-
trunk/src/Addons/Addons.php (modified) (2 diffs)
-
trunk/src/Addons/Plugins (added)
-
trunk/src/Addons/Plugins/ASTPlugin (added)
-
trunk/src/Addons/Plugins/ASTPlugin/AstPlugin.php (added)
-
trunk/src/Addons/Plugins/ChainedProductsPlugin (added)
-
trunk/src/Addons/Plugins/ChainedProductsPlugin/ChainedProducts.php (added)
-
trunk/src/Admin/Options.php (modified) (9 diffs)
-
trunk/src/Admin/Requirements.php (modified) (3 diffs)
-
trunk/src/Admin/WoocommerceActions.php (modified) (2 diffs)
-
trunk/src/Feed/AsyncGenerator.php (added)
-
trunk/src/Feed/Generator.php (modified) (5 diffs)
-
trunk/src/Feed/Uri.php (modified) (1 diff)
-
trunk/src/Orders/Operations.php (modified) (1 diff)
-
trunk/src/Orders/Order.php (modified) (3 diffs)
-
trunk/src/Orders/Order/Products.php (modified) (4 diffs)
-
trunk/src/Products/Products.php (modified) (2 diffs)
-
trunk/src/ShoppingFeed.php (modified) (2 diffs)
-
trunk/src/ShoppingFeedHelper.php (modified) (5 diffs)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/InstalledVersions.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_classmap.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_real.php (modified) (5 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (4 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shopping-feed/tags/6.0.21/languages/languages.pot
r2462128 r2542211 429 429 msgid "Default Status for orders imported from from SF" 430 430 msgstr "" 431 432 msgid "The feed is update is running" 433 msgstr "" 434 435 msgid "Refresh to check progress" 436 msgstr "" 437 438 msgid "Batch size" 439 msgstr "" 440 441 msgid "Batch size (default 200 to decrease in case of performance issues)" 442 msgstr "" 443 444 msgid "If the feed is blocked and not generated" 445 msgstr "" 446 447 msgid "click here" 448 msgstr "" 449 450 msgid "to clean all running process" 451 msgstr "" -
shopping-feed/tags/6.0.21/languages/shopping-feed-fr_FR.po
r2462128 r2542211 8 8 "Content-Transfer-Encoding: 8bit\n" 9 9 "POT-Creation-Date: 2020-04-20T12:04:03+00:00\n" 10 "PO-Revision-Date: 202 0-06-12 15:18+0200\n"11 "X-Generator: Poedit 2. 3.1\n"10 "PO-Revision-Date: 2021-04-26 19:16+0200\n" 11 "X-Generator: Poedit 2.4\n" 12 12 "X-Domain: languages\n" 13 13 "Last-Translator: \n" … … 346 346 msgstr "Mettre à jour manuellement" 347 347 348 msgid "Refresh to check progress" 349 msgstr "Actualiser pour vérifier la progression" 350 351 msgid "The feed is update is running" 352 msgstr "Mise à jour du flux en cours" 353 348 354 msgid "Methods" 349 355 msgstr "Méthodes" … … 420 426 msgid "Default Status for orders imported from from SF" 421 427 msgstr "Statut par défaut avec lequel la commande sera créé" 428 429 msgid "Batch size" 430 msgstr "Taille du lot" 431 432 msgid "Batch size (default 200 to decrease in case of performance issues)" 433 msgstr "Taille du lot (200 par défaut a diminuer en cas de problèmes de performances)" 434 435 msgid "If the feed is blocked and not generated" 436 msgstr "Si le flux est bloqué ou non généré" 437 438 msgid "click here" 439 msgstr "cliquez ici" 440 441 msgid "to clean all running process" 442 msgstr "pour nettoyer tous les processus en cours" -
shopping-feed/tags/6.0.21/readme.txt
r2540628 r2542211 2 2 Contributors: ShoppingFeed, BeAPI 3 3 Tags: shoppingfeed, marketplace, woocommerce, woocommerce shoppingfeed, create woocommerce products shoppingfeed, products feed, generate shoppingfeed, amazon, Jet, Walmart, many marketplace, import orders 4 Stable tag: 6.0. 185 Version: 6.0. 184 Stable tag: 6.0.21 5 Version: 6.0.21 6 6 Requires PHP: 5.6 7 7 Requires at least: 5.2 … … 31 31 6.0.16 sum quantity of all variations on parent 32 32 6.0.17 using generator for generating products list" 33 6.0.18 consider only the published products 33 6.0.18 add async generation for feed 34 6.0.19 add compat to the plugin Chained Product 35 6.0.20 add compat to the plugin ATS 36 6.0.21 Set status as publish on product list 34 37 35 38 == Description == -
shopping-feed/tags/6.0.21/shoppingfeed.php
r2540628 r2542211 8 8 * Text Domain: shopping-feed 9 9 * Domain Path: /languages 10 * Version: 6.0. 1811 * Requires at least WP: 5. 212 * Requires at least WooCommerce: 3.8 (3.9/4.0)10 * Version: 6.0.21 11 * Requires at least WP: 5.7 12 * Requires at least WooCommerce: 5.1.0 13 13 * Requires PHP: 5.6 14 14 * License: GPLv3 or later … … 26 26 } 27 27 28 define( 'SF_VERSION', '6.0. 18' );28 define( 'SF_VERSION', '6.0.21' ); 29 29 define( 'SF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 30 30 define( 'SF_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); 31 31 define( 'SF_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); 32 define( 'SF_FEED_DIR', wp_upload_dir()['basedir'] . '/shopping-feed' ); 33 define( 'SF_FEED_PARTS_DIR', SF_FEED_DIR . '/parts' ); 32 34 33 35 // Plugin activate/deactivate hooks -
shopping-feed/tags/6.0.21/src/Addons/Addons.php
r2339808 r2542211 8 8 use ShoppingFeed\ShoppingFeedWC\Addons\Inventory\Inventory; 9 9 use ShoppingFeed\ShoppingFeedWC\Addons\Marketplaces\Marketplaces; 10 use ShoppingFeed\ShoppingFeedWC\Addons\Plugins\ASTPlugin\ASTPlugin; 11 use ShoppingFeed\ShoppingFeedWC\Addons\Plugins\ChainedProductsPlugin\ChainedProducts; 10 12 use ShoppingFeed\ShoppingFeedWC\Addons\Shipping\Shipping; 11 13 … … 30 32 private $marketplaces; 31 33 34 /** 35 * Shipping class 36 * @var ChainedProducts 37 */ 38 private $chained_products_plugin; 39 40 /** 41 * Shipping class 42 * @var ASTPlugin 43 */ 44 private $ast_plugin; 45 32 46 public function __construct() { 33 $this->shipping = new Shipping(); 34 $this->inventory = new Inventory(); 35 $this->marketplaces = new Marketplaces(); 47 $this->shipping = new Shipping(); 48 $this->inventory = new Inventory(); 49 $this->marketplaces = new Marketplaces(); 50 $this->chained_products_plugin = new ChainedProducts(); 51 $this->ast_plugin = new ASTPlugin(); 36 52 } 37 53 } -
shopping-feed/tags/6.0.21/src/Admin/Options.php
r2462128 r2542211 9 9 use ShoppingFeed\ShoppingFeedWC\Feed\Generator; 10 10 use ShoppingFeed\ShoppingFeedWC\Orders\Operations; 11 use ShoppingFeed\ShoppingFeedWC\ShoppingFeed;12 11 use ShoppingFeed\ShoppingFeedWC\ShoppingFeedHelper; 13 12 … … 39 38 //Account options 40 39 const SF_ACCOUNT_OPTIONS = 'sf_account_options'; 41 40 const SF_FEED_OPTIONS = 'sf_feed_options'; 41 42 //Feed options 43 const SF_SHIPPING_OPTIONS = 'sf_shipping_options'; 44 const SF_ORDERS_OPTIONS = 'sf_orders_options'; 45 46 //Shipping options 47 const SF_CARRIERS = 'SF_CARRIERS'; 42 48 /** @var array $sf_account_options */ 43 49 private $sf_account_options; 44 50 45 //Feed options 46 const SF_FEED_OPTIONS = 'sf_feed_options'; 51 //Orders options 47 52 /** @var array $sf_feed_options */ 48 53 private $sf_feed_options; 49 50 //Shipping options51 const SF_SHIPPING_OPTIONS = 'sf_shipping_options';52 54 /** @var array $sf_shipping_options */ 53 55 private $sf_shipping_options; 54 56 55 //Orders options 56 const SF_ORDERS_OPTIONS = 'sf_orders_options'; 57 //SF Carriers 57 58 /** @var array $sf_orders_options */ 58 59 private $sf_orders_options; 59 60 //SF Carriers61 const SF_CARRIERS = 'SF_CARRIERS';62 60 /** @var bool $connected */ 63 61 private $connected = true; … … 224 222 $this->connected = ShoppingFeedHelper::is_authenticated(); 225 223 224 //check clean action 225 $this->check_clean_action(); 226 226 227 //load assets 227 228 $this->load_assets(); … … 266 267 __( 'Your source feed', 'shopping-feed' ), 267 268 function () { 268 printf( 269 '<a target="_blank" href="%1$s">%1$s</a><br><p>' . __( 'Last update', 'shopping-feed' ) . ': %3$s - <a target="_blank" href="%2$s">' . __( 'Refresh', 'shopping-feed' ) . '</a></p>', 270 esc_html( ShoppingFeedHelper::get_public_feed_url() ), 271 esc_html( ShoppingFeedHelper::get_public_feed_url_with_generation() ), 272 ! empty( get_option( Generator::SF_FEED_LAST_GENERATION_DATE ) ) ? esc_html( get_option( Generator::SF_FEED_LAST_GENERATION_DATE ) ) : esc_html( 'Never' ) 273 ); 269 $sf_feed_public_url = ShoppingFeedHelper::get_public_feed_url(); 270 $sf_process_running = ShoppingFeedHelper::generation_process_running(); 271 $sf_last_generation_date = get_option( Generator::SF_FEED_LAST_GENERATION_DATE ); 272 ?> 273 <?php if ( ! $sf_process_running ) : ?> 274 <a href="<?php echo esc_html( $sf_feed_public_url ); ?>" target="_blank"> 275 <?php 276 echo esc_url( $sf_feed_public_url ); 277 ; 278 ?> 279 </a> 280 <?php endif; ?> 281 <br> 282 <p> 283 <?php if ( ! $sf_process_running ) : ?> 284 <?php esc_html_e( 'Last update', 'shopping-feed' ); ?> : 285 <?php 286 ! empty( $sf_last_generation_date ) ? esc_html( $sf_last_generation_date ) : esc_html_e( 'Never', 'shopping-feed' ); 287 ?> 288 <a href="<?php echo esc_url( ShoppingFeedHelper::get_public_feed_url_with_generation() ); ?>" target="_blank"> 289 <?php esc_html_e( 'Refresh', 'shopping-feed' ); ?> 290 </a> 291 <?php else : ?> 292 <strong>(<?php esc_html_e( 'The feed is update is running', 'shopping-feed' ); ?>) <a href="#" onClick="window.location.reload();"><?php esc_html_e( 'Refresh to check progress', 'shopping-feed' ); ?></a></strong> 293 <?php endif; ?> 294 </p> 295 <?php 274 296 }, 275 297 self::SF_ACCOUNT_SETTINGS_PAGE, … … 318 340 echo wp_kses_post( $requirements->openssl_requirement() ); 319 341 echo wp_kses_post( $requirements->account_requirement() ); 342 echo wp_kses_post( $requirements->uploads_directory_access_requirement() ); 320 343 ?> 321 344 <!-- REQUIREMENTS --> … … 330 353 </div> 331 354 <?php 355 } 356 357 /** 358 * Check clean action 359 */ 360 private function check_clean_action() { 361 if ( ! empty( $_GET['clean_process'] ) ) { 362 ShoppingFeedHelper::clean_generation_process_running(); 363 } 364 } 365 366 private function load_assets() { 367 wp_enqueue_style( 368 'sf_app', 369 SF_PLUGIN_URL . 'assets/css/app.css', 370 array(), 371 true 372 ); 373 374 wp_enqueue_script( 375 'multi_js', 376 SF_PLUGIN_URL . 'assets/js/multi.min.js', 377 array( 'jquery' ), 378 true, 379 true 380 ); 381 382 wp_enqueue_script( 'multi_js_init', SF_PLUGIN_URL . 'assets/js/init.js', array( 'multi_js' ), true ); 383 wp_localize_script( 384 'multi_js_init', 385 'sf_options', 386 array( 387 'selected_orders' => __( 'Selected order status', 'shopping-feed' ), 388 'unselected_orders' => __( 'Unselected order status', 'shopping-feed' ), 389 'search' => __( 'Search', 'shopping-feed' ), 390 ) 391 ); 332 392 } 333 393 … … 479 539 <p class="description" 480 540 id="tagline-description"><?php echo esc_attr_e( 'Frequency to generate the feed (usually 6h)', 'shopping-feed' ); ?></p> 541 <?php 542 }, 543 self::SF_FEED_SETTINGS_PAGE, 544 'sf_feed_settings_frequency' 545 ); 546 547 add_settings_field( 548 'Batch size', 549 __( 'Batch size', 'shopping-feed' ), 550 function () { 551 $running_process = ShoppingFeedHelper::get_running_generation_feed_process(); 552 $running_process = is_array( $running_process ) ? count( $running_process ) : 0; 553 ?> 554 <select name="<?php echo esc_html( sprintf( '%s[part_size]', self::SF_FEED_OPTIONS ) ); ?>"> 555 <?php 556 foreach ( array( 10, 20, 50, 100, 200, 500, 1000 ) as $part_size_option ) { 557 ?> 558 <option 559 value="<?php echo esc_html( $part_size_option ); ?>" 560 <?php selected( $part_size_option, $this->sf_feed_options['part_size'] ? $this->sf_feed_options['part_size'] : false ); ?> 561 ><?php echo esc_html( $part_size_option ); ?></option> 562 <?php 563 } 564 ?> 565 </select> 566 <p class="description" id="tagline-description"> 567 <?php esc_attr_e( 'Batch size (default 200 to decrease in case of performance issues)', 'shopping-feed' ); ?> 568 </p> 569 <p class="description"> 570 <?php esc_attr_e( 'If the feed is blocked and not generated', 'shopping-feed' ); ?> 571 <a href="<?php echo sprintf( '%s&clean_process=true', esc_url( ShoppingFeedHelper::get_setting_link() ) ); ?>" class="button-link-delete"><?php esc_attr_e( 'click here', 'shopping-feed' ); ?></a> 572 <?php esc_attr_e( 'to clean all running process', 'shopping-feed' ); ?> 573 <?php echo esc_html( sprintf( '(%s)', $running_process ) ); ?> 574 </p> 481 575 <?php 482 576 }, … … 555 649 </div> 556 650 <?php 651 } 652 653 /** 654 * Check connection with SF platform with correct credentials 655 * If not redirect to Account page 656 */ 657 private function check_connection() { 658 if ( ! ShoppingFeedHelper::is_authenticated() ) { 659 wp_safe_redirect( sprintf( '%s&no_connected=%s', ShoppingFeedHelper::get_setting_link(), 'true' ) ); 660 } 557 661 } 558 662 … … 832 936 } 833 937 834 /**835 * Check connection with SF platform with correct credentials836 * If not redirect to Account page837 */838 private function check_connection() {839 if ( ! ShoppingFeedHelper::is_authenticated() ) {840 wp_safe_redirect( sprintf( '%s&no_connected=%s', ShoppingFeedHelper::get_setting_link(), 'true' ) );841 }842 }843 844 private function load_assets() {845 wp_enqueue_style(846 'sf_app',847 SF_PLUGIN_URL . 'assets/css/app.css',848 array(),849 true850 );851 852 wp_enqueue_script(853 'multi_js',854 SF_PLUGIN_URL . 'assets/js/multi.min.js',855 array( 'jquery' ),856 true,857 true858 );859 860 wp_enqueue_script( 'multi_js_init', SF_PLUGIN_URL . 'assets/js/init.js', array( 'multi_js' ), true );861 wp_localize_script(862 'multi_js_init',863 'sf_options',864 array(865 'selected_orders' => __( 'Selected order status', 'shopping-feed' ),866 'unselected_orders' => __( 'Unselected order status', 'shopping-feed' ),867 'search' => __( 'Search', 'shopping-feed' ),868 )869 );870 }871 872 938 } -
shopping-feed/tags/6.0.21/src/Admin/Requirements.php
r2417980 r2542211 7 7 8 8 use ShoppingFeed\ShoppingFeedWC\ShoppingFeedHelper; 9 use const OPENSSL_VERSION_TEXT;10 9 use const PHP_VERSION; 11 10 … … 90 89 } 91 90 91 92 /** 93 * @return string 94 */ 95 public function uploads_directory_access_requirement() { 96 return ( $this->uploads_directory_writable() ) 97 ? '<p class="success">' . __( 'You have write access in uploads directory.', 'shopping-feed' ) . '</p>' 98 : '<p class="failed">' . __( 'You must have write access in uploads directory.', 'shopping-feed' ) . '</p>'; 99 } 100 92 101 /** 93 102 * Check if CURL is available and support SSL … … 135 144 return ShoppingFeedHelper::is_authenticated(); 136 145 } 146 147 /** 148 * Check if the uploads directory is writable 149 * 150 * @return bool 151 */ 152 public function uploads_directory_writable() { 153 return is_writable( wp_upload_dir()['basedir'] ); 154 } 137 155 } -
shopping-feed/tags/6.0.21/src/Admin/WoocommerceActions.php
r2404199 r2542211 10 10 use ShoppingFeed\Sdk\Api\Catalog\PricingUpdate; 11 11 use ShoppingFeed\Sdk\Api\Store\StoreResource; 12 use ShoppingFeed\ShoppingFeedWC\Feed\AsyncGenerator; 12 13 use ShoppingFeed\ShoppingFeedWC\Feed\Generator; 13 14 use ShoppingFeed\ShoppingFeedWC\Orders\Operations; … … 37 38 38 39 public function __construct() { 40 41 //Generate async feed 42 add_action( 43 'sf_feed_generation_process', 44 [ 45 AsyncGenerator::get_instance(), 46 'launch', 47 ] 48 ); 49 50 //Generate feed part 51 add_action( 52 'sf_feed_generation_part', 53 [ 54 AsyncGenerator::get_instance(), 55 56 'generate_feed_part', 57 ], 58 10, 59 2 60 ); 61 62 //Combine feed's parts 63 add_action( 64 'sf_feed_generation_combine_feed_parts', 65 [ 66 AsyncGenerator::get_instance(), 67 'combine_feed_parts', 68 ] 69 ); 39 70 40 71 //Product Update -
shopping-feed/tags/6.0.21/src/Feed/Generator.php
r2422339 r2542211 32 32 * @var ProductGenerator 33 33 */ 34 pr ivate$generator;34 protected $generator; 35 35 36 36 /** 37 37 * Generator constructor. 38 38 */ 39 p rivatefunction __construct() {39 public function __construct() { 40 40 $this->set_platform(); 41 41 $this->set_uri(); … … 79 79 * This can be achieved in mappers or in your dataset, but sometimes things have to be separated, so you can register processors that are executed before mappers, and prepare your data before the mapping process. 80 80 */ 81 pr ivatefunction set_processors() {81 protected function set_processors() { 82 82 } 83 83 … … 86 86 * Filters are executed after processors, because item must be completely filled before to make the decision to keep it or not. 87 87 */ 88 pr ivatefunction set_filters() {88 protected function set_filters() { 89 89 # Ignore all items with undefined price 90 90 $this->generator->addFilter( … … 103 103 * As stated above, at least one mapper must be registered, this is where you populate the Product instance, which is later converted to XML by the library 104 104 */ 105 pr ivatefunction set_mappers() {105 protected function set_mappers() { 106 106 //Simple product mapping 107 107 $this->generator->addMapper( … … 234 234 235 235 if ( true === $no_cache || ! is_file( $file_path ) ) { 236 $generate = $this->generate(); 237 if ( is_wp_error( $generate ) ) { 238 ShoppingFeedHelper::get_logger()->error( 239 sprintf( 240 __( 'Cant display feed', 'shopping-feed' ) 241 ), 242 array( 243 'source' => 'shopping-feed', 244 ) 245 ); 246 } 236 if ( ShoppingFeedHelper::generation_process_running() ) { 237 wp_die( 'Feed generation already launched' ); 238 } 239 as_schedule_single_action( 240 false, 241 'sf_feed_generation_process', 242 array(), 243 'sf_feed_generation_process' 244 ); 245 wp_die( 'Feed generation launched' ); 247 246 } 248 247 -
shopping-feed/tags/6.0.21/src/Feed/Uri.php
r2417980 r2542211 135 135 */ 136 136 public function set_file_path() { 137 $this->file_path = $this->directory . $this->file_name;137 $this->file_path = $this->directory . '/' . $this->file_name; 138 138 } 139 139 -
shopping-feed/tags/6.0.21/src/Orders/Operations.php
r2339808 r2542211 121 121 $this->sf_channel_name, 122 122 ShoppingFeedHelper::get_sf_carrier_from_wc_shipping( $this->wc_order ), 123 (string) $this->wc_order->get_meta( ShoppingFeedHelper::wc_tracking_number()),124 (string) $this->wc_order->get_meta( ShoppingFeedHelper::wc_tracking_link())123 ShoppingFeedHelper::wc_tracking_number( $this->wc_order ), 124 ShoppingFeedHelper::wc_tracking_link( $this->wc_order ) 125 125 ); 126 126 $this->order_api->execute( $this->order_operation ); -
shopping-feed/tags/6.0.21/src/Orders/Order.php
r2422339 r2542211 80 80 //Addresses 81 81 $wc_order->set_address( $this->shipping_address, 'shipping' ); 82 $wc_order->set_address( $this->billing_address , 'billing');82 $wc_order->set_address( $this->billing_address ); 83 83 84 84 //Payment … … 167 167 $item->save(); 168 168 $wc_order->add_item( $item ); 169 do_action( 'sf_after_order_add_item', $item, $wc_order ); 169 170 } 170 171 } … … 205 206 $wc_order->save(); 206 207 208 do_action( 'sf_before_add_order', $wc_order ); 209 207 210 //Acknowledge the order so we will not get it next time 208 211 Operations::acknowledge_order( $wc_order->get_id(), $message ); -
shopping-feed/tags/6.0.21/src/Orders/Order/Products.php
r2417980 r2542211 83 83 } 84 84 85 $default_args = array( 85 $sf_product_quantity = $sf_product->getQuantity(); 86 87 $args = array( 86 88 'name' => $wc_product->get_name(), 87 89 'tax_class' => $wc_product->get_tax_class(), … … 89 91 'variation_id' => $wc_product->is_type( 'variation' ) ? $wc_product->get_id() : 0, 90 92 'variation' => $wc_product->is_type( 'variation' ) ? $wc_product->get_attributes() : array(), 91 ); 92 93 $args = array( 94 'subtotal' => $sf_product->getUnitPrice(), 95 'total' => $sf_product->getTotalPrice(), 96 'quantity' => $sf_product->getQuantity(), 93 'subtotal' => $sf_product->getUnitPrice(), 94 'total' => $sf_product->getTotalPrice(), 95 'quantity' => $sf_product_quantity, 97 96 ); 98 97 … … 100 99 101 100 return array( 102 'args' => wp_parse_args( $args, $default_args ),103 'outofstock' => ! $this->validate_product( $wc_product, $sf_product ),101 'args' => $args, 102 'outofstock' => ! $this->validate_product( $wc_product, $sf_product_quantity ), 104 103 'product_quantity' => $wc_product_quantity, 105 'quantity_needed' => $sf_product ->getQuantity()- $wc_product_quantity,104 'quantity_needed' => $sf_product_quantity - $wc_product_quantity, 106 105 ); 107 106 } … … 109 108 /** 110 109 * @param $wc_product WC_Product 111 * @param $ sf_product OrderItem110 * @param $ordered_quantity int 112 111 * 113 112 * @return bool 114 113 */ 115 private function validate_product( $wc_product, $ sf_product) {116 //automatically validate product if backorders or allowed and managin stock is disabled114 private function validate_product( $wc_product, $ordered_quantity ) { 115 //automatically validate product if backorders or allowed and managing stock is disabled 117 116 if ( $wc_product->backorders_allowed() || ! $wc_product->managing_stock() ) { 118 117 return true; 119 118 } 120 119 121 return $ sf_product->getQuantity()<= $wc_product->get_stock_quantity();120 return $ordered_quantity <= $wc_product->get_stock_quantity(); 122 121 } 123 122 -
shopping-feed/tags/6.0.21/src/Products/Products.php
r2540628 r2542211 42 42 } 43 43 44 /** 45 * Generate products list 46 */ 47 public function get_list() { 44 public function get_list_args() { 48 45 $default_args = array( 49 46 'limit' => - 1, … … 66 63 } 67 64 68 $args = wp_parse_args( ShoppingFeedHelper::wc_products_custom_query_args(), $default_args ); 65 return wp_parse_args( ShoppingFeedHelper::wc_products_custom_query_args(), $default_args ); 66 } 69 67 70 $query = new \WC_Product_Query( $args ); 68 /** 69 * Generate products list 70 */ 71 public function get_list() { 72 $products = $this->get_products(); 71 73 72 if ( ! empty( $ query->get_products()) ) {73 foreach ( $ query->get_products()as $wc_product ) {74 yield [ new Product( $wc_product ) ];74 if ( ! empty( $products ) ) { 75 foreach ( $products as $wc_product ) { 76 yield array( new Product( $wc_product ) ); 75 77 } 76 78 } 77 79 } 80 81 public function get_products( $args = array() ) { 82 $query = new \WC_Product_Query( wp_parse_args( $args, $this->get_list_args() ) ); 83 84 return $query->get_products(); 85 } 86 87 88 public function format_products( $wc_products ) { 89 foreach ( $wc_products as $wc_product ) { 90 yield array( new Product( $wc_product ) ); 91 } 92 } 93 78 94 } -
shopping-feed/tags/6.0.21/src/ShoppingFeed.php
r2417980 r2542211 207 207 public static function activate() { 208 208 if ( defined( 'WC_VERSION' ) ) { 209 self::add_sf_directory(); 209 210 Actions::register_feed_generation(); 210 211 Actions::register_get_orders(); … … 241 242 delete_option( Options::SF_CARRIERS ); 242 243 delete_option( Generator::SF_FEED_LAST_GENERATION_DATE ); 243 ( new \WP_Filesystem_Direct( false ) )->rmdir( ShoppingFeedHelper::get_feed_directory(), true ); 244 self::remove_sf_directory(); 245 } 246 247 public static function remove_sf_directory() { 248 rmdir( ShoppingFeedHelper::get_feed_directory() ); 249 } 250 251 public static function add_sf_directory() { 252 $directory = ShoppingFeedHelper::get_feed_directory(); 253 if ( ! is_dir( $directory ) ) { 254 wp_mkdir_p( $directory ); 255 } 256 $part_directory = ShoppingFeedHelper::get_feed_parts_directory(); 257 if ( ! is_dir( $part_directory ) ) { 258 wp_mkdir_p( $part_directory ); 259 } 244 260 } 245 261 } -
shopping-feed/tags/6.0.21/src/ShoppingFeedHelper.php
r2430999 r2542211 20 20 21 21 /** 22 * @var ShoppingFeedHelper 23 */ 24 private static $instance; 25 26 /** 27 * Get the singleton instance. 28 * 29 * @return ShoppingFeedHelper 30 */ 31 public static function get_instance() { 32 if ( is_null( self::$instance ) ) { 33 self::$instance = new self(); 34 } 35 36 return self::$instance; 37 } 38 39 /** 40 * Singleton instance can't be cloned. 41 */ 42 private function __clone() { 43 } 44 45 /** 46 * Singleton instance can't be serialized. 47 */ 48 private function __wakeup() { 49 } 50 51 /** 22 52 * Check if current WooCommerce version is below 3.8.0 23 53 * … … 57 87 */ 58 88 public static function get_feed_directory() { 59 $directory = wp_upload_dir()['basedir'] . '/shopping-feed/'; 60 if ( ! is_dir( $directory ) ) { 61 wp_mkdir_p( $directory ); 62 } 63 64 return $directory; 89 return SF_FEED_DIR; 90 } 91 92 /** 93 * Return the feed's parts directory 94 * @return string 95 */ 96 public static function get_feed_parts_directory() { 97 return SF_FEED_PARTS_DIR; 98 } 99 100 /** 101 * @return string 102 */ 103 public static function get_feed_skeleton() { 104 return <<<XML 105 <?xml version="1.0" encoding="UTF-8"?> 106 <catalog> 107 <metadata> 108 <platform>WooCommerce:5.1.0</platform> 109 <agent>shopping-feed-generator:1.0.0</agent> 110 <startedAt/> 111 <finishedAt/> 112 <invalid/> 113 <ignored/> 114 <written/> 115 </metadata> 116 </catalog> 117 XML; 65 118 } 66 119 … … 249 302 250 303 return $frequency; 304 } 305 306 /** 307 * Return SF feed part size 308 * default: 200 product per file 309 * @return int 310 */ 311 public static function get_sf_part_size() { 312 $part_size = self::get_sf_feed_options( 'part_size' ); 313 if ( empty( $part_size ) ) { 314 return 200; 315 } 316 317 return $part_size; 251 318 } 252 319 … … 576 643 /** 577 644 * Add filter for order tracking number meta key 578 * @return string 579 */ 580 public static function wc_tracking_number() { 581 return apply_filters( 'shopping_feed_tracking_number', '' ); 645 * 646 * @param \WC_Order $wc_order 647 * 648 * @return string 649 */ 650 public static function wc_tracking_number( $wc_order ) { 651 $tracking_number = apply_filters( 'shopping_feed_tracking_number', '', $wc_order ); 652 //COMPACT WITH OLD VERSION 653 if ( '6.0.19' <= SF_VERSION ) { 654 return (string) $wc_order->get_meta( $tracking_number ); 655 } 656 657 return $tracking_number; 582 658 } 583 659 584 660 /** 585 661 * Add filter for order tracking link meta key 586 * @return string 587 */ 588 public static function wc_tracking_link() { 589 return apply_filters( 'shopping_feed_tracking_link', '' ); 662 * 663 * @param \WC_Order $wc_order 664 * 665 * @return string 666 */ 667 public static function wc_tracking_link( $wc_order ) { 668 $tracking_link = apply_filters( 'shopping_feed_tracking_link', '', $wc_order ); 669 //COMPACT WITH OLD VERSION 670 if ( '6.0.19' <= SF_VERSION ) { 671 return (string) $wc_order->get_meta( $tracking_link ); 672 } 673 674 return $tracking_link; 590 675 } 591 676 … … 597 682 return 100; 598 683 } 684 685 /** 686 * Get running process list 687 * @return array|int 688 */ 689 public static function get_running_generation_feed_process() { 690 $action_scheduler = \ActionScheduler::store(); 691 692 return $action_scheduler->query_actions( 693 array( 694 'group' => 'sf_feed_generation_process', 695 'status' => $action_scheduler::STATUS_PENDING, 696 ) 697 ); 698 } 699 700 /** 701 * Check if a running generation process 702 * @return bool 703 */ 704 public static function generation_process_running() { 705 $process = self::get_running_generation_feed_process(); 706 707 return ! empty( $process ); 708 } 709 710 public static function clean_generation_process_running() { 711 try { 712 \ActionScheduler::store()->cancel_actions_by_group( 'sf_feed_generation_process' ); 713 } catch ( \Exception $exception ) { 714 self::get_logger()->error( 715 sprintf( 716 __( 'Cant remove running process', 'shopping-feed' ), 717 $exception->getMessage() 718 ), 719 array( 720 'source' => 'shopping-feed', 721 ) 722 ); 723 } 724 wp_safe_redirect( self::get_setting_link(), 302 ); 725 } 599 726 } -
shopping-feed/tags/6.0.21/vendor/autoload.php
r2540628 r2542211 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit 4ab3512180e161131ad7b070b1a1643c::getLoader();7 return ComposerAutoloaderInit203372635d40bb0d59e0e62758357279::getLoader(); -
shopping-feed/tags/6.0.21/vendor/composer/InstalledVersions.php
r2540628 r2542211 28 28 'root' => 29 29 array ( 30 'pretty_version' => '6.0. 18',31 'version' => '6.0. 18.0',30 'pretty_version' => '6.0.21', 31 'version' => '6.0.21.0', 32 32 'aliases' => 33 33 array ( 34 34 ), 35 'reference' => ' 5eee70b9b2b0801fb3bc9948e6ec7473eef31991',35 'reference' => 'd9351f54d26569ee01a6f81113857ada372a9a04', 36 36 'name' => 'shoppingfeed/shoppingfeed', 37 37 ), … … 133 133 'shoppingfeed/shoppingfeed' => 134 134 array ( 135 'pretty_version' => '6.0. 18',136 'version' => '6.0. 18.0',137 'aliases' => 138 array ( 139 ), 140 'reference' => ' 5eee70b9b2b0801fb3bc9948e6ec7473eef31991',135 'pretty_version' => '6.0.21', 136 'version' => '6.0.21.0', 137 'aliases' => 138 array ( 139 ), 140 'reference' => 'd9351f54d26569ee01a6f81113857ada372a9a04', 141 141 ), 142 142 'symfony/polyfill-intl-idn' => -
shopping-feed/tags/6.0.21/vendor/composer/autoload_classmap.php
r2417980 r2542211 303 303 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Marketplaces\\Types\\AmazonBusiness' => $baseDir . '/src/Addons/Marketplaces/Types/AmazonBusiness.php', 304 304 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Marketplaces\\Types\\AmazonPrime' => $baseDir . '/src/Addons/Marketplaces/Types/AmazonPrime.php', 305 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Plugins\\ChainedProductsPlugin\\ChainedProducts' => $baseDir . '/src/Addons/Plugins/ChainedProductsPlugin/ChainedProducts.php', 305 306 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Shipping\\Marketplaces\\Cdiscount' => $baseDir . '/src/Addons/Shipping/Marketplaces/Cdiscount.php', 306 307 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Shipping\\Marketplaces\\Rdc' => $baseDir . '/src/Addons/Shipping/Marketplaces/Rdc.php', … … 314 315 'ShoppingFeed\\ShoppingFeedWC\\Admin\\WoocommerceFilters' => $baseDir . '/src/Admin/WoocommerceFilters.php', 315 316 'ShoppingFeed\\ShoppingFeedWC\\Cli\\FeedGeneration' => $baseDir . '/src/Cli/FeedGeneration.php', 317 'ShoppingFeed\\ShoppingFeedWC\\Feed\\AsyncGenerator' => $baseDir . '/src/Feed/AsyncGenerator.php', 316 318 'ShoppingFeed\\ShoppingFeedWC\\Feed\\Generator' => $baseDir . '/src/Feed/Generator.php', 317 319 'ShoppingFeed\\ShoppingFeedWC\\Feed\\Platform' => $baseDir . '/src/Feed/Platform.php', -
shopping-feed/tags/6.0.21/vendor/composer/autoload_real.php
r2540628 r2542211 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 4ab3512180e161131ad7b070b1a1643c5 class ComposerAutoloaderInit203372635d40bb0d59e0e62758357279 6 6 { 7 7 private static $loader; … … 23 23 } 24 24 25 spl_autoload_register(array('ComposerAutoloaderInit 4ab3512180e161131ad7b070b1a1643c', 'loadClassLoader'), true, true);25 spl_autoload_register(array('ComposerAutoloaderInit203372635d40bb0d59e0e62758357279', 'loadClassLoader'), true, true); 26 26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); 27 spl_autoload_unregister(array('ComposerAutoloaderInit 4ab3512180e161131ad7b070b1a1643c', 'loadClassLoader'));27 spl_autoload_unregister(array('ComposerAutoloaderInit203372635d40bb0d59e0e62758357279', 'loadClassLoader')); 28 28 29 29 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 31 31 require __DIR__ . '/autoload_static.php'; 32 32 33 call_user_func(\Composer\Autoload\ComposerStaticInit 4ab3512180e161131ad7b070b1a1643c::getInitializer($loader));33 call_user_func(\Composer\Autoload\ComposerStaticInit203372635d40bb0d59e0e62758357279::getInitializer($loader)); 34 34 } else { 35 35 $map = require __DIR__ . '/autoload_namespaces.php'; … … 52 52 53 53 if ($useStaticLoader) { 54 $includeFiles = Composer\Autoload\ComposerStaticInit 4ab3512180e161131ad7b070b1a1643c::$files;54 $includeFiles = Composer\Autoload\ComposerStaticInit203372635d40bb0d59e0e62758357279::$files; 55 55 } else { 56 56 $includeFiles = require __DIR__ . '/autoload_files.php'; 57 57 } 58 58 foreach ($includeFiles as $fileIdentifier => $file) { 59 composerRequire 4ab3512180e161131ad7b070b1a1643c($fileIdentifier, $file);59 composerRequire203372635d40bb0d59e0e62758357279($fileIdentifier, $file); 60 60 } 61 61 … … 64 64 } 65 65 66 function composerRequire 4ab3512180e161131ad7b070b1a1643c($fileIdentifier, $file)66 function composerRequire203372635d40bb0d59e0e62758357279($fileIdentifier, $file) 67 67 { 68 68 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
shopping-feed/tags/6.0.21/vendor/composer/autoload_static.php
r2540628 r2542211 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 4ab3512180e161131ad7b070b1a1643c7 class ComposerStaticInit203372635d40bb0d59e0e62758357279 8 8 { 9 9 public static $files = array ( … … 393 393 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Marketplaces\\Types\\AmazonBusiness' => __DIR__ . '/../..' . '/src/Addons/Marketplaces/Types/AmazonBusiness.php', 394 394 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Marketplaces\\Types\\AmazonPrime' => __DIR__ . '/../..' . '/src/Addons/Marketplaces/Types/AmazonPrime.php', 395 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Plugins\\ChainedProductsPlugin\\ChainedProducts' => __DIR__ . '/../..' . '/src/Addons/Plugins/ChainedProductsPlugin/ChainedProducts.php', 395 396 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Shipping\\Marketplaces\\Cdiscount' => __DIR__ . '/../..' . '/src/Addons/Shipping/Marketplaces/Cdiscount.php', 396 397 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Shipping\\Marketplaces\\Rdc' => __DIR__ . '/../..' . '/src/Addons/Shipping/Marketplaces/Rdc.php', … … 404 405 'ShoppingFeed\\ShoppingFeedWC\\Admin\\WoocommerceFilters' => __DIR__ . '/../..' . '/src/Admin/WoocommerceFilters.php', 405 406 'ShoppingFeed\\ShoppingFeedWC\\Cli\\FeedGeneration' => __DIR__ . '/../..' . '/src/Cli/FeedGeneration.php', 407 'ShoppingFeed\\ShoppingFeedWC\\Feed\\AsyncGenerator' => __DIR__ . '/../..' . '/src/Feed/AsyncGenerator.php', 406 408 'ShoppingFeed\\ShoppingFeedWC\\Feed\\Generator' => __DIR__ . '/../..' . '/src/Feed/Generator.php', 407 409 'ShoppingFeed\\ShoppingFeedWC\\Feed\\Platform' => __DIR__ . '/../..' . '/src/Feed/Platform.php', … … 436 438 { 437 439 return \Closure::bind(function () use ($loader) { 438 $loader->prefixLengthsPsr4 = ComposerStaticInit 4ab3512180e161131ad7b070b1a1643c::$prefixLengthsPsr4;439 $loader->prefixDirsPsr4 = ComposerStaticInit 4ab3512180e161131ad7b070b1a1643c::$prefixDirsPsr4;440 $loader->classMap = ComposerStaticInit 4ab3512180e161131ad7b070b1a1643c::$classMap;440 $loader->prefixLengthsPsr4 = ComposerStaticInit203372635d40bb0d59e0e62758357279::$prefixLengthsPsr4; 441 $loader->prefixDirsPsr4 = ComposerStaticInit203372635d40bb0d59e0e62758357279::$prefixDirsPsr4; 442 $loader->classMap = ComposerStaticInit203372635d40bb0d59e0e62758357279::$classMap; 441 443 442 444 }, null, ClassLoader::class); -
shopping-feed/tags/6.0.21/vendor/composer/installed.php
r2540628 r2542211 2 2 'root' => 3 3 array ( 4 'pretty_version' => '6.0. 18',5 'version' => '6.0. 18.0',4 'pretty_version' => '6.0.21', 5 'version' => '6.0.21.0', 6 6 'aliases' => 7 7 array ( 8 8 ), 9 'reference' => ' 5eee70b9b2b0801fb3bc9948e6ec7473eef31991',9 'reference' => 'd9351f54d26569ee01a6f81113857ada372a9a04', 10 10 'name' => 'shoppingfeed/shoppingfeed', 11 11 ), … … 107 107 'shoppingfeed/shoppingfeed' => 108 108 array ( 109 'pretty_version' => '6.0. 18',110 'version' => '6.0. 18.0',109 'pretty_version' => '6.0.21', 110 'version' => '6.0.21.0', 111 111 'aliases' => 112 112 array ( 113 113 ), 114 'reference' => ' 5eee70b9b2b0801fb3bc9948e6ec7473eef31991',114 'reference' => 'd9351f54d26569ee01a6f81113857ada372a9a04', 115 115 ), 116 116 'symfony/polyfill-intl-idn' => -
shopping-feed/trunk/languages/languages.pot
r2462128 r2542211 429 429 msgid "Default Status for orders imported from from SF" 430 430 msgstr "" 431 432 msgid "The feed is update is running" 433 msgstr "" 434 435 msgid "Refresh to check progress" 436 msgstr "" 437 438 msgid "Batch size" 439 msgstr "" 440 441 msgid "Batch size (default 200 to decrease in case of performance issues)" 442 msgstr "" 443 444 msgid "If the feed is blocked and not generated" 445 msgstr "" 446 447 msgid "click here" 448 msgstr "" 449 450 msgid "to clean all running process" 451 msgstr "" -
shopping-feed/trunk/languages/shopping-feed-fr_FR.po
r2462128 r2542211 8 8 "Content-Transfer-Encoding: 8bit\n" 9 9 "POT-Creation-Date: 2020-04-20T12:04:03+00:00\n" 10 "PO-Revision-Date: 202 0-06-12 15:18+0200\n"11 "X-Generator: Poedit 2. 3.1\n"10 "PO-Revision-Date: 2021-04-26 19:16+0200\n" 11 "X-Generator: Poedit 2.4\n" 12 12 "X-Domain: languages\n" 13 13 "Last-Translator: \n" … … 346 346 msgstr "Mettre à jour manuellement" 347 347 348 msgid "Refresh to check progress" 349 msgstr "Actualiser pour vérifier la progression" 350 351 msgid "The feed is update is running" 352 msgstr "Mise à jour du flux en cours" 353 348 354 msgid "Methods" 349 355 msgstr "Méthodes" … … 420 426 msgid "Default Status for orders imported from from SF" 421 427 msgstr "Statut par défaut avec lequel la commande sera créé" 428 429 msgid "Batch size" 430 msgstr "Taille du lot" 431 432 msgid "Batch size (default 200 to decrease in case of performance issues)" 433 msgstr "Taille du lot (200 par défaut a diminuer en cas de problèmes de performances)" 434 435 msgid "If the feed is blocked and not generated" 436 msgstr "Si le flux est bloqué ou non généré" 437 438 msgid "click here" 439 msgstr "cliquez ici" 440 441 msgid "to clean all running process" 442 msgstr "pour nettoyer tous les processus en cours" -
shopping-feed/trunk/readme.txt
r2540628 r2542211 2 2 Contributors: ShoppingFeed, BeAPI 3 3 Tags: shoppingfeed, marketplace, woocommerce, woocommerce shoppingfeed, create woocommerce products shoppingfeed, products feed, generate shoppingfeed, amazon, Jet, Walmart, many marketplace, import orders 4 Stable tag: 6.0. 185 Version: 6.0. 184 Stable tag: 6.0.21 5 Version: 6.0.21 6 6 Requires PHP: 5.6 7 7 Requires at least: 5.2 … … 31 31 6.0.16 sum quantity of all variations on parent 32 32 6.0.17 using generator for generating products list" 33 6.0.18 consider only the published products 33 6.0.18 add async generation for feed 34 6.0.19 add compat to the plugin Chained Product 35 6.0.20 add compat to the plugin ATS 36 6.0.21 Set status as publish on product list 34 37 35 38 == Description == -
shopping-feed/trunk/shoppingfeed.php
r2540628 r2542211 8 8 * Text Domain: shopping-feed 9 9 * Domain Path: /languages 10 * Version: 6.0. 1811 * Requires at least WP: 5. 212 * Requires at least WooCommerce: 3.8 (3.9/4.0)10 * Version: 6.0.21 11 * Requires at least WP: 5.7 12 * Requires at least WooCommerce: 5.1.0 13 13 * Requires PHP: 5.6 14 14 * License: GPLv3 or later … … 26 26 } 27 27 28 define( 'SF_VERSION', '6.0. 18' );28 define( 'SF_VERSION', '6.0.21' ); 29 29 define( 'SF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 30 30 define( 'SF_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); 31 31 define( 'SF_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); 32 define( 'SF_FEED_DIR', wp_upload_dir()['basedir'] . '/shopping-feed' ); 33 define( 'SF_FEED_PARTS_DIR', SF_FEED_DIR . '/parts' ); 32 34 33 35 // Plugin activate/deactivate hooks -
shopping-feed/trunk/src/Addons/Addons.php
r2339808 r2542211 8 8 use ShoppingFeed\ShoppingFeedWC\Addons\Inventory\Inventory; 9 9 use ShoppingFeed\ShoppingFeedWC\Addons\Marketplaces\Marketplaces; 10 use ShoppingFeed\ShoppingFeedWC\Addons\Plugins\ASTPlugin\ASTPlugin; 11 use ShoppingFeed\ShoppingFeedWC\Addons\Plugins\ChainedProductsPlugin\ChainedProducts; 10 12 use ShoppingFeed\ShoppingFeedWC\Addons\Shipping\Shipping; 11 13 … … 30 32 private $marketplaces; 31 33 34 /** 35 * Shipping class 36 * @var ChainedProducts 37 */ 38 private $chained_products_plugin; 39 40 /** 41 * Shipping class 42 * @var ASTPlugin 43 */ 44 private $ast_plugin; 45 32 46 public function __construct() { 33 $this->shipping = new Shipping(); 34 $this->inventory = new Inventory(); 35 $this->marketplaces = new Marketplaces(); 47 $this->shipping = new Shipping(); 48 $this->inventory = new Inventory(); 49 $this->marketplaces = new Marketplaces(); 50 $this->chained_products_plugin = new ChainedProducts(); 51 $this->ast_plugin = new ASTPlugin(); 36 52 } 37 53 } -
shopping-feed/trunk/src/Admin/Options.php
r2462128 r2542211 9 9 use ShoppingFeed\ShoppingFeedWC\Feed\Generator; 10 10 use ShoppingFeed\ShoppingFeedWC\Orders\Operations; 11 use ShoppingFeed\ShoppingFeedWC\ShoppingFeed;12 11 use ShoppingFeed\ShoppingFeedWC\ShoppingFeedHelper; 13 12 … … 39 38 //Account options 40 39 const SF_ACCOUNT_OPTIONS = 'sf_account_options'; 41 40 const SF_FEED_OPTIONS = 'sf_feed_options'; 41 42 //Feed options 43 const SF_SHIPPING_OPTIONS = 'sf_shipping_options'; 44 const SF_ORDERS_OPTIONS = 'sf_orders_options'; 45 46 //Shipping options 47 const SF_CARRIERS = 'SF_CARRIERS'; 42 48 /** @var array $sf_account_options */ 43 49 private $sf_account_options; 44 50 45 //Feed options 46 const SF_FEED_OPTIONS = 'sf_feed_options'; 51 //Orders options 47 52 /** @var array $sf_feed_options */ 48 53 private $sf_feed_options; 49 50 //Shipping options51 const SF_SHIPPING_OPTIONS = 'sf_shipping_options';52 54 /** @var array $sf_shipping_options */ 53 55 private $sf_shipping_options; 54 56 55 //Orders options 56 const SF_ORDERS_OPTIONS = 'sf_orders_options'; 57 //SF Carriers 57 58 /** @var array $sf_orders_options */ 58 59 private $sf_orders_options; 59 60 //SF Carriers61 const SF_CARRIERS = 'SF_CARRIERS';62 60 /** @var bool $connected */ 63 61 private $connected = true; … … 224 222 $this->connected = ShoppingFeedHelper::is_authenticated(); 225 223 224 //check clean action 225 $this->check_clean_action(); 226 226 227 //load assets 227 228 $this->load_assets(); … … 266 267 __( 'Your source feed', 'shopping-feed' ), 267 268 function () { 268 printf( 269 '<a target="_blank" href="%1$s">%1$s</a><br><p>' . __( 'Last update', 'shopping-feed' ) . ': %3$s - <a target="_blank" href="%2$s">' . __( 'Refresh', 'shopping-feed' ) . '</a></p>', 270 esc_html( ShoppingFeedHelper::get_public_feed_url() ), 271 esc_html( ShoppingFeedHelper::get_public_feed_url_with_generation() ), 272 ! empty( get_option( Generator::SF_FEED_LAST_GENERATION_DATE ) ) ? esc_html( get_option( Generator::SF_FEED_LAST_GENERATION_DATE ) ) : esc_html( 'Never' ) 273 ); 269 $sf_feed_public_url = ShoppingFeedHelper::get_public_feed_url(); 270 $sf_process_running = ShoppingFeedHelper::generation_process_running(); 271 $sf_last_generation_date = get_option( Generator::SF_FEED_LAST_GENERATION_DATE ); 272 ?> 273 <?php if ( ! $sf_process_running ) : ?> 274 <a href="<?php echo esc_html( $sf_feed_public_url ); ?>" target="_blank"> 275 <?php 276 echo esc_url( $sf_feed_public_url ); 277 ; 278 ?> 279 </a> 280 <?php endif; ?> 281 <br> 282 <p> 283 <?php if ( ! $sf_process_running ) : ?> 284 <?php esc_html_e( 'Last update', 'shopping-feed' ); ?> : 285 <?php 286 ! empty( $sf_last_generation_date ) ? esc_html( $sf_last_generation_date ) : esc_html_e( 'Never', 'shopping-feed' ); 287 ?> 288 <a href="<?php echo esc_url( ShoppingFeedHelper::get_public_feed_url_with_generation() ); ?>" target="_blank"> 289 <?php esc_html_e( 'Refresh', 'shopping-feed' ); ?> 290 </a> 291 <?php else : ?> 292 <strong>(<?php esc_html_e( 'The feed is update is running', 'shopping-feed' ); ?>) <a href="#" onClick="window.location.reload();"><?php esc_html_e( 'Refresh to check progress', 'shopping-feed' ); ?></a></strong> 293 <?php endif; ?> 294 </p> 295 <?php 274 296 }, 275 297 self::SF_ACCOUNT_SETTINGS_PAGE, … … 318 340 echo wp_kses_post( $requirements->openssl_requirement() ); 319 341 echo wp_kses_post( $requirements->account_requirement() ); 342 echo wp_kses_post( $requirements->uploads_directory_access_requirement() ); 320 343 ?> 321 344 <!-- REQUIREMENTS --> … … 330 353 </div> 331 354 <?php 355 } 356 357 /** 358 * Check clean action 359 */ 360 private function check_clean_action() { 361 if ( ! empty( $_GET['clean_process'] ) ) { 362 ShoppingFeedHelper::clean_generation_process_running(); 363 } 364 } 365 366 private function load_assets() { 367 wp_enqueue_style( 368 'sf_app', 369 SF_PLUGIN_URL . 'assets/css/app.css', 370 array(), 371 true 372 ); 373 374 wp_enqueue_script( 375 'multi_js', 376 SF_PLUGIN_URL . 'assets/js/multi.min.js', 377 array( 'jquery' ), 378 true, 379 true 380 ); 381 382 wp_enqueue_script( 'multi_js_init', SF_PLUGIN_URL . 'assets/js/init.js', array( 'multi_js' ), true ); 383 wp_localize_script( 384 'multi_js_init', 385 'sf_options', 386 array( 387 'selected_orders' => __( 'Selected order status', 'shopping-feed' ), 388 'unselected_orders' => __( 'Unselected order status', 'shopping-feed' ), 389 'search' => __( 'Search', 'shopping-feed' ), 390 ) 391 ); 332 392 } 333 393 … … 479 539 <p class="description" 480 540 id="tagline-description"><?php echo esc_attr_e( 'Frequency to generate the feed (usually 6h)', 'shopping-feed' ); ?></p> 541 <?php 542 }, 543 self::SF_FEED_SETTINGS_PAGE, 544 'sf_feed_settings_frequency' 545 ); 546 547 add_settings_field( 548 'Batch size', 549 __( 'Batch size', 'shopping-feed' ), 550 function () { 551 $running_process = ShoppingFeedHelper::get_running_generation_feed_process(); 552 $running_process = is_array( $running_process ) ? count( $running_process ) : 0; 553 ?> 554 <select name="<?php echo esc_html( sprintf( '%s[part_size]', self::SF_FEED_OPTIONS ) ); ?>"> 555 <?php 556 foreach ( array( 10, 20, 50, 100, 200, 500, 1000 ) as $part_size_option ) { 557 ?> 558 <option 559 value="<?php echo esc_html( $part_size_option ); ?>" 560 <?php selected( $part_size_option, $this->sf_feed_options['part_size'] ? $this->sf_feed_options['part_size'] : false ); ?> 561 ><?php echo esc_html( $part_size_option ); ?></option> 562 <?php 563 } 564 ?> 565 </select> 566 <p class="description" id="tagline-description"> 567 <?php esc_attr_e( 'Batch size (default 200 to decrease in case of performance issues)', 'shopping-feed' ); ?> 568 </p> 569 <p class="description"> 570 <?php esc_attr_e( 'If the feed is blocked and not generated', 'shopping-feed' ); ?> 571 <a href="<?php echo sprintf( '%s&clean_process=true', esc_url( ShoppingFeedHelper::get_setting_link() ) ); ?>" class="button-link-delete"><?php esc_attr_e( 'click here', 'shopping-feed' ); ?></a> 572 <?php esc_attr_e( 'to clean all running process', 'shopping-feed' ); ?> 573 <?php echo esc_html( sprintf( '(%s)', $running_process ) ); ?> 574 </p> 481 575 <?php 482 576 }, … … 555 649 </div> 556 650 <?php 651 } 652 653 /** 654 * Check connection with SF platform with correct credentials 655 * If not redirect to Account page 656 */ 657 private function check_connection() { 658 if ( ! ShoppingFeedHelper::is_authenticated() ) { 659 wp_safe_redirect( sprintf( '%s&no_connected=%s', ShoppingFeedHelper::get_setting_link(), 'true' ) ); 660 } 557 661 } 558 662 … … 832 936 } 833 937 834 /**835 * Check connection with SF platform with correct credentials836 * If not redirect to Account page837 */838 private function check_connection() {839 if ( ! ShoppingFeedHelper::is_authenticated() ) {840 wp_safe_redirect( sprintf( '%s&no_connected=%s', ShoppingFeedHelper::get_setting_link(), 'true' ) );841 }842 }843 844 private function load_assets() {845 wp_enqueue_style(846 'sf_app',847 SF_PLUGIN_URL . 'assets/css/app.css',848 array(),849 true850 );851 852 wp_enqueue_script(853 'multi_js',854 SF_PLUGIN_URL . 'assets/js/multi.min.js',855 array( 'jquery' ),856 true,857 true858 );859 860 wp_enqueue_script( 'multi_js_init', SF_PLUGIN_URL . 'assets/js/init.js', array( 'multi_js' ), true );861 wp_localize_script(862 'multi_js_init',863 'sf_options',864 array(865 'selected_orders' => __( 'Selected order status', 'shopping-feed' ),866 'unselected_orders' => __( 'Unselected order status', 'shopping-feed' ),867 'search' => __( 'Search', 'shopping-feed' ),868 )869 );870 }871 872 938 } -
shopping-feed/trunk/src/Admin/Requirements.php
r2417980 r2542211 7 7 8 8 use ShoppingFeed\ShoppingFeedWC\ShoppingFeedHelper; 9 use const OPENSSL_VERSION_TEXT;10 9 use const PHP_VERSION; 11 10 … … 90 89 } 91 90 91 92 /** 93 * @return string 94 */ 95 public function uploads_directory_access_requirement() { 96 return ( $this->uploads_directory_writable() ) 97 ? '<p class="success">' . __( 'You have write access in uploads directory.', 'shopping-feed' ) . '</p>' 98 : '<p class="failed">' . __( 'You must have write access in uploads directory.', 'shopping-feed' ) . '</p>'; 99 } 100 92 101 /** 93 102 * Check if CURL is available and support SSL … … 135 144 return ShoppingFeedHelper::is_authenticated(); 136 145 } 146 147 /** 148 * Check if the uploads directory is writable 149 * 150 * @return bool 151 */ 152 public function uploads_directory_writable() { 153 return is_writable( wp_upload_dir()['basedir'] ); 154 } 137 155 } -
shopping-feed/trunk/src/Admin/WoocommerceActions.php
r2404199 r2542211 10 10 use ShoppingFeed\Sdk\Api\Catalog\PricingUpdate; 11 11 use ShoppingFeed\Sdk\Api\Store\StoreResource; 12 use ShoppingFeed\ShoppingFeedWC\Feed\AsyncGenerator; 12 13 use ShoppingFeed\ShoppingFeedWC\Feed\Generator; 13 14 use ShoppingFeed\ShoppingFeedWC\Orders\Operations; … … 37 38 38 39 public function __construct() { 40 41 //Generate async feed 42 add_action( 43 'sf_feed_generation_process', 44 [ 45 AsyncGenerator::get_instance(), 46 'launch', 47 ] 48 ); 49 50 //Generate feed part 51 add_action( 52 'sf_feed_generation_part', 53 [ 54 AsyncGenerator::get_instance(), 55 56 'generate_feed_part', 57 ], 58 10, 59 2 60 ); 61 62 //Combine feed's parts 63 add_action( 64 'sf_feed_generation_combine_feed_parts', 65 [ 66 AsyncGenerator::get_instance(), 67 'combine_feed_parts', 68 ] 69 ); 39 70 40 71 //Product Update -
shopping-feed/trunk/src/Feed/Generator.php
r2422339 r2542211 32 32 * @var ProductGenerator 33 33 */ 34 pr ivate$generator;34 protected $generator; 35 35 36 36 /** 37 37 * Generator constructor. 38 38 */ 39 p rivatefunction __construct() {39 public function __construct() { 40 40 $this->set_platform(); 41 41 $this->set_uri(); … … 79 79 * This can be achieved in mappers or in your dataset, but sometimes things have to be separated, so you can register processors that are executed before mappers, and prepare your data before the mapping process. 80 80 */ 81 pr ivatefunction set_processors() {81 protected function set_processors() { 82 82 } 83 83 … … 86 86 * Filters are executed after processors, because item must be completely filled before to make the decision to keep it or not. 87 87 */ 88 pr ivatefunction set_filters() {88 protected function set_filters() { 89 89 # Ignore all items with undefined price 90 90 $this->generator->addFilter( … … 103 103 * As stated above, at least one mapper must be registered, this is where you populate the Product instance, which is later converted to XML by the library 104 104 */ 105 pr ivatefunction set_mappers() {105 protected function set_mappers() { 106 106 //Simple product mapping 107 107 $this->generator->addMapper( … … 234 234 235 235 if ( true === $no_cache || ! is_file( $file_path ) ) { 236 $generate = $this->generate(); 237 if ( is_wp_error( $generate ) ) { 238 ShoppingFeedHelper::get_logger()->error( 239 sprintf( 240 __( 'Cant display feed', 'shopping-feed' ) 241 ), 242 array( 243 'source' => 'shopping-feed', 244 ) 245 ); 246 } 236 if ( ShoppingFeedHelper::generation_process_running() ) { 237 wp_die( 'Feed generation already launched' ); 238 } 239 as_schedule_single_action( 240 false, 241 'sf_feed_generation_process', 242 array(), 243 'sf_feed_generation_process' 244 ); 245 wp_die( 'Feed generation launched' ); 247 246 } 248 247 -
shopping-feed/trunk/src/Feed/Uri.php
r2417980 r2542211 135 135 */ 136 136 public function set_file_path() { 137 $this->file_path = $this->directory . $this->file_name;137 $this->file_path = $this->directory . '/' . $this->file_name; 138 138 } 139 139 -
shopping-feed/trunk/src/Orders/Operations.php
r2339808 r2542211 121 121 $this->sf_channel_name, 122 122 ShoppingFeedHelper::get_sf_carrier_from_wc_shipping( $this->wc_order ), 123 (string) $this->wc_order->get_meta( ShoppingFeedHelper::wc_tracking_number()),124 (string) $this->wc_order->get_meta( ShoppingFeedHelper::wc_tracking_link())123 ShoppingFeedHelper::wc_tracking_number( $this->wc_order ), 124 ShoppingFeedHelper::wc_tracking_link( $this->wc_order ) 125 125 ); 126 126 $this->order_api->execute( $this->order_operation ); -
shopping-feed/trunk/src/Orders/Order.php
r2422339 r2542211 80 80 //Addresses 81 81 $wc_order->set_address( $this->shipping_address, 'shipping' ); 82 $wc_order->set_address( $this->billing_address , 'billing');82 $wc_order->set_address( $this->billing_address ); 83 83 84 84 //Payment … … 167 167 $item->save(); 168 168 $wc_order->add_item( $item ); 169 do_action( 'sf_after_order_add_item', $item, $wc_order ); 169 170 } 170 171 } … … 205 206 $wc_order->save(); 206 207 208 do_action( 'sf_before_add_order', $wc_order ); 209 207 210 //Acknowledge the order so we will not get it next time 208 211 Operations::acknowledge_order( $wc_order->get_id(), $message ); -
shopping-feed/trunk/src/Orders/Order/Products.php
r2417980 r2542211 83 83 } 84 84 85 $default_args = array( 85 $sf_product_quantity = $sf_product->getQuantity(); 86 87 $args = array( 86 88 'name' => $wc_product->get_name(), 87 89 'tax_class' => $wc_product->get_tax_class(), … … 89 91 'variation_id' => $wc_product->is_type( 'variation' ) ? $wc_product->get_id() : 0, 90 92 'variation' => $wc_product->is_type( 'variation' ) ? $wc_product->get_attributes() : array(), 91 ); 92 93 $args = array( 94 'subtotal' => $sf_product->getUnitPrice(), 95 'total' => $sf_product->getTotalPrice(), 96 'quantity' => $sf_product->getQuantity(), 93 'subtotal' => $sf_product->getUnitPrice(), 94 'total' => $sf_product->getTotalPrice(), 95 'quantity' => $sf_product_quantity, 97 96 ); 98 97 … … 100 99 101 100 return array( 102 'args' => wp_parse_args( $args, $default_args ),103 'outofstock' => ! $this->validate_product( $wc_product, $sf_product ),101 'args' => $args, 102 'outofstock' => ! $this->validate_product( $wc_product, $sf_product_quantity ), 104 103 'product_quantity' => $wc_product_quantity, 105 'quantity_needed' => $sf_product ->getQuantity()- $wc_product_quantity,104 'quantity_needed' => $sf_product_quantity - $wc_product_quantity, 106 105 ); 107 106 } … … 109 108 /** 110 109 * @param $wc_product WC_Product 111 * @param $ sf_product OrderItem110 * @param $ordered_quantity int 112 111 * 113 112 * @return bool 114 113 */ 115 private function validate_product( $wc_product, $ sf_product) {116 //automatically validate product if backorders or allowed and managin stock is disabled114 private function validate_product( $wc_product, $ordered_quantity ) { 115 //automatically validate product if backorders or allowed and managing stock is disabled 117 116 if ( $wc_product->backorders_allowed() || ! $wc_product->managing_stock() ) { 118 117 return true; 119 118 } 120 119 121 return $ sf_product->getQuantity()<= $wc_product->get_stock_quantity();120 return $ordered_quantity <= $wc_product->get_stock_quantity(); 122 121 } 123 122 -
shopping-feed/trunk/src/Products/Products.php
r2540628 r2542211 42 42 } 43 43 44 /** 45 * Generate products list 46 */ 47 public function get_list() { 44 public function get_list_args() { 48 45 $default_args = array( 49 46 'limit' => - 1, … … 66 63 } 67 64 68 $args = wp_parse_args( ShoppingFeedHelper::wc_products_custom_query_args(), $default_args ); 65 return wp_parse_args( ShoppingFeedHelper::wc_products_custom_query_args(), $default_args ); 66 } 69 67 70 $query = new \WC_Product_Query( $args ); 68 /** 69 * Generate products list 70 */ 71 public function get_list() { 72 $products = $this->get_products(); 71 73 72 if ( ! empty( $ query->get_products()) ) {73 foreach ( $ query->get_products()as $wc_product ) {74 yield [ new Product( $wc_product ) ];74 if ( ! empty( $products ) ) { 75 foreach ( $products as $wc_product ) { 76 yield array( new Product( $wc_product ) ); 75 77 } 76 78 } 77 79 } 80 81 public function get_products( $args = array() ) { 82 $query = new \WC_Product_Query( wp_parse_args( $args, $this->get_list_args() ) ); 83 84 return $query->get_products(); 85 } 86 87 88 public function format_products( $wc_products ) { 89 foreach ( $wc_products as $wc_product ) { 90 yield array( new Product( $wc_product ) ); 91 } 92 } 93 78 94 } -
shopping-feed/trunk/src/ShoppingFeed.php
r2417980 r2542211 207 207 public static function activate() { 208 208 if ( defined( 'WC_VERSION' ) ) { 209 self::add_sf_directory(); 209 210 Actions::register_feed_generation(); 210 211 Actions::register_get_orders(); … … 241 242 delete_option( Options::SF_CARRIERS ); 242 243 delete_option( Generator::SF_FEED_LAST_GENERATION_DATE ); 243 ( new \WP_Filesystem_Direct( false ) )->rmdir( ShoppingFeedHelper::get_feed_directory(), true ); 244 self::remove_sf_directory(); 245 } 246 247 public static function remove_sf_directory() { 248 rmdir( ShoppingFeedHelper::get_feed_directory() ); 249 } 250 251 public static function add_sf_directory() { 252 $directory = ShoppingFeedHelper::get_feed_directory(); 253 if ( ! is_dir( $directory ) ) { 254 wp_mkdir_p( $directory ); 255 } 256 $part_directory = ShoppingFeedHelper::get_feed_parts_directory(); 257 if ( ! is_dir( $part_directory ) ) { 258 wp_mkdir_p( $part_directory ); 259 } 244 260 } 245 261 } -
shopping-feed/trunk/src/ShoppingFeedHelper.php
r2430999 r2542211 20 20 21 21 /** 22 * @var ShoppingFeedHelper 23 */ 24 private static $instance; 25 26 /** 27 * Get the singleton instance. 28 * 29 * @return ShoppingFeedHelper 30 */ 31 public static function get_instance() { 32 if ( is_null( self::$instance ) ) { 33 self::$instance = new self(); 34 } 35 36 return self::$instance; 37 } 38 39 /** 40 * Singleton instance can't be cloned. 41 */ 42 private function __clone() { 43 } 44 45 /** 46 * Singleton instance can't be serialized. 47 */ 48 private function __wakeup() { 49 } 50 51 /** 22 52 * Check if current WooCommerce version is below 3.8.0 23 53 * … … 57 87 */ 58 88 public static function get_feed_directory() { 59 $directory = wp_upload_dir()['basedir'] . '/shopping-feed/'; 60 if ( ! is_dir( $directory ) ) { 61 wp_mkdir_p( $directory ); 62 } 63 64 return $directory; 89 return SF_FEED_DIR; 90 } 91 92 /** 93 * Return the feed's parts directory 94 * @return string 95 */ 96 public static function get_feed_parts_directory() { 97 return SF_FEED_PARTS_DIR; 98 } 99 100 /** 101 * @return string 102 */ 103 public static function get_feed_skeleton() { 104 return <<<XML 105 <?xml version="1.0" encoding="UTF-8"?> 106 <catalog> 107 <metadata> 108 <platform>WooCommerce:5.1.0</platform> 109 <agent>shopping-feed-generator:1.0.0</agent> 110 <startedAt/> 111 <finishedAt/> 112 <invalid/> 113 <ignored/> 114 <written/> 115 </metadata> 116 </catalog> 117 XML; 65 118 } 66 119 … … 249 302 250 303 return $frequency; 304 } 305 306 /** 307 * Return SF feed part size 308 * default: 200 product per file 309 * @return int 310 */ 311 public static function get_sf_part_size() { 312 $part_size = self::get_sf_feed_options( 'part_size' ); 313 if ( empty( $part_size ) ) { 314 return 200; 315 } 316 317 return $part_size; 251 318 } 252 319 … … 576 643 /** 577 644 * Add filter for order tracking number meta key 578 * @return string 579 */ 580 public static function wc_tracking_number() { 581 return apply_filters( 'shopping_feed_tracking_number', '' ); 645 * 646 * @param \WC_Order $wc_order 647 * 648 * @return string 649 */ 650 public static function wc_tracking_number( $wc_order ) { 651 $tracking_number = apply_filters( 'shopping_feed_tracking_number', '', $wc_order ); 652 //COMPACT WITH OLD VERSION 653 if ( '6.0.19' <= SF_VERSION ) { 654 return (string) $wc_order->get_meta( $tracking_number ); 655 } 656 657 return $tracking_number; 582 658 } 583 659 584 660 /** 585 661 * Add filter for order tracking link meta key 586 * @return string 587 */ 588 public static function wc_tracking_link() { 589 return apply_filters( 'shopping_feed_tracking_link', '' ); 662 * 663 * @param \WC_Order $wc_order 664 * 665 * @return string 666 */ 667 public static function wc_tracking_link( $wc_order ) { 668 $tracking_link = apply_filters( 'shopping_feed_tracking_link', '', $wc_order ); 669 //COMPACT WITH OLD VERSION 670 if ( '6.0.19' <= SF_VERSION ) { 671 return (string) $wc_order->get_meta( $tracking_link ); 672 } 673 674 return $tracking_link; 590 675 } 591 676 … … 597 682 return 100; 598 683 } 684 685 /** 686 * Get running process list 687 * @return array|int 688 */ 689 public static function get_running_generation_feed_process() { 690 $action_scheduler = \ActionScheduler::store(); 691 692 return $action_scheduler->query_actions( 693 array( 694 'group' => 'sf_feed_generation_process', 695 'status' => $action_scheduler::STATUS_PENDING, 696 ) 697 ); 698 } 699 700 /** 701 * Check if a running generation process 702 * @return bool 703 */ 704 public static function generation_process_running() { 705 $process = self::get_running_generation_feed_process(); 706 707 return ! empty( $process ); 708 } 709 710 public static function clean_generation_process_running() { 711 try { 712 \ActionScheduler::store()->cancel_actions_by_group( 'sf_feed_generation_process' ); 713 } catch ( \Exception $exception ) { 714 self::get_logger()->error( 715 sprintf( 716 __( 'Cant remove running process', 'shopping-feed' ), 717 $exception->getMessage() 718 ), 719 array( 720 'source' => 'shopping-feed', 721 ) 722 ); 723 } 724 wp_safe_redirect( self::get_setting_link(), 302 ); 725 } 599 726 } -
shopping-feed/trunk/vendor/autoload.php
r2540628 r2542211 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit 4ab3512180e161131ad7b070b1a1643c::getLoader();7 return ComposerAutoloaderInit203372635d40bb0d59e0e62758357279::getLoader(); -
shopping-feed/trunk/vendor/composer/InstalledVersions.php
r2540628 r2542211 28 28 'root' => 29 29 array ( 30 'pretty_version' => '6.0. 18',31 'version' => '6.0. 18.0',30 'pretty_version' => '6.0.21', 31 'version' => '6.0.21.0', 32 32 'aliases' => 33 33 array ( 34 34 ), 35 'reference' => ' 5eee70b9b2b0801fb3bc9948e6ec7473eef31991',35 'reference' => 'd9351f54d26569ee01a6f81113857ada372a9a04', 36 36 'name' => 'shoppingfeed/shoppingfeed', 37 37 ), … … 133 133 'shoppingfeed/shoppingfeed' => 134 134 array ( 135 'pretty_version' => '6.0. 18',136 'version' => '6.0. 18.0',137 'aliases' => 138 array ( 139 ), 140 'reference' => ' 5eee70b9b2b0801fb3bc9948e6ec7473eef31991',135 'pretty_version' => '6.0.21', 136 'version' => '6.0.21.0', 137 'aliases' => 138 array ( 139 ), 140 'reference' => 'd9351f54d26569ee01a6f81113857ada372a9a04', 141 141 ), 142 142 'symfony/polyfill-intl-idn' => -
shopping-feed/trunk/vendor/composer/autoload_classmap.php
r2417980 r2542211 303 303 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Marketplaces\\Types\\AmazonBusiness' => $baseDir . '/src/Addons/Marketplaces/Types/AmazonBusiness.php', 304 304 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Marketplaces\\Types\\AmazonPrime' => $baseDir . '/src/Addons/Marketplaces/Types/AmazonPrime.php', 305 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Plugins\\ChainedProductsPlugin\\ChainedProducts' => $baseDir . '/src/Addons/Plugins/ChainedProductsPlugin/ChainedProducts.php', 305 306 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Shipping\\Marketplaces\\Cdiscount' => $baseDir . '/src/Addons/Shipping/Marketplaces/Cdiscount.php', 306 307 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Shipping\\Marketplaces\\Rdc' => $baseDir . '/src/Addons/Shipping/Marketplaces/Rdc.php', … … 314 315 'ShoppingFeed\\ShoppingFeedWC\\Admin\\WoocommerceFilters' => $baseDir . '/src/Admin/WoocommerceFilters.php', 315 316 'ShoppingFeed\\ShoppingFeedWC\\Cli\\FeedGeneration' => $baseDir . '/src/Cli/FeedGeneration.php', 317 'ShoppingFeed\\ShoppingFeedWC\\Feed\\AsyncGenerator' => $baseDir . '/src/Feed/AsyncGenerator.php', 316 318 'ShoppingFeed\\ShoppingFeedWC\\Feed\\Generator' => $baseDir . '/src/Feed/Generator.php', 317 319 'ShoppingFeed\\ShoppingFeedWC\\Feed\\Platform' => $baseDir . '/src/Feed/Platform.php', -
shopping-feed/trunk/vendor/composer/autoload_real.php
r2540628 r2542211 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 4ab3512180e161131ad7b070b1a1643c5 class ComposerAutoloaderInit203372635d40bb0d59e0e62758357279 6 6 { 7 7 private static $loader; … … 23 23 } 24 24 25 spl_autoload_register(array('ComposerAutoloaderInit 4ab3512180e161131ad7b070b1a1643c', 'loadClassLoader'), true, true);25 spl_autoload_register(array('ComposerAutoloaderInit203372635d40bb0d59e0e62758357279', 'loadClassLoader'), true, true); 26 26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); 27 spl_autoload_unregister(array('ComposerAutoloaderInit 4ab3512180e161131ad7b070b1a1643c', 'loadClassLoader'));27 spl_autoload_unregister(array('ComposerAutoloaderInit203372635d40bb0d59e0e62758357279', 'loadClassLoader')); 28 28 29 29 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 31 31 require __DIR__ . '/autoload_static.php'; 32 32 33 call_user_func(\Composer\Autoload\ComposerStaticInit 4ab3512180e161131ad7b070b1a1643c::getInitializer($loader));33 call_user_func(\Composer\Autoload\ComposerStaticInit203372635d40bb0d59e0e62758357279::getInitializer($loader)); 34 34 } else { 35 35 $map = require __DIR__ . '/autoload_namespaces.php'; … … 52 52 53 53 if ($useStaticLoader) { 54 $includeFiles = Composer\Autoload\ComposerStaticInit 4ab3512180e161131ad7b070b1a1643c::$files;54 $includeFiles = Composer\Autoload\ComposerStaticInit203372635d40bb0d59e0e62758357279::$files; 55 55 } else { 56 56 $includeFiles = require __DIR__ . '/autoload_files.php'; 57 57 } 58 58 foreach ($includeFiles as $fileIdentifier => $file) { 59 composerRequire 4ab3512180e161131ad7b070b1a1643c($fileIdentifier, $file);59 composerRequire203372635d40bb0d59e0e62758357279($fileIdentifier, $file); 60 60 } 61 61 … … 64 64 } 65 65 66 function composerRequire 4ab3512180e161131ad7b070b1a1643c($fileIdentifier, $file)66 function composerRequire203372635d40bb0d59e0e62758357279($fileIdentifier, $file) 67 67 { 68 68 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
shopping-feed/trunk/vendor/composer/autoload_static.php
r2540628 r2542211 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 4ab3512180e161131ad7b070b1a1643c7 class ComposerStaticInit203372635d40bb0d59e0e62758357279 8 8 { 9 9 public static $files = array ( … … 393 393 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Marketplaces\\Types\\AmazonBusiness' => __DIR__ . '/../..' . '/src/Addons/Marketplaces/Types/AmazonBusiness.php', 394 394 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Marketplaces\\Types\\AmazonPrime' => __DIR__ . '/../..' . '/src/Addons/Marketplaces/Types/AmazonPrime.php', 395 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Plugins\\ChainedProductsPlugin\\ChainedProducts' => __DIR__ . '/../..' . '/src/Addons/Plugins/ChainedProductsPlugin/ChainedProducts.php', 395 396 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Shipping\\Marketplaces\\Cdiscount' => __DIR__ . '/../..' . '/src/Addons/Shipping/Marketplaces/Cdiscount.php', 396 397 'ShoppingFeed\\ShoppingFeedWC\\Addons\\Shipping\\Marketplaces\\Rdc' => __DIR__ . '/../..' . '/src/Addons/Shipping/Marketplaces/Rdc.php', … … 404 405 'ShoppingFeed\\ShoppingFeedWC\\Admin\\WoocommerceFilters' => __DIR__ . '/../..' . '/src/Admin/WoocommerceFilters.php', 405 406 'ShoppingFeed\\ShoppingFeedWC\\Cli\\FeedGeneration' => __DIR__ . '/../..' . '/src/Cli/FeedGeneration.php', 407 'ShoppingFeed\\ShoppingFeedWC\\Feed\\AsyncGenerator' => __DIR__ . '/../..' . '/src/Feed/AsyncGenerator.php', 406 408 'ShoppingFeed\\ShoppingFeedWC\\Feed\\Generator' => __DIR__ . '/../..' . '/src/Feed/Generator.php', 407 409 'ShoppingFeed\\ShoppingFeedWC\\Feed\\Platform' => __DIR__ . '/../..' . '/src/Feed/Platform.php', … … 436 438 { 437 439 return \Closure::bind(function () use ($loader) { 438 $loader->prefixLengthsPsr4 = ComposerStaticInit 4ab3512180e161131ad7b070b1a1643c::$prefixLengthsPsr4;439 $loader->prefixDirsPsr4 = ComposerStaticInit 4ab3512180e161131ad7b070b1a1643c::$prefixDirsPsr4;440 $loader->classMap = ComposerStaticInit 4ab3512180e161131ad7b070b1a1643c::$classMap;440 $loader->prefixLengthsPsr4 = ComposerStaticInit203372635d40bb0d59e0e62758357279::$prefixLengthsPsr4; 441 $loader->prefixDirsPsr4 = ComposerStaticInit203372635d40bb0d59e0e62758357279::$prefixDirsPsr4; 442 $loader->classMap = ComposerStaticInit203372635d40bb0d59e0e62758357279::$classMap; 441 443 442 444 }, null, ClassLoader::class); -
shopping-feed/trunk/vendor/composer/installed.php
r2540628 r2542211 2 2 'root' => 3 3 array ( 4 'pretty_version' => '6.0. 18',5 'version' => '6.0. 18.0',4 'pretty_version' => '6.0.21', 5 'version' => '6.0.21.0', 6 6 'aliases' => 7 7 array ( 8 8 ), 9 'reference' => ' 5eee70b9b2b0801fb3bc9948e6ec7473eef31991',9 'reference' => 'd9351f54d26569ee01a6f81113857ada372a9a04', 10 10 'name' => 'shoppingfeed/shoppingfeed', 11 11 ), … … 107 107 'shoppingfeed/shoppingfeed' => 108 108 array ( 109 'pretty_version' => '6.0. 18',110 'version' => '6.0. 18.0',109 'pretty_version' => '6.0.21', 110 'version' => '6.0.21.0', 111 111 'aliases' => 112 112 array ( 113 113 ), 114 'reference' => ' 5eee70b9b2b0801fb3bc9948e6ec7473eef31991',114 'reference' => 'd9351f54d26569ee01a6f81113857ada372a9a04', 115 115 ), 116 116 'symfony/polyfill-intl-idn' =>
Note: See TracChangeset
for help on using the changeset viewer.