Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
shipment.php
1<?php
2
4
7
9{
10 //todo: multiply track numbers
11 public function convert($data)
12 {
13 $result = "";
14
15 if(!is_array($data))
16 throw new ArgumentTypeException("data", "array");
17
18 foreach($data as $item)
19 {
20 if(!isset($item["ORDER_ID"])
21 || !isset($item["ORDER_LINE_ITEM_ID"])
22 || !isset($item["DELIVERY_NAME"])
23 || !isset($item["TRACKING_NUMBER"])
24 )
25 {
26 throw new SystemException("Wrong structure of item in Shipment::convert()");
27 }
28
29 $result .= "\t<Shipment>\n".
30 "\t\t<OrderID>".$item["ORDER_ID"]."</OrderID>\n".
31 "\t\t<OrderLineItemID>".$item["ORDER_LINE_ITEM_ID"]."</OrderLineItemID>\n".
32 //"\t\t<ShippedTime>".$data["SHIPPED_TIME"]."</ShippedTime>\n".
33 "\t\t<ShipmentTracking>\n".
34 "\t\t\t<ShippingCarrier>".$item["DELIVERY_NAME"]."</ShippingCarrier>\n".
35 "\t\t\t<TrackingNumber>".$item["TRACKING_NUMBER"]."</TrackingNumber>\n".
36 "\t\t</ShipmentTracking>\n".
37 "\t</Shipment>\n";
38 }
39
40 return $result;
41 }
42}