Plugin Directory

Changeset 3313724


Ignore:
Timestamp:
06/18/2025 09:16:34 AM (9 months ago)
Author:
arture
Message:

Version 2.1.7

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

Legend:

Unmodified
Added
Removed
  • order-picking-app/trunk/admin/js/admin.js

    r3303480 r3313724  
    293293        var orderid = $(this).parent('.order_detail').attr('id');
    294294        var token = $(this).parent('.order_detail').attr('data-token');
    295         var shop = $(this).parent('.order_detail').attr('data-token');
     295        var shop = $(this).parent('.order_detail').attr('data-shop');
    296296
    297297        if (confirm('I have checked all the packing products and want to completed this order!')) {
  • order-picking-app/trunk/admin/partials/orderpickingapp-packing-page.php

    r3185485 r3313724  
    1313        $packing_orders = $OrderPickingApp->getPackingOrders();
    1414
     15        $shop = get_option('opa_subscription_id');
    1516        if( isset($packing_orders) && count($packing_orders) == 3 ): ?>
    1617            <h2>No open packing orders to collect!</h2>
     
    8384                <?php
    8485                foreach( $packing_orders as $packing_order ): ?>
    85                     <div id="<?php echo $packing_order['orderid']; ?>" class="order_detail" data-token="<?php echo $orderpickingapp_apikey; ?>" style="display: none; border: 1px solid #3dc2ff; border-radius: 5px; padding: 5px; margin-top: 25px;">
     86                    <div id="<?php echo $packing_order['orderid']; ?>" class="order_detail" data-token="<?php echo $orderpickingapp_apikey; ?>" data-token="<?php echo $shop; ?>" style="display: none; border: 1px solid #3dc2ff; border-radius: 5px; padding: 5px; margin-top: 25px;">
    8687
    8788                        <h2 style="text-align: center; color: #000;">#<?php echo ( isset($packing_order['order_number']) && !empty($packing_order['order_number']) )? $packing_order['order_number'] : $packing_order['orderid']; ?></h2>
  • order-picking-app/trunk/admin/partials/orderpickingapp-settings-page.php

    r3303480 r3313724  
    135135        }
    136136
     137        $shipping_methods = [];
     138        $zones = WC_Shipping_Zones::get_zones();
     139        foreach ($zones as $zone) {
     140            $zone_shipping_methods = $zone['shipping_methods'];
     141            foreach ($zone_shipping_methods as $method) {
     142                $shipping_methods[$method->id] = $method->get_method_title();
     143            }
     144        }
     145
     146        // Standaard verzendmethoden (zoals Flat Rate, Free Shipping, etc.)
     147        $default_methods = WC()->shipping()->get_shipping_methods();
     148        foreach ($default_methods as $method) {
     149            $shipping_methods[$method->id] = $method->get_method_title();
     150        }
     151
    137152        update_option('opa_subscription_id', $app_settings['subscription']['id']);
    138153
     
    260275                            <label  class="form-check-label" for="disable_product_combining"><?php echo __( 'Disable product combining by SKU/ID and process each order product as individual', 'orderpickingapp' ); ?></label>
    261276                        </div>
     277                        <div class="form-check">
     278                            <input type="checkbox" class="form-check-input" name="enable_pickup_list" value="yes" <?php echo (isset($app_settings['enable_pickup_list']) && $app_settings['enable_pickup_list'] == 'yes')? 'checked' : ''; ?>>
     279                            <label  class="form-check-label" for="enable_pickup_list"><?php echo __( 'Enable pickup list. Please select a custom shipping method below for pickup!', 'orderpickingapp' ); ?></label>
     280                        </div>
     281                        <select name="pickup_list_method">
     282                            <option value="">Select pickup method</option>
     283                            <?php
     284                            foreach ($shipping_methods as $method_id => $method_name){
     285                                echo '<option value="' . $method_id . '" ' . selected($method_id, $app_settings['pickup_list_method'], false) . '>' . esc_html($method_name) . '</option>';
     286                            }
     287                            ?>
     288                        </select>
    262289
    263290                        <h5>Packing order status (optional)</h5>
     
    273300                            // Ophalen van de eerder opgeslagen status-combinaties
    274301                            $order_status_mapping = get_option('packing_order_status_mapping', []);
    275 
    276                             $shipping_methods = [];
    277                             $zones = WC_Shipping_Zones::get_zones();
    278                             foreach ($zones as $zone) {
    279                                 $zone_shipping_methods = $zone['shipping_methods'];
    280                                 foreach ($zone_shipping_methods as $method) {
    281                                     $shipping_methods[$method->id] = $method->get_method_title();
    282                                 }
    283                             }
    284 
    285                             // Standaard verzendmethoden (zoals Flat Rate, Free Shipping, etc.)
    286                             $default_methods = WC()->shipping()->get_shipping_methods();
    287                             foreach ($default_methods as $method) {
    288                                 $shipping_methods[$method->id] = $method->get_method_title();
    289                             }
    290302                            foreach ($shipping_methods as $method_id => $method_name) :
    291303                                $selected_status = isset($order_status_mapping[$method_id]) ? $order_status_mapping[$method_id] : '';
  • order-picking-app/trunk/includes/class-orderpickingapp.php

    r3305817 r3313724  
    180180            'methods' => 'GET',
    181181            'callback' => array($this, 'requestPackingOrders'),
     182            'permission_callback' => '__return_true',
     183        ));
     184
     185        register_rest_route('picking/v1', '/get-pickup-orders', array(
     186            'methods' => 'GET',
     187            'callback' => array($this, 'requestPickupOrders'),
    182188            'permission_callback' => '__return_true',
    183189        ));
     
    10811087                        if (!empty($Order)) {
    10821088
    1083                             $Order->add_order_note('Order Picking App | Order packing completed by ' . $data['appuser']);
    1084                             $Order->update_meta_data('picking_status', $data['status']);
     1089
     1090                            $picking_status = 'completed';
     1091                            if( $data['status'] == 'completed' ){
     1092                                $Order->add_order_note('Order Picking App | Order packing completed by ' . $data['appuser']);
     1093                                $this->log('Order packing completed for order:  ' . $data['orderid'] . ' by ' . $data['appuser'], 'Info');
     1094
     1095                                $enable_pickup_list = get_option('enable_pickup_list');
     1096                                $pickup_list_method = get_option('pickup_list_method');
     1097                                if( isset($enable_pickup_list) && $enable_pickup_list == 'yes' && !empty($pickup_list_method) ) {
     1098
     1099                                    $picking_status = false;
     1100                                    foreach ( $Order->get_shipping_methods() as $shipping_item ) {
     1101                                        $method_id = $shipping_item->get_method_id();        // bv. 'local_pickup'
     1102                                        if ( $method_id === $pickup_list_method ) {
     1103                                            $picking_status = 'pickup';
     1104                                            break;
     1105                                        }
     1106                                    }
     1107                                }
     1108                            }
     1109                            if( $data['status'] == 'picked_up' ){
     1110                                $Order->add_order_note('Order Picking App | Order pickup handled by ' . $data['appuser']);
     1111                                $this->log('Order:  ' . $data['orderid'] . ' pickup handled by ' . $data['appuser'], 'Info');
     1112                                $picking_status = 'completed';
     1113                            }
     1114
     1115                            $Order->update_meta_data('picking_status', $picking_status);
    10851116                            $Order->update_meta_data('packer', $data['appuser']);
    10861117
    1087                             if (isset($data['status']) && $data['status'] == 'completed' && isset($auto_completed_order) && $auto_completed_order == 'yes') {
     1118                            if( $data['status'] == 'completed' && isset($auto_completed_order) && $auto_completed_order == 'yes') {
    10881119                                $Order->update_status('completed', 'Order Picking App | Status changed');
    10891120                            }
    10901121
    1091                             $this->log('Order packing completed for order:  ' . $data['orderid'] . ' by ' . $data['appuser'], 'Info');
    10921122                            $Order->save();
    10931123
     
    25642594
    25652595    public
    2566     function getPackingOrders($return = 'json')
     2596    function requestPickupOrders($request)
     2597    {
     2598
     2599        header('Access-Control-Allow-Origin: *');
     2600        header("Access-Control-Allow-Methods: GET");
     2601
     2602        $output = array();
     2603        $Products = array();
     2604        if (class_exists('WooCommerce')) {
     2605
     2606            $token = $request->get_param('token');
     2607
     2608            if (isset($token)) {
     2609
     2610                $orderpickingapp_apikey = get_option('orderpickingapp_apikey');
     2611                if (isset($orderpickingapp_apikey) && $token == $orderpickingapp_apikey) {
     2612                    $output = $this->getPackingOrders('pickup');
     2613                } else {
     2614                    header("HTTP/1.1 401 Unauthorized");
     2615                    exit;
     2616                }
     2617            } else {
     2618                header("HTTP/1.1 401 Unauthorized");
     2619                exit;
     2620            }
     2621        }
     2622
     2623        $this->log('Retrieving open Woocommerce orders with total amount of ' . count($Products), 'Info');
     2624        wp_send_json($output);
     2625        http_response_code(200);
     2626        exit;
     2627    }
     2628
     2629    public
     2630    function getPackingOrders( $type = 'packing' )
    25672631    {
    25682632
     
    26352699        $total_packing_orders = 0;
    26362700        $total_backorders = 0;
     2701        $total_pickup_orders = 0;
    26372702        if( count($all_open_orders) > 0 ) {
    26382703
    26392704            // COunt totals
    2640             foreach ($all_open_orders as $open_order) {
     2705            foreach ($all_open_orders as $order_index => $open_order) {
    26412706                $picking_status = $open_order->get_meta('picking_status');
    26422707
    2643                 // Fallback voor sitiatie met otrder gemarkeerd als 'completed' maar nog niet gepickt
     2708                // Fallback voor situatie met order gemarkeerd als 'completed' maar nog niet gepickt
    26442709                $user_claimed = $open_order->get_meta('user_claimed');
    26452710                if( $picking_status == 'completed' && (!isset($user_claimed) || empty($user_claimed)) ){
     
    26502715
    26512716                    case 'picking':
     2717                        $total_picking_orders++;
     2718                        unset($all_open_orders[$order_index]);
     2719                        break;
     2720
    26522721                    case '':
    26532722                        $total_picking_orders++;
     2723                        unset($all_open_orders[$order_index]);
    26542724                        break;
    26552725
     
    26632733                        }
    26642734                        $total_packing_orders++;
     2735                        if( $type != 'packing' ) {
     2736                            unset($all_open_orders[$order_index]);
     2737                        }
     2738                        break;
     2739
     2740                    case 'pickup':
     2741                        $total_pickup_orders++;
     2742                        if( $type != 'pickup' ) {
     2743                            unset($all_open_orders[$order_index]);
     2744                        }
     2745                        break;
     2746
     2747                    default:
     2748                        unset($all_open_orders[$order_index]);
    26652749                }
    26662750            }
    26672751
    2668             if ($total_packing_orders > 0){
     2752            if( count($all_open_orders) > 0 ) {
    26692753                foreach ($all_open_orders as $open_order) {
    2670                     $picking_status = $open_order->get_meta('picking_status');
    2671 
    2672                     switch ($picking_status) {
    2673                         case 'packing':
    2674                             $order = $open_order;
    2675                             $packing_order_id = $order->get_id();
    2676                             $order_datetime = str_replace('T', ' ', substr($order->get_date_created(), 0, 16));
    2677 
    2678                             $customer_note = $order->get_customer_note();
    2679                             $customer_note = apply_filters('orderpickingapp_order_note', $customer_note);
    2680 
    2681                             $total_items = $order->get_item_count();
    2682                             if (is_plugin_active('woocommerce-product-bundles/woocommerce-product-bundles.php')) {
    2683                                 $total_items = 0;
    2684                                 foreach ($order->get_items() as $item_id => $item) {
    2685                                     $product_id = $item->get_product_id();
    2686                                     $product_info = wc_get_product($product_id);
    2687                                     $product_type = $product_info->get_type();
    2688                                     if (!in_array($product_type, array('woosb', 'bundle', 'grouped'))) {
    2689                                         $total_items++;
    2690                                     }
    2691                                 }
    2692                             }
    2693 
    2694                             $fullname = $order->get_shipping_first_name() . ' ' . $order->get_shipping_last_name();
    2695                             $lastname = substr($order->get_shipping_first_name(), 0, 1) . '. ' . $order->get_shipping_last_name();
    2696                             if( strlen($lastname) < 3 ){
    2697                                 $fullname = $order->get_billing_first_name() . ' ' . $order->get_billing_last_name();
    2698                                 $lastname = substr($order->get_billing_first_name(), 0, 1) . '. ' . $order->get_billing_last_name();
    2699                             }
    2700 
    2701                             $custom_field = apply_filters('opa_custom_order_field', '', $packing_order_id);
    2702 
    2703                             $order_number = $packing_order_id;
    2704                             $custom_order_number = $order->get_meta('_alg_wc_full_custom_order_number');
    2705                             if( isset($custom_order_number) && !empty($custom_order_number) ){
    2706                                 $order_number = $custom_order_number;
    2707                             }
    2708                             else{
    2709                                 $custom_order_number = $order->get_meta('_order_number');
    2710                                 if( isset($custom_order_number) && !empty($custom_order_number) ){
    2711                                     $order_number = $custom_order_number;
    2712                                 }
    2713                             }
    2714 
    2715                             $order_prefix = get_option('order_prefix');
    2716                             if (isset($order_prefix) && !empty($order_prefix)) {
    2717                                 $order_number = $order_prefix . $order_number;
    2718                             }
    2719 
    2720                             $ordernote = $order->get_meta('ordernote');
    2721                             if (empty($custom_field)) {
    2722                                 $custom_field = $ordernote;
    2723                             }
    2724 
    2725                             $output[$packing_order_id] = array(
    2726                                 'orderid' => $packing_order_id,
    2727                                 'order_number' => $order_number,
    2728                                 'datetime' => $order_datetime,
    2729                                 'date' => substr($order_datetime, 5, 5),
    2730                                 'items' => $total_items,
    2731                                 'shipping' => $order->get_shipping_method(),
    2732                                 'total' => $currency_symbol . ' ' . $order->get_total(),
    2733                                 'notes' => $customer_note,
    2734                                 'fullname' => $fullname,
    2735                                 'lastname' => $lastname,
    2736                                 'onbackorder' => 'false',
    2737                                 'batch_id' => $order->get_meta('batch_id'),
    2738                                 'total_packing_orders' => $total_packing_orders,
    2739                                 'total_picking_orders' => $total_picking_orders,
    2740                                 'total_backorders' => $total_backorders,
    2741                                 'custom_field' => $custom_field,
    2742                                 'ordernote' => $ordernote,
     2754
     2755                    $order = $open_order;
     2756                    $packing_order_id = $order->get_id();
     2757                    $order_datetime = str_replace('T', ' ', substr($order->get_date_created(), 0, 16));
     2758
     2759                    $customer_note = $order->get_customer_note();
     2760                    $customer_note = apply_filters('orderpickingapp_order_note', $customer_note);
     2761
     2762                    $total_items = $order->get_item_count();
     2763                    if (is_plugin_active('woocommerce-product-bundles/woocommerce-product-bundles.php')) {
     2764                        $total_items = 0;
     2765                        foreach ($order->get_items() as $item_id => $item) {
     2766                            $product_id = $item->get_product_id();
     2767                            $product_info = wc_get_product($product_id);
     2768                            $product_type = $product_info->get_type();
     2769                            if (!in_array($product_type, array('woosb', 'bundle', 'grouped'))) {
     2770                                $total_items++;
     2771                            }
     2772                        }
     2773                    }
     2774
     2775                    $fullname = $order->get_shipping_first_name() . ' ' . $order->get_shipping_last_name();
     2776                    $lastname = substr($order->get_shipping_first_name(), 0, 1) . '. ' . $order->get_shipping_last_name();
     2777                    if( strlen($lastname) < 3 ){
     2778                        $fullname = $order->get_billing_first_name() . ' ' . $order->get_billing_last_name();
     2779                        $lastname = substr($order->get_billing_first_name(), 0, 1) . '. ' . $order->get_billing_last_name();
     2780                    }
     2781
     2782                    $custom_field = apply_filters('opa_custom_order_field', '', $packing_order_id);
     2783
     2784                    $order_number = $packing_order_id;
     2785                    $custom_order_number = $order->get_meta('_alg_wc_full_custom_order_number');
     2786                    if( isset($custom_order_number) && !empty($custom_order_number) ){
     2787                        $order_number = $custom_order_number;
     2788                    }
     2789                    else{
     2790                        $custom_order_number = $order->get_meta('_order_number');
     2791                        if( isset($custom_order_number) && !empty($custom_order_number) ){
     2792                            $order_number = $custom_order_number;
     2793                        }
     2794                    }
     2795
     2796                    $order_prefix = get_option('order_prefix');
     2797                    if (isset($order_prefix) && !empty($order_prefix)) {
     2798                        $order_number = $order_prefix . $order_number;
     2799                    }
     2800
     2801                    $ordernote = $order->get_meta('ordernote');
     2802                    if (empty($custom_field)) {
     2803                        $custom_field = $ordernote;
     2804                    }
     2805
     2806                    $output[$packing_order_id] = array(
     2807                        'orderid' => $packing_order_id,
     2808                        'order_number' => $order_number,
     2809                        'datetime' => $order_datetime,
     2810                        'date' => substr($order_datetime, 5, 5),
     2811                        'items' => $total_items,
     2812                        'shipping' => $order->get_shipping_method(),
     2813                        'total' => $currency_symbol . ' ' . $order->get_total(),
     2814                        'notes' => $customer_note,
     2815                        'fullname' => $fullname,
     2816                        'lastname' => $lastname,
     2817                        'onbackorder' => 'false',
     2818                        'batch_id' => $order->get_meta('batch_id'),
     2819                        'total_packing_orders' => $total_packing_orders,
     2820                        'total_picking_orders' => $total_picking_orders,
     2821                        'total_backorders' => $total_backorders,
     2822                        'custom_field' => $custom_field,
     2823                        'ordernote' => $ordernote,
     2824                    );
     2825
     2826                    foreach ($order->get_items() as $item_id => $item) {
     2827
     2828                        $product_id = $item->get_product_id();
     2829
     2830                        if (is_plugin_active('woocommerce-product-bundles/woocommerce-product-bundles.php')) {
     2831                            $product_info = wc_get_product($product_id);
     2832                            $product_type = $product_info->get_type();
     2833                            if (in_array($product_type, array('woosb', 'bundle', 'grouped'))) {
     2834                                continue;
     2835                            }
     2836                        }
     2837
     2838                        $title = $item->get_name();
     2839                        $product_title = explode(" - ", $title, 2)[0];
     2840
     2841                        $thumbnail = get_the_post_thumbnail_url($product_id, 'medium');
     2842
     2843                        $variation_id = $item->get_variation_id();
     2844                        if (isset($variation_id) && !empty($variation_id)) {
     2845                            $product_info = wc_get_product($variation_id);
     2846                            $product_details = $product_info->get_data();
     2847
     2848                            if (isset($product_details['image_id']) && !empty($product_details['image_id'])) {
     2849                                $thumbnail = wp_get_attachment_image_url($product_details['image_id']);
     2850                            }
     2851
     2852                            if (strpos($thumbnail, "?")) {
     2853                                $thumbnail = substr($thumbnail, 0, strpos($thumbnail, "?"));
     2854                            }
     2855                            if (!isset($thumbnail) || empty($thumbnail)) {
     2856                                $thumbnail = 'https://orderpickingapp.com/missing_product.jpg';
     2857                            }
     2858
     2859                            $product_data = array(
     2860                                'title' => $title,
     2861                                'product_title' => $product_title,
     2862                                'thumbnail' => $thumbnail,
     2863                                'quantity' => $item->get_quantity(),
     2864                                'status' => $item->get_meta('picking_status'),
     2865                                'backorder' => $item->get_meta('backorder'),
    27432866                            );
    2744 
    2745                             foreach ($order->get_items() as $item_id => $item) {
    2746 
    2747                                 $product_id = $item->get_product_id();
    2748 
    2749                                 if (is_plugin_active('woocommerce-product-bundles/woocommerce-product-bundles.php')) {
    2750                                     $product_info = wc_get_product($product_id);
    2751                                     $product_type = $product_info->get_type();
    2752                                     if (in_array($product_type, array('woosb', 'bundle', 'grouped'))) {
    2753                                         continue;
    2754                                     }
    2755                                 }
    2756 
    2757                                 $title = $item->get_name();
    2758                                 $product_title = explode(" - ", $title, 2)[0];
    2759 
    2760                                 $thumbnail = get_the_post_thumbnail_url($product_id, 'medium');
    2761 
    2762                                 $variation_id = $item->get_variation_id();
    2763                                 if (isset($variation_id) && !empty($variation_id)) {
    2764                                     $product_info = wc_get_product($variation_id);
    2765                                     $product_details = $product_info->get_data();
    2766 
    2767                                     if (isset($product_details['image_id']) && !empty($product_details['image_id'])) {
    2768                                         $thumbnail = wp_get_attachment_image_url($product_details['image_id']);
    2769                                     }
    2770 
    2771                                     if (strpos($thumbnail, "?")) {
    2772                                         $thumbnail = substr($thumbnail, 0, strpos($thumbnail, "?"));
    2773                                     }
    2774                                     if (!isset($thumbnail) || empty($thumbnail)) {
    2775                                         $thumbnail = 'https://orderpickingapp.com/missing_product.jpg';
    2776                                     }
    2777 
    2778                                     $product_data = array(
    2779                                         'title' => $title,
    2780                                         'product_title' => $product_title,
    2781                                         'thumbnail' => $thumbnail,
    2782                                         'quantity' => $item->get_quantity(),
    2783                                         'status' => $item->get_meta('picking_status'),
    2784                                         'backorder' => $item->get_meta('backorder'),
    2785                                     );
    2786                                 } else {
    2787 
    2788 
    2789                                     if (strpos($thumbnail, "?")) {
    2790                                         $thumbnail = substr($thumbnail, 0, strpos($thumbnail, "?"));
    2791                                     }
    2792                                     if (!isset($thumbnail) || empty($thumbnail)) {
    2793                                         $thumbnail = 'https://orderpickingapp.com/missing_product.jpg';
    2794                                     }
    2795 
    2796                                     $product_data = array(
    2797                                         'title' => $title,
    2798                                         'product_title' => $product_title,
    2799                                         'thumbnail' => $thumbnail,
    2800                                         'quantity' => $item->get_quantity(),
    2801                                         'status' => $item->get_meta('picking_status'),
    2802                                         'backorder' => $item->get_meta('backorder'),
    2803                                     );
    2804                                 }
    2805 
    2806                                 if ($product_data['backorder'] !== '0' && !empty($product_data['backorder'])) {
    2807                                     $output[$packing_order_id]['onbackorder'] = 'true';
    2808                                 }
    2809 
    2810                                 $variation_id = $item->get_variation_id();
    2811                                 if (isset($variation_id) && !empty($variation_id)) {
    2812                                     $product_info = wc_get_product($variation_id);
    2813                                     $product_details = $product_info->get_data();
    2814                                     $product_data['product_id'] = $variation_id;
    2815                                     $product_id = $variation_id;
    2816 
    2817                                     $sku = $product_details['sku'];
    2818                                     if (empty($sku)) {
    2819                                         $sku = get_post_meta($product_details['parent_id'], '_sku', true);
    2820                                     }
    2821 
    2822                                     if (!empty($product_details['short_description'])) {
    2823                                         $product_data['description'] = $product_details['short_description'];
    2824                                     } else {
    2825                                         $product_data['description'] = $product_details['description'];
    2826                                     }
    2827 
    2828 
    2829                                     $product_data['sku'] = $sku;
    2830                                     $product_data['price'] = get_post_meta($product_id, '_price', true);
    2831                                     $product_data['stock'] = $product_info->get_stock_quantity();
    2832 
    2833                                     if (empty($product_data['sku'])) {
    2834                                         $product_data['sku'] = $variation_id;
    2835                                     }
    2836                                 } elseif (isset($product_id) && !empty($product_id)) {
    2837                                     $product_info = wc_get_product($product_id);
    2838                                     $product_details = $product_info->get_data();
    2839                                     $product_id = $item->get_product_id();
    2840                                     $product_data['product_id'] = $product_id;
    2841 
    2842                                     $sku = $product_details['sku'];
    2843                                     if (empty($sku)) {
    2844                                         $sku = get_post_meta($product_details['$product_id'], '_sku', true);
    2845                                     }
    2846 
    2847                                     if (!empty($product_details['short_description'])) {
    2848                                         $product_data['description'] = $product_details['short_description'];
    2849                                     } else {
    2850                                         $product_data['description'] = $product_details['description'];
    2851                                     }
    2852 
    2853                                     $product_data['sku'] = $sku;
    2854                                     $product_data['price'] = get_post_meta($product_id, '_price', true);
    2855                                     $product_data['stock'] = $product_info->get_stock_quantity();
    2856 
    2857                                     if (empty($product_data['sku'])) {
    2858                                         $product_data['sku'] = $product_id;
    2859                                     }
    2860                                 } else {
    2861                                     $product_data['product_id'] = $item_id;
    2862                                     $product_data['description'] = 'Product don\'t exist in Woocommerce!';
    2863                                     $product_data['sku'] = $item_id;
    2864 
    2865                                     $price = $item->get_total() / $item->get_quantity();
    2866                                     if (isset($price) && !empty($price)) {
    2867                                         $price = $currency_symbol . ' ' . number_format($price, 2, ",", ".");
    2868                                     } else {
    2869                                         $price = '-';
    2870                                     }
    2871                                     $product_data['price'] = $price;
    2872                                     $product_data['stock'] = $item->get_quantity();
    2873 
    2874                                     if (empty($product_data['sku'])) {
    2875                                         $product_data['sku'] = $product_data['product_id'];
    2876                                     }
    2877                                 }
    2878 
    2879                                 $product_data['description'] = strip_tags($product_data['description'], '<p><a><strong><i>');
    2880                                 $product_data['description'] = str_replace(array("\r", "\n"), '', $product_data['description']);
    2881                                 if (strlen($product_data['description']) > 300) {
    2882                                     $product_data['description'] = substr($product_data['description'], 0, 300) . '...';
    2883                                 }
    2884 
    2885                                 // Niet aanwezig in Woocommerce
    2886                                 $product_data['product_reference'] = '';
    2887                                 $product_data['reference'] = '';
    2888 
    2889                                 if (empty($product_data['stock'])) {
    2890                                     $_backorders = $item->get_meta('_backorders');
    2891                                     if ($_backorders == 'yes') {
    2892                                         $product_data['stock'] = '0';
    2893                                     } else {
    2894                                         $product_data['stock'] = $item->get_quantity();
    2895                                     }
    2896                                 }
    2897 
    2898                                 $orderpickingapp_ean_field = get_option('orderpickingapp_ean_field');
    2899                                 $barcode = $sku;
    2900                                 if (isset($orderpickingapp_ean_field) && !empty($orderpickingapp_ean_field)) {
    2901                                     $barcode = get_post_meta($product_id, $orderpickingapp_ean_field, true);
    2902                                 }
    2903                                 $product_data['barcode'] = $barcode;
    2904 
    2905                                 $product_data['second_barcode'] =  '';
    2906                                 $orderpickingapp_additional_barcode_field = get_option('orderpickingapp_additional_barcode_field');
    2907                                 if (isset($orderpickingapp_additional_barcode_field) && !empty($orderpickingapp_additional_barcode_field)) {
    2908                                     $product_data['second_barcode'] =  get_post_meta($product_id, $orderpickingapp_additional_barcode_field, true);
    2909                                 }
    2910 
    2911                                 $product_data['box_amount'] =  '';
    2912                                 $orderpickingapp_additional_box_amount_field = get_option('orderpickingapp_additional_box_amount_field');
    2913                                 if (isset($orderpickingapp_additional_box_amount_field) && !empty($orderpickingapp_additional_box_amount_field)) {
    2914                                     $product_data['box_amount'] =  get_post_meta($product_id, $orderpickingapp_additional_box_amount_field, true);
    2915                                 }
    2916 
    2917                                 $identifier = $product_id;
    2918                                 $disable_product_combining = get_option('disable_product_combining');
    2919                                 if (isset($disable_product_combining) && $disable_product_combining == 'yes') {
    2920                                     $identifier = $item_id;
    2921                                 }
    2922 
    2923                                 if (isset($output[$packing_order_id]['products'][$identifier]['quantity'])) {
    2924                                     $output[$packing_order_id]['products'][$identifier]['quantity'] += $product_data['quantity'];
    2925                                 }
    2926                                 else {
    2927                                     $output[$packing_order_id]['products'][$identifier] = $product_data;
    2928                                 }
    2929 
    2930                                 $output[$packing_order_id]['products'][$identifier]['ordered'] = $output[$packing_order_id]['products'][$identifier]['quantity'];
    2931                                 $output[$packing_order_id]['products'][$identifier]['unpacked'] = $output[$packing_order_id]['products'][$identifier]['quantity'];
    2932                             }
    2933                             break;
     2867                        } else {
     2868
     2869
     2870                            if (strpos($thumbnail, "?")) {
     2871                                $thumbnail = substr($thumbnail, 0, strpos($thumbnail, "?"));
     2872                            }
     2873                            if (!isset($thumbnail) || empty($thumbnail)) {
     2874                                $thumbnail = 'https://orderpickingapp.com/missing_product.jpg';
     2875                            }
     2876
     2877                            $product_data = array(
     2878                                'title' => $title,
     2879                                'product_title' => $product_title,
     2880                                'thumbnail' => $thumbnail,
     2881                                'quantity' => $item->get_quantity(),
     2882                                'status' => $item->get_meta('picking_status'),
     2883                                'backorder' => $item->get_meta('backorder'),
     2884                            );
     2885                        }
     2886
     2887                        if ($product_data['backorder'] !== '0' && !empty($product_data['backorder'])) {
     2888                            $output[$packing_order_id]['onbackorder'] = 'true';
     2889                        }
     2890
     2891                        $variation_id = $item->get_variation_id();
     2892                        if (isset($variation_id) && !empty($variation_id)) {
     2893                            $product_info = wc_get_product($variation_id);
     2894                            $product_details = $product_info->get_data();
     2895                            $product_data['product_id'] = $variation_id;
     2896                            $product_id = $variation_id;
     2897
     2898                            $sku = $product_details['sku'];
     2899                            if (empty($sku)) {
     2900                                $sku = get_post_meta($product_details['parent_id'], '_sku', true);
     2901                            }
     2902
     2903                            if (!empty($product_details['short_description'])) {
     2904                                $product_data['description'] = $product_details['short_description'];
     2905                            } else {
     2906                                $product_data['description'] = $product_details['description'];
     2907                            }
     2908
     2909
     2910                            $product_data['sku'] = $sku;
     2911                            $product_data['price'] = get_post_meta($product_id, '_price', true);
     2912                            $product_data['stock'] = $product_info->get_stock_quantity();
     2913
     2914                            if (empty($product_data['sku'])) {
     2915                                $product_data['sku'] = $variation_id;
     2916                            }
     2917                        } elseif (isset($product_id) && !empty($product_id)) {
     2918                            $product_info = wc_get_product($product_id);
     2919                            $product_details = $product_info->get_data();
     2920                            $product_id = $item->get_product_id();
     2921                            $product_data['product_id'] = $product_id;
     2922
     2923                            $sku = $product_details['sku'];
     2924                            if (empty($sku)) {
     2925                                $sku = get_post_meta($product_details['$product_id'], '_sku', true);
     2926                            }
     2927
     2928                            if (!empty($product_details['short_description'])) {
     2929                                $product_data['description'] = $product_details['short_description'];
     2930                            } else {
     2931                                $product_data['description'] = $product_details['description'];
     2932                            }
     2933
     2934                            $product_data['sku'] = $sku;
     2935                            $product_data['price'] = get_post_meta($product_id, '_price', true);
     2936                            $product_data['stock'] = $product_info->get_stock_quantity();
     2937
     2938                            if (empty($product_data['sku'])) {
     2939                                $product_data['sku'] = $product_id;
     2940                            }
     2941                        } else {
     2942                            $product_data['product_id'] = $item_id;
     2943                            $product_data['description'] = 'Product don\'t exist in Woocommerce!';
     2944                            $product_data['sku'] = $item_id;
     2945
     2946                            $price = $item->get_total() / $item->get_quantity();
     2947                            if (isset($price) && !empty($price)) {
     2948                                $price = $currency_symbol . ' ' . number_format($price, 2, ",", ".");
     2949                            } else {
     2950                                $price = '-';
     2951                            }
     2952                            $product_data['price'] = $price;
     2953                            $product_data['stock'] = $item->get_quantity();
     2954
     2955                            if (empty($product_data['sku'])) {
     2956                                $product_data['sku'] = $product_data['product_id'];
     2957                            }
     2958                        }
     2959
     2960                        $product_data['description'] = strip_tags($product_data['description'], '<p><a><strong><i>');
     2961                        $product_data['description'] = str_replace(array("\r", "\n"), '', $product_data['description']);
     2962                        if (strlen($product_data['description']) > 300) {
     2963                            $product_data['description'] = substr($product_data['description'], 0, 300) . '...';
     2964                        }
     2965
     2966                        // Niet aanwezig in Woocommerce
     2967                        $product_data['product_reference'] = '';
     2968                        $product_data['reference'] = '';
     2969
     2970                        if (empty($product_data['stock'])) {
     2971                            $_backorders = $item->get_meta('_backorders');
     2972                            if ($_backorders == 'yes') {
     2973                                $product_data['stock'] = '0';
     2974                            } else {
     2975                                $product_data['stock'] = $item->get_quantity();
     2976                            }
     2977                        }
     2978
     2979                        $orderpickingapp_ean_field = get_option('orderpickingapp_ean_field');
     2980                        $barcode = $sku;
     2981                        if (isset($orderpickingapp_ean_field) && !empty($orderpickingapp_ean_field)) {
     2982                            $barcode = get_post_meta($product_id, $orderpickingapp_ean_field, true);
     2983                        }
     2984                        $product_data['barcode'] = $barcode;
     2985
     2986                        $product_data['second_barcode'] =  '';
     2987                        $orderpickingapp_additional_barcode_field = get_option('orderpickingapp_additional_barcode_field');
     2988                        if (isset($orderpickingapp_additional_barcode_field) && !empty($orderpickingapp_additional_barcode_field)) {
     2989                            $product_data['second_barcode'] =  get_post_meta($product_id, $orderpickingapp_additional_barcode_field, true);
     2990                        }
     2991
     2992                        $product_data['box_amount'] =  '';
     2993                        $orderpickingapp_additional_box_amount_field = get_option('orderpickingapp_additional_box_amount_field');
     2994                        if (isset($orderpickingapp_additional_box_amount_field) && !empty($orderpickingapp_additional_box_amount_field)) {
     2995                            $product_data['box_amount'] =  get_post_meta($product_id, $orderpickingapp_additional_box_amount_field, true);
     2996                        }
     2997
     2998                        $identifier = $product_id;
     2999                        $disable_product_combining = get_option('disable_product_combining');
     3000                        if (isset($disable_product_combining) && $disable_product_combining == 'yes') {
     3001                            $identifier = $item_id;
     3002                        }
     3003
     3004                        if (isset($output[$packing_order_id]['products'][$identifier]['quantity'])) {
     3005                            $output[$packing_order_id]['products'][$identifier]['quantity'] += $product_data['quantity'];
     3006                        }
     3007                        else {
     3008                            $output[$packing_order_id]['products'][$identifier] = $product_data;
     3009                        }
     3010
     3011                        $output[$packing_order_id]['products'][$identifier]['ordered'] = $output[$packing_order_id]['products'][$identifier]['quantity'];
     3012                        $output[$packing_order_id]['products'][$identifier]['unpacked'] = $output[$packing_order_id]['products'][$identifier]['quantity'];
    29343013                    }
    29353014                }
  • order-picking-app/trunk/orderpickingapp.php

    r3309569 r3313724  
    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.1.6
     5 * Version:           2.1.7
    66 * Author:            Arture | PHP Professionals
    77 * Author URI:        http://arture.nl
  • order-picking-app/trunk/readme.txt

    r3309569 r3313724  
    55Requires at least: 6.0
    66Tested up to: 6.8.1
    7 Stable tag: 2.1.6
     7Stable tag: 2.1.7
    88Requires PHP: 8.0
    99License: GPLv2 or later
     
    3737== Changelog ==
    3838
     39= 2.1.7 =
     40* Pickup settings and flow
     41* Bugfix with multiple subscriptions and desktop packing
     42
    3943= 2.1.6 =
    4044* Compatibility for old orders admin columns
Note: See TracChangeset for help on using the changeset viewer.