Plugin Directory

Changeset 2056955


Ignore:
Timestamp:
03/25/2019 02:21:58 PM (7 years ago)
Author:
channelengine
Message:

Push git updates

Location:
channelengine-woocommerce/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • channelengine-woocommerce/trunk/admin/class-channel-engine-api.php

    r1896931 r2056955  
    107107        if(!$ceOrderId) return;
    108108
    109         if(!$update) {
     109        if(!$update)
     110        {
    110111            $shipment = new MerchantShipmentRequest();
    111112
    112113            $shipment->setMerchantOrderNo($order->get_id());
     114            $shipment->setMerchantShipmentNo($order->get_id());
    113115            $shipmentLines = $shipment->getLines();
    114             foreach ($order->get_items() as $wc_line_item_id => $lineItem) {
     116            foreach ($order->get_items() as $wc_line_item_id => $lineItem)
     117            {
    115118                //Create shipment lines
    116119                $shipmentLine = new MerchantShipmentLineRequest();
     
    124127            }
    125128            $shipment->setLines($shipmentLines);
    126             $shipment->setMerchantShipmentNo($order->get_id());
    127 
    128             update_post_meta($order->get_id(),parent::PREFIX . '_shipment_created', true);
    129129        }
    130130        else
     131        {
    131132            $shipment = new MerchantShipmentTrackingRequest();
     133        }
    132134
    133135        $trackTrace = get_post_meta($order->get_id(), '_shipping_ce_track_and_trace', true);
    134         if($trackTrace == "") //Don't send if no T&T is given
    135             return;
    136136        if(empty($trackTrace)) $trackTrace = get_post_meta($order->get_id(), 'TrackAndTraceBarCode', true);
     137
    137138        $shippingMethod = get_post_meta($order->get_id(), '_shipping_ce_shipping_method', true);
     139
    138140        if(empty($shippingMethod) || $shippingMethod == "Other")
    139141            $shippingMethod = get_post_meta($order->get_id(), '_shipping_ce_shipping_method_other', true);
     142
     143        // Track / trace cannot be empty for non mail box parcels
     144        if(empty($trackTrace) && $shippingMethod != 'Briefpost')
     145        {
     146            $order->add_order_note(parent::PREFIX_ORDER_MESSAGE . 'Shipping method ' . $shippingMethod . ' requires a tracking code.');
     147            return;
     148        }
     149
    140150        $shipment->setTrackTraceNo($trackTrace);
    141151        $shipment->setMethod($shippingMethod);
    142152
    143         try{
     153        try
     154        {
    144155            //Post shipment status to channel engine
    145156            if(!$update)
     157            {
    146158                $this->client->shipmentCreate($shipment);
     159                update_post_meta($order->get_id(), parent::PREFIX . '_shipment_created', true);
     160            }
    147161            else
     162            {
    148163                $this->client->shipmentUpdate($wc_order_id, $shipment);
     164            }
    149165            $order->add_order_note( parent::ORDER_COMPLETE_SUCCESS );
    150         }catch(Exception $e){
     166        }
     167        catch(Exception $e)
     168        {
    151169            //Add note to order that specifies the exception
    152170            $order->add_order_note( parent::PREFIX_ORDER_ERROR.$e->getMessage() );
  • channelengine-woocommerce/trunk/admin/class-channel-engine-base-class.php

    r1843386 r2056955  
    1010
    1111    const PREFIX = '_channel_engine';
     12    const PREFIX_ORDER_MESSAGE = 'ChannelEngine Plugin : ';
    1213    const PREFIX_ORDER_ERROR = 'ChannelEngine Plugin - An unexpected error occured : ';
    13     const ORDER_COMPLETE_SUCCESS = 'ChannelEngine Plugin - Order moved to Completed status  successfully';
    14     const ORDER_CANCELLED_SUCCESS = 'ChannelEngine Plugin - Order moved to Cancelled status  successfully';
     14    const ORDER_COMPLETE_SUCCESS = 'ChannelEngine Plugin - Order moved to Completed status successfully';
     15    const ORDER_CANCELLED_SUCCESS = 'ChannelEngine Plugin - Order moved to Cancelled status successfully';
    1516    /**
    1617     * Fetch product 'category chain'
  • channelengine-woocommerce/trunk/admin/class-channel-engine-order-complete.php

    r1843386 r2056955  
    1919
    2020        $this->client = $client;
    21         add_action('woocommerce_order_status_completed', array($this,'post_shipment_complete_status') , 0, 1 );
     21        add_action('woocommerce_order_status_completed', array($this,'post_shipment_complete_status'), 5, 1);
    2222    }
    2323
  • channelengine-woocommerce/trunk/woocommerce-channel-engine.php

    r1896931 r2056955  
    44Plugin URI: http://channelengine.net
    55Description: ChannelEngine plugin for WooCommerce
    6 Version: 2.2.0
     6Version: 2.3.0
    77Author: ChannelEngine
    88Author URI: http://channelengine.net
Note: See TracChangeset for help on using the changeset viewer.