Changeset 2056955
- Timestamp:
- 03/25/2019 02:21:58 PM (7 years ago)
- Location:
- channelengine-woocommerce/trunk
- Files:
-
- 4 edited
-
admin/class-channel-engine-api.php (modified) (2 diffs)
-
admin/class-channel-engine-base-class.php (modified) (1 diff)
-
admin/class-channel-engine-order-complete.php (modified) (1 diff)
-
woocommerce-channel-engine.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
channelengine-woocommerce/trunk/admin/class-channel-engine-api.php
r1896931 r2056955 107 107 if(!$ceOrderId) return; 108 108 109 if(!$update) { 109 if(!$update) 110 { 110 111 $shipment = new MerchantShipmentRequest(); 111 112 112 113 $shipment->setMerchantOrderNo($order->get_id()); 114 $shipment->setMerchantShipmentNo($order->get_id()); 113 115 $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 { 115 118 //Create shipment lines 116 119 $shipmentLine = new MerchantShipmentLineRequest(); … … 124 127 } 125 128 $shipment->setLines($shipmentLines); 126 $shipment->setMerchantShipmentNo($order->get_id());127 128 update_post_meta($order->get_id(),parent::PREFIX . '_shipment_created', true);129 129 } 130 130 else 131 { 131 132 $shipment = new MerchantShipmentTrackingRequest(); 133 } 132 134 133 135 $trackTrace = get_post_meta($order->get_id(), '_shipping_ce_track_and_trace', true); 134 if($trackTrace == "") //Don't send if no T&T is given135 return;136 136 if(empty($trackTrace)) $trackTrace = get_post_meta($order->get_id(), 'TrackAndTraceBarCode', true); 137 137 138 $shippingMethod = get_post_meta($order->get_id(), '_shipping_ce_shipping_method', true); 139 138 140 if(empty($shippingMethod) || $shippingMethod == "Other") 139 141 $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 140 150 $shipment->setTrackTraceNo($trackTrace); 141 151 $shipment->setMethod($shippingMethod); 142 152 143 try{ 153 try 154 { 144 155 //Post shipment status to channel engine 145 156 if(!$update) 157 { 146 158 $this->client->shipmentCreate($shipment); 159 update_post_meta($order->get_id(), parent::PREFIX . '_shipment_created', true); 160 } 147 161 else 162 { 148 163 $this->client->shipmentUpdate($wc_order_id, $shipment); 164 } 149 165 $order->add_order_note( parent::ORDER_COMPLETE_SUCCESS ); 150 }catch(Exception $e){ 166 } 167 catch(Exception $e) 168 { 151 169 //Add note to order that specifies the exception 152 170 $order->add_order_note( parent::PREFIX_ORDER_ERROR.$e->getMessage() ); -
channelengine-woocommerce/trunk/admin/class-channel-engine-base-class.php
r1843386 r2056955 10 10 11 11 const PREFIX = '_channel_engine'; 12 const PREFIX_ORDER_MESSAGE = 'ChannelEngine Plugin : '; 12 13 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'; 15 16 /** 16 17 * Fetch product 'category chain' -
channelengine-woocommerce/trunk/admin/class-channel-engine-order-complete.php
r1843386 r2056955 19 19 20 20 $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); 22 22 } 23 23 -
channelengine-woocommerce/trunk/woocommerce-channel-engine.php
r1896931 r2056955 4 4 Plugin URI: http://channelengine.net 5 5 Description: ChannelEngine plugin for WooCommerce 6 Version: 2. 2.06 Version: 2.3.0 7 7 Author: ChannelEngine 8 8 Author URI: http://channelengine.net
Note: See TracChangeset
for help on using the changeset viewer.