Plugin Directory

Changeset 2389547


Ignore:
Timestamp:
09/28/2020 10:34:03 AM (6 years ago)
Author:
roberarec
Message:

check the order item

Location:
robera/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • robera/trunk/core/background_order_item_copy.php

    r2389057 r2389547  
    4545        // Send the order
    4646        $user_id = $order->get_user_id();
    47         $product = wc_get_product($order_item->get_product_id());
    4847        $properties = array(
    4948            'billing_email'       => $order->get_billing_email(),
     
    6261            'status'              => $order->get_status(),
    6362            'is_paid'             => in_array($order->get_status(), wc_get_is_paid_statuses()),
    64             'stock_status'        => $product->get_stock_status()
    6563        );
    6664
  • robera/trunk/core/recommender-admin.php

    r2389057 r2389547  
    5252    public function progressPercent($request)
    5353    {
    54         if (!get_option('recommender_api_target_order_items', 0)){
    55             $query = new \WC_Order_Query(array(
    56                 'limit' => -1,
    57                 'offset' => 0,
    58             ));
    59             $count=0;
    60             foreach (array_values($query->get_orders()) as $i => $order) {
    61                 $count+=count($order->get_items());
    62             }
    63             update_option('recommender_api_target_order_items', $count);
    64         }
    6554        $library_actions = ['order_item_copy', 'product_copy', 'user_copy'];
    6655        $target_actions = ['order_items', 'products', 'users'];
  • robera/trunk/core/recommender-plugin.php

    r2387003 r2389547  
    6969            add_action('woocommerce_after_cart_item_quantity_update', array(&$this, 'changeCartItemQuantity'), 10, 6 );
    7070            add_filter('woocommerce_hidden_order_itemmeta', array(&$this,'custom_woocommerce_hidden_order_itemmeta'), 10, 1);
     71            add_action( 'woocommerce_thankyou', array(&$this, 'change_product_status'), 10, 1 );
    7172        }
    7273    } // end of method -> __construct
     74
     75    function change_product_status($order_id){
     76        if(!$order_id)
     77            return;
     78        $items = wc_get_order($order_id)->get_items();
     79        foreach ($items as $item) {
     80            $item_id = $item->get_product_id();
     81            $this->bg_product_copy->pushToQueue($item_id);
     82            $this->bg_product_copy->save()->dispatch();
     83        }
     84    }
    7385
    7486    function custom_woocommerce_hidden_order_itemmeta($arr) {
     
    499511            foreach (array_values($orders) as $i => $order) {
    500512                $items = $order->get_items();
     513                update_option(
     514                    'recommender_api_target_order_items',
     515                    count($items)+get_option('recommender_api_target_order_items', 0)
     516                );
    501517                foreach ($items as $item) {
    502518                    $this->bg_order_item_copy->pushToQueue($item->get_id());
  • robera/trunk/readme.txt

    r2389057 r2389547  
    44License: GPLv2 or later
    55License URI: https://www.gnu.org/licenses/gpl-2.0.html
    6 Stable tag: 1.0.13
     6Stable tag: 1.0.14
    77Tested up to: 5.4.2
    88
  • robera/trunk/recommender.php

    r2389057 r2389547  
    1212 * Description:       This Plugins help you interact with your WooCommerce users smarter by recommend products and related-products to them according to their preferences.
    1313 * Text Domain:       robera-recommender
    14  * Version:           1.0.13
     14 * Version:           1.0.14
    1515 */
    1616
Note: See TracChangeset for help on using the changeset viewer.