Plugin Directory

Changeset 3449395


Ignore:
Timestamp:
01/29/2026 09:25:34 AM (2 months ago)
Author:
bitsstech
Message:

bug fixes

Location:
shipment-tracker-for-woocommerce
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • shipment-tracker-for-woocommerce/tags/1.5.2.6/admin/class-bt-sync-shipment-tracking-admin.php

    r3446887 r3449395  
    30693069    {
    30703070        $bt_sst_product_days_field = isset($_POST['_bt_sst_product_days_field_' . $i]) ? sanitize_text_field($_POST['_bt_sst_product_processing_days_field_' . $i]) : '';
    3071         Bt_Sync_Shipment_Tracking::bt_sst_update_product_meta($variation_id, '_bt_sst_product_processing_days_field', $bt_sst_product_processing_days_field);
     3071        Bt_Sync_Shipment_Tracking::bt_sst_update_product_meta($variation_id, '_bt_sst_product_processing_days_field', $bt_sst_product_days_field);
    30723072    }
    30733073
  • shipment-tracker-for-woocommerce/tags/1.5.2.6/bt-sync-shipment-tracking.php

    r3446887 r3449395  
    1717 * Plugin URI:        https://shipment-tracker-for-woocommerce.bitss.tech/
    1818 * Description:       Most comprehensive shipment tracking plugin that extends your woocommerce store with shipment related features. Keeps you & your customers informed about shipment movement.
    19  * Version:           1.5.2.6
     19 * Version:           1.5.2.6.1
    2020 * Author:            Bitss Techniques
    2121 * Author URI:        https://shipment-tracker-for-woocommerce.bitss.tech
     
    5959
    6060define( 'Carbon_Fields\URL', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'vendor/htmlburger/carbon-fields/' );//fix for Bitnami installations.
    61 define( 'BT_SYNC_SHIPMENT_TRACKING_VERSION', '1.5.2.6' );
     61define( 'BT_SYNC_SHIPMENT_TRACKING_VERSION', '1.5.2.6.1' );
    6262define( 'BT_SHIPPING_PROVIDERS', array('delhivery' =>'Delhivery','nimbuspost' => 'Nimbuspost (Deprecated)','nimbuspost_new' => 'Nimbuspost','shipmozo'=>'Shipmozo','shiprocket' => 'Shiprocket', 'xpressbees' => 'Xpressbees', 'manual' =>'Custom Shipping', 'fship' => 'Fship','ekart' => 'Ekart','courierkaro' => 'Courier Karo') );
    6363define( 'BT_SHIPPING_PROVIDERS_WITH_NONE', array('none' =>'none','delhivery' =>'Delhivery', 'nimbuspost' => 'Nimbuspost (OLD)','nimbuspost_new' => 'Nimbuspost(NEW)','shipmozo'=>'Shipmozo','shiprocket' => 'Shiprocket', 'xpressbees' => 'Xpressbees','manual' =>'Custom Shipping' , 'fship' => 'Fship','ekart' => 'Ekart','courierkaro' => 'Courier Karo') );
  • shipment-tracker-for-woocommerce/tags/1.5.2.6/includes/class-bt-sync-shipment-tracking-rest-functions.php

    r3446887 r3449395  
    3434        return $this->shiprocket->shiprocket_webhook_receiver($request);
    3535    }
    36 
    3736    public function webhook_receiver_apex_create_wc_order( $request ) {
    3837
     
    5049            }
    5150
     51
    5252            $phone = wc_sanitize_phone_number( $data['order']['phone'] );
    53 
    54             $existing_orders = wc_get_orders([
    55                 'status'     => ['draft', 'wc-checkout-draft', 'checkout-draft'],
    56                 'limit'      => 1,
    57                 'orderby'    => 'date',
    58                 'order'      => 'DESC',
    59                 'meta_query' => [
    60                     [
    61                         'key'     => '_billing_phone',
    62                         'value'   => $phone,
    63                         'compare' => '='
    64                     ]
    65                 ]
    66             ]);
     53            $phone_value = (string) $phone;
     54            $args = [
     55                'status'        => ['wc-pending'],
     56                'limit'         => 1,
     57                'billing_phone' => $phone,
     58                'date_created'  => '>' .  (time() - 30 ),
     59            ];
     60
     61            $existing_orders = wc_get_orders( $args );
    6762
    6863            if ( ! empty( $existing_orders ) ) {
    6964                $order = $existing_orders[0];
    70                 $logger->info('Existing draft order #' . $order->get_id() . ' found for phone ' . $phone, $context);
     65                $logger->info('Existing Pending/Failed order #' . $order->get_id() . ' found for phone ' . $phone, $context);
    7166            } else {
    7267                $order = wc_create_order([
    73                     'status' => 'draft'
     68                    'status' => 'pending'
    7469                ]);
    7570
     
    108103            $order->add_item( $item );
    109104
     105            $order->update_meta_data( 'apex_order', 'true' );
    110106            $order->update_meta_data( '_invoice_number', $data['invoice number'] ?? '' );
     107
    111108            $order->add_order_note(
    112                 "APEX Webhook: New item added to this draft.\n" .
     109                "APEX Webhook: Item added.\n" .
    113110                "Item: {$data['item name']}\n" .
    114111                "Amount: ₹{$data['amount']}\n" .
     
    117114
    118115            $order->calculate_totals( false );
    119             $order->set_status( 'checkout-draft' );
    120116            $order->save();
    121117
     
    123119                'success' => true,
    124120                'woocommerce_order_id' => $order->get_id(),
    125                 'message' => 'Item successfully added to order'
     121                'message' => 'Item successfully added to pending order'
    126122            ], 200);
    127123
    128124        } catch ( Exception $e ) {
    129             $logger->critical(
    130                 'APEX webhook error: ' . $e->getMessage(),
    131                 $context
    132             );
     125            $logger->critical( 'APEX webhook error: ' . $e->getMessage(), $context );
    133126
    134127            return new WP_REST_Response([
  • shipment-tracker-for-woocommerce/trunk/admin/class-bt-sync-shipment-tracking-admin.php

    r3446887 r3449395  
    30693069    {
    30703070        $bt_sst_product_days_field = isset($_POST['_bt_sst_product_days_field_' . $i]) ? sanitize_text_field($_POST['_bt_sst_product_processing_days_field_' . $i]) : '';
    3071         Bt_Sync_Shipment_Tracking::bt_sst_update_product_meta($variation_id, '_bt_sst_product_processing_days_field', $bt_sst_product_processing_days_field);
     3071        Bt_Sync_Shipment_Tracking::bt_sst_update_product_meta($variation_id, '_bt_sst_product_processing_days_field', $bt_sst_product_days_field);
    30723072    }
    30733073
  • shipment-tracker-for-woocommerce/trunk/bt-sync-shipment-tracking.php

    r3446887 r3449395  
    1717 * Plugin URI:        https://shipment-tracker-for-woocommerce.bitss.tech/
    1818 * Description:       Most comprehensive shipment tracking plugin that extends your woocommerce store with shipment related features. Keeps you & your customers informed about shipment movement.
    19  * Version:           1.5.2.6
     19 * Version:           1.5.2.6.1
    2020 * Author:            Bitss Techniques
    2121 * Author URI:        https://shipment-tracker-for-woocommerce.bitss.tech
     
    5959
    6060define( 'Carbon_Fields\URL', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'vendor/htmlburger/carbon-fields/' );//fix for Bitnami installations.
    61 define( 'BT_SYNC_SHIPMENT_TRACKING_VERSION', '1.5.2.6' );
     61define( 'BT_SYNC_SHIPMENT_TRACKING_VERSION', '1.5.2.6.1' );
    6262define( 'BT_SHIPPING_PROVIDERS', array('delhivery' =>'Delhivery','nimbuspost' => 'Nimbuspost (Deprecated)','nimbuspost_new' => 'Nimbuspost','shipmozo'=>'Shipmozo','shiprocket' => 'Shiprocket', 'xpressbees' => 'Xpressbees', 'manual' =>'Custom Shipping', 'fship' => 'Fship','ekart' => 'Ekart','courierkaro' => 'Courier Karo') );
    6363define( 'BT_SHIPPING_PROVIDERS_WITH_NONE', array('none' =>'none','delhivery' =>'Delhivery', 'nimbuspost' => 'Nimbuspost (OLD)','nimbuspost_new' => 'Nimbuspost(NEW)','shipmozo'=>'Shipmozo','shiprocket' => 'Shiprocket', 'xpressbees' => 'Xpressbees','manual' =>'Custom Shipping' , 'fship' => 'Fship','ekart' => 'Ekart','courierkaro' => 'Courier Karo') );
  • shipment-tracker-for-woocommerce/trunk/includes/class-bt-sync-shipment-tracking-rest-functions.php

    r3446887 r3449395  
    3434        return $this->shiprocket->shiprocket_webhook_receiver($request);
    3535    }
    36 
    3736    public function webhook_receiver_apex_create_wc_order( $request ) {
    3837
     
    5049            }
    5150
     51
    5252            $phone = wc_sanitize_phone_number( $data['order']['phone'] );
    53 
    54             $existing_orders = wc_get_orders([
    55                 'status'     => ['draft', 'wc-checkout-draft', 'checkout-draft'],
    56                 'limit'      => 1,
    57                 'orderby'    => 'date',
    58                 'order'      => 'DESC',
    59                 'meta_query' => [
    60                     [
    61                         'key'     => '_billing_phone',
    62                         'value'   => $phone,
    63                         'compare' => '='
    64                     ]
    65                 ]
    66             ]);
     53            $phone_value = (string) $phone;
     54            $args = [
     55                'status'        => ['wc-pending'],
     56                'limit'         => 1,
     57                'billing_phone' => $phone,
     58                'date_created'  => '>' .  (time() - 30 ),
     59            ];
     60
     61            $existing_orders = wc_get_orders( $args );
    6762
    6863            if ( ! empty( $existing_orders ) ) {
    6964                $order = $existing_orders[0];
    70                 $logger->info('Existing draft order #' . $order->get_id() . ' found for phone ' . $phone, $context);
     65                $logger->info('Existing Pending/Failed order #' . $order->get_id() . ' found for phone ' . $phone, $context);
    7166            } else {
    7267                $order = wc_create_order([
    73                     'status' => 'draft'
     68                    'status' => 'pending'
    7469                ]);
    7570
     
    108103            $order->add_item( $item );
    109104
     105            $order->update_meta_data( 'apex_order', 'true' );
    110106            $order->update_meta_data( '_invoice_number', $data['invoice number'] ?? '' );
     107
    111108            $order->add_order_note(
    112                 "APEX Webhook: New item added to this draft.\n" .
     109                "APEX Webhook: Item added.\n" .
    113110                "Item: {$data['item name']}\n" .
    114111                "Amount: ₹{$data['amount']}\n" .
     
    117114
    118115            $order->calculate_totals( false );
    119             $order->set_status( 'checkout-draft' );
    120116            $order->save();
    121117
     
    123119                'success' => true,
    124120                'woocommerce_order_id' => $order->get_id(),
    125                 'message' => 'Item successfully added to order'
     121                'message' => 'Item successfully added to pending order'
    126122            ], 200);
    127123
    128124        } catch ( Exception $e ) {
    129             $logger->critical(
    130                 'APEX webhook error: ' . $e->getMessage(),
    131                 $context
    132             );
     125            $logger->critical( 'APEX webhook error: ' . $e->getMessage(), $context );
    133126
    134127            return new WP_REST_Response([
Note: See TracChangeset for help on using the changeset viewer.