Plugin Directory

Changeset 3383093


Ignore:
Timestamp:
10/23/2025 06:27:55 AM (5 months ago)
Author:
arture
Message:

Version 2.2.4

Location:
order-picking-app/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • order-picking-app/trunk/admin/class-orderpickingapp-admin.php

    r3363062 r3383093  
    779779                $order->update_meta_data('user_claimed', $_POST['user_claimed']);
    780780                $order->save();
     781
     782                $orderpickingapp_apikey = get_option('orderpickingapp_apikey');
     783                if (!isset($orderpickingapp_apikey) || empty($orderpickingapp_apikey)){
     784
     785                    $data = array(
     786                        'platform'  => 'woocommerce',
     787                        'type'      => 'picker_assigned',
     788                        'message'   => __('New order assigned to picker: ' .$_POST['user_claimed'], 'orderpickingapp' ),
     789                    );
     790
     791                    $url = 'https://orderpickingapp.com/wp-json/picking/v1/send-push-message';
     792                    $ch = curl_init();
     793                    curl_setopt($ch, CURLOPT_URL, $url);
     794                    $headers = [
     795                        'Authorization: Bearer ' . $_POST['token'],
     796                        'Referer: ' . site_url(),
     797                        'Content-Type: application/json',
     798                    ];
     799                    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
     800                    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
     801                    curl_setopt($ch, CURLOPT_REFERER, site_url());
     802                    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     803                    $response = curl_exec($ch);
     804                    curl_close($ch);
     805                }
    781806            }
    782807        }
  • order-picking-app/trunk/includes/class-orderpickingapp.php

    r3372255 r3383093  
    18811881                                    if (isset($orderid) && strpos($orderid, 'find_') !== false) {
    18821882                                        $selected_orderid = str_replace('find_', '', $orderid);
    1883 
    18841883                                        if( $selected_orderid == $picking_order_id ){
    18851884                                            $picking_orders[] = $open_order;
     1885                                        }
     1886                                        else{
     1887                                            $custom_order_number = $open_order->get_meta('_alg_wc_full_custom_order_number');
     1888                                            if( !isset($custom_order_number) || empty($custom_order_number) ){
     1889                                                $custom_order_number = $open_order->get_meta('_order_number');
     1890                                            }
     1891                                            if( $selected_orderid == $custom_order_number ){
     1892                                                $picking_orders[] = $open_order;
     1893                                            }
    18861894                                        }
    18871895                                    }
     
    19011909                                    elseif (isset($orderid) && strpos($orderid, 'takeover') !== false) {
    19021910                                        $selected_orderid = str_replace('takeover_', '', $orderid);
    1903 
    19041911
    19051912                                        // Save new picking user
     
    21302137                                            $ordered_product_picking_locations = array_reverse($product_picking_locations);
    21312138                                            $picking_location = array_pop($ordered_product_picking_locations);
    2132 
    2133                                             $FullCategoryPath = get_term_parents_list($order_cat_id, 'pickingroute', array('separator' => ' / ', 'link' => false, 'format' => 'name'));
    21342139
    21352140                                            $picking_path = get_term_parents_list($order_cat_id, 'pickingroute', array('separator' => ' / ', 'link' => false, 'format' => 'name'));
     
    35253530    function getProduct($request)
    35263531    {
    3527 
    3528         global $woocommerce;
    3529 
    35303532        header('Access-Control-Allow-Origin: *');
    35313533        header("Access-Control-Allow-Methods: GET");
     
    35973599
    35983600                    $Products = array();
     3601                    $product_variations_amount = 0;
    35993602                    if (isset($product_ids[0])) {
    36003603                        foreach ($product_ids as $product_id) {
    36013604
    36023605                            $product_info = wc_get_product($product_id);
    3603 
    3604                             $product_details = $product_info->get_data();
    3605 
    3606                             $title = $product_info->get_name();
    36073606
    36083607                            $main_product_id = $product_id;
     
    36123611                            }
    36133612                            else{
     3613
    36143614                                // Skip variable parent/main product
     3615                                $product_variations = (array)$product_info->get_children();
     3616                                $product_variations_amount = count($product_variations);
    36153617                                if( $product_info->get_type() == 'variable' ) {
    3616                                     continue;
     3618
     3619                                    if( $product_variations_amount > 1 ) {
     3620                                        continue;
     3621                                    }
     3622                                    else{
     3623                                        $parent_id = $product_id;
     3624                                        $product_id = $product_variations[0];
     3625                                        $product_info = wc_get_product($product_id);
     3626                                    }
    36173627                                }
    36183628                            }
     3629
     3630
     3631                            $product_details = $product_info->get_data();
     3632
     3633                            $title = $product_info->get_name();
    36193634
    36203635                            // YOAST COMPATIBILITY
     
    36513666                            }
    36523667
    3653                             $product_picking_locations = wp_get_post_terms($product_id, 'pickingroute', array("orderby" => "parent"));
     3668                            $picking_path = '';
     3669                            $product_picking_locations = wp_get_post_terms($parent_id, 'pickingroute', array("orderby" => "parent"));
    36543670                            if (isset($product_picking_locations) && !empty($product_picking_locations)) {
    36553671                                $order_cat_id = end($product_picking_locations)->term_id;
    36563672                                $categories = wp_list_pluck($product_picking_locations, 'name');
     3673                                $picking_path = get_term_parents_list($order_cat_id, 'pickingroute', array('separator' => ' / ', 'link' => false, 'format' => 'name'));
     3674                                $picking_path = rtrim($picking_path, " / ");
    36573675                            }
    36583676
    36593677                            $thumbnail = get_the_post_thumbnail_url($main_product_id, 'medium');
    3660 
    3661                             $sku = $product_details['sku'];
    3662 
    3663                             if (empty($sku)) {
    3664                                 $sku = (string)$product_id;
    3665                                 $barcode = '';
    3666                             } else {
    3667                                 $barcode = $sku;
    3668                             }
    36693678
    36703679                            if (!empty($product_details['short_description'])) {
     
    37083717                            }
    37093718
     3719
     3720                            $sku = $product_details['sku'];
     3721                            if (empty($sku)) {
     3722                                $parent = wc_get_product($parent_id);
     3723                                $sku = (string)$product_id;
     3724                                $barcode = $parent ? $parent->get_sku() : (string)$product_id;
     3725                            } else {
     3726                                $barcode = $sku;
     3727                            }
     3728
     3729
    37103730                            if (strpos($thumbnail, "?")) {
    37113731                                $thumbnail = substr($thumbnail, 0, strpos($thumbnail, "?"));
     
    37223742
    37233743                            $allocated_qty = $this->get_allocated_qty_for_product($product_info);
     3744
     3745                            $picking_locations = [];
     3746                            $all_pickingroute_terms = get_terms(array('taxonomy' => 'pickingroute', 'orderby' => 'name'));
     3747                            if (isset($all_pickingroute_terms) && !empty($all_pickingroute_terms)) {
     3748                                foreach( $all_pickingroute_terms as $all_pickingroute_term ){
     3749                                    $term_parents_list = get_term_parents_list($all_pickingroute_term->term_id, 'pickingroute', array('separator' => ' / ', 'link' => false, 'format' => 'name'));
     3750                                    $picking_locations[$all_pickingroute_term->term_id] = rtrim($term_parents_list, "/ ");                                }
     3751                            }
    37243752
    37253753                            $product_data = array(
     
    37313759                                'barcode'           => $barcode,
    37323760                                'price'             => $price,
    3733                                 'stock'             => $stock,
    3734                                 'allocated_qty'     => $allocated_qty,
     3761                                'stock'             => (int)$stock,
     3762                                'allocated_qty'     => (int)$allocated_qty,
    37353763                                'order_cat'         => $order_cat_id,
    37363764                                'categories'        => implode(' / ', $categories),
     
    37383766                                'supplier'          => $supplier,
    37393767                                'supplier_sku'      => get_post_meta($product_id, 'opa_supplier_sku', true),
    3740                                 'picking_path'          => '',
    3741                                 'picking_locations' => [],
     3768                                'picking_path'      => $picking_path,
     3769                                'picking_locations' => $picking_locations,
    37423770                            );
    37433771                            $product_data = apply_filters('orderpickingapp_product_data', $product_data);
    3744 
    3745                             $picking_path = '';
    3746                             $opa_picking_location = get_post_meta($main_product_id, 'opa_picking_location', true);
    3747                             if( empty($opa_picking_location)) {
    3748 
    3749                                 $all_pickingroute_terms = get_terms(array('taxonomy' => 'pickingroute', 'orderby' => 'name'));
    3750                                 if (isset($all_pickingroute_terms) && !empty($all_pickingroute_terms)) {
    3751 
    3752                                     $ordered_product_picking_locations = [];
    3753                                     foreach( $all_pickingroute_terms as $all_pickingroute_term ){
    3754                                         $ordered_product_picking_locations[$all_pickingroute_term->term_id] = get_term_parents_list($all_pickingroute_term->term_id, 'pickingroute', array('separator' => ' / ', 'link' => false, 'format' => 'name'));
    3755                                     }
    3756 
    3757                                     $product_data['picking_locations'] = $ordered_product_picking_locations;
    3758                                 }
    3759                             }
    37603772
    37613773                            $product_data['second_barcode'] =  '';
     
    38643876        if (isset($orderpickingapp_order_status) && !empty($orderpickingapp_order_status)) {
    38653877            $order_statussen = (array)$orderpickingapp_order_status;
     3878            $order_statussen = apply_filters('orderpickingapp_order_statussen_for_allocated_qty', $order_statussen);
    38663879        }
    38673880        $statusPlaceholders = implode(',', array_fill(0, count($order_statussen), '%s'));
  • order-picking-app/trunk/orderpickingapp.php

    r3372255 r3383093  
    33 * Plugin Name:       Order Picking App
    44 * Description:       Make your life easier by using the Orderpicking App. You'll never be inefficient if the Orderpicking App is installed in your store. We assist you in all aspects of your webshop. From intelligent selecting to order packing, we have you covered. Connecting the Orderpicking App to your Woocommerce webshop is simple and quick. Within an hour, you'll be online with the Orderpicking App. You're able to pick and pack your orders three times faster and with greater accuracy.
    5  * Version:           2.2.3
     5 * Version:           2.2.4
    66 * Author:            Arture | PHP Professionals
    77 * Author URI:        http://arture.nl
  • order-picking-app/trunk/readme.txt

    r3372255 r3383093  
    55Requires at least: 6.0
    66Tested up to: 6.8.3
    7 Stable tag: 2.2.3
     7Stable tag: 2.2.4
    88Requires PHP: 8.0
    99License: GPLv2 or later
     
    5959== Changelog ==
    6060
     61= 2.2.4 =
     62* Fallback check on find_ product on custom order number/name
     63* Add picking locations to the GetProduct action
     64* Fallback on product search by SKU on parent product with one variation
     65* Allocated quantity field added
     66
    6167= 2.2.3 =
    6268* Updated features list and app description
Note: See TracChangeset for help on using the changeset viewer.