Plugin Directory

Changeset 2871518


Ignore:
Timestamp:
02/27/2023 08:42:30 AM (3 years ago)
Author:
bostateam
Message:

add cash collection orders

Location:
bosta-woocommerce
Files:
17 added
2 edited

Legend:

Unmodified
Added
Removed
  • bosta-woocommerce/trunk/bosta-woocommerce.php

    r2857320 r2871518  
    55 * Author: Bosta
    66 * Author URI: https://www.bosta.co/
    7  * Version: 2.9.5
     7 * Version: 2.9.6
    88 * Requires at least: 5.0
    99 * php version 7.0
     
    437437}
    438438
     439add_filter('bulk_actions-edit-shop_order', 'bosta_sync_cash_collection_orders', 20);
     440function bosta_sync_cash_collection_orders($actions)
     441{
     442    $actions['sync_cash_collection_orders'] = __('Send Cash Collection Orders', 'woocommerce');
     443    return $actions;
     444}
     445
    439446add_filter('bulk_actions-edit-shop_order', 'bosta_sync', 20);
    440447function bosta_sync($actions)
     
    447454function bosta_sync_handle($redirect_to, $action, $order_ids)
    448455{
    449     if ($action != 'sync_to_bosta') {
     456    if ($action != 'sync_to_bosta' && $action != 'sync_cash_collection_orders') {
    450457        return;
     458    } else if ($action == 'sync_cash_collection_orders') {
     459        $orderType = 15;
     460        $addressType = 'pickupAddress';
     461    } else if ($action == 'sync_to_bosta') {
     462        $orderType = 10;
     463        $addressType = 'dropOffAddress';
    451464    }
    452465    global $resultStates;
     
    487500            $newOrder = new stdClass();
    488501            $newOrder->id = $order->id;
    489             $newOrder->type = 10;
     502            $newOrder->type = $orderType;
    490503            $newOrder->specs = new stdClass();
    491504            $newOrder
     
    533546                ->receiver->email = $order
    534547                ->billing->email;
    535             $newOrder->dropOffAddress = new stdClass();
     548            $newOrder->$addressType = new stdClass();
    536549            $newOrder
    537                 ->dropOffAddress->firstLine = $order
     550                ->$addressType->firstLine = $order
    538551                ->shipping->address_1;
    539552            if (is_numeric($order
     
    544557                    ->state]->districtId;
    545558                $newOrder
    546                     ->dropOffAddress->districtId = $shippingDistrictId;
     559                    ->$addressType->districtId = $shippingDistrictId;
    547560            } else {
    548561                $result = preg_split("/\s*(?<!\w(?=.\w))[\-[\]()]\s*/", $order
     
    555568                    ->city;
    556569                $newOrder
    557                     ->dropOffAddress->districtName = $shippingDistrictName;
     570                    ->$addressType->districtName = $shippingDistrictName;
    558571                $newOrder
    559                     ->dropOffAddress->zone = $shippingZoneName;
     572                    ->$addressType->zone = $shippingZoneName;
    560573                $newOrder
    561                     ->dropOffAddress->city = $shippingCityName;
     574                    ->$addressType->city = $shippingCityName;
    562575            }
    563576            if ($order->payment_method == 'cod') {
  • bosta-woocommerce/trunk/readme.txt

    r2857320 r2871518  
    77Requires PHP: 7.0
    88Tested up to: 6.1.1
    9 Stable tag: 2.9.5
     9Stable tag: 2.9.6
    1010WC requires at least: 2.6
    1111WC tested up to: 7.2.2
     
    144144= 2.9.5 =
    145145* Add Allow to Open Package Option
     146
     147= 2.9.6 =
     148* Add cash collection orders
Note: See TracChangeset for help on using the changeset viewer.