26 $this->externalFields =
$data;
38 $this->externalFields[
'ORDER'][$this->
getOrder()->getInternalId()]:[];
40 $this->fields[
'ORDER'] = array_merge(
47 public function basketNormalize()
52 foreach ($this->
getOrder()->getBasket() as $item)
54 $fields = $item->getFieldValues();
55 $externalFields = $this->externalFields[
'BASKET'][
'ITEMS'][$item->getInternalIndex()] ?? [];
58 foreach ($item->getPropertyCollection() as $property)
60 $props[] = $property->getFieldValues();
64 $reserveQuantityCollection = $item->getReserveQuantityCollection();
65 if ($reserveQuantityCollection !==
null)
67 foreach ($item->getReserveQuantityCollection() as $reserveQuantityCollectionItem)
69 $reservations[] = $reserveQuantityCollectionItem->getFieldValues();
72 unset($reserveQuantityCollection);
74 $r[$item->getInternalIndex()] = array_merge(
79 'RESERVATIONS' => $reservations,
84 $this->fields[
'ORDER'][
'BASKET_ITEMS']=$r;
89 public function propertiesValueNormalize()
92 $propertyCollection = $this->
getOrder()->getPropertyCollection();
94 foreach ($propertyCollection as $property)
96 $externalFields = isset($this->externalFields[
'PROPERTIES'][$property->getInternalIndex()])?
97 $this->externalFields[
'PROPERTIES'][$property->getInternalIndex()]:[];
99 $r[$property->getInternalIndex()] = array_merge(
101 $property->getFieldValues()
104 $this->fields[
'ORDER'][
'PROPERTY_VALUES']=$r;
107 public function paymentsNormalize()
114 $this->externalFields[
'PAYMENTS'][
$payment->getInternalIndex()]:[];
116 $r[
$payment->getInternalIndex()] = array_merge(
121 $this->fields[
'ORDER'][
'PAYMENTS']=$r;
124 public function shipmentsNormalize()
128 foreach ($this->
getOrder()->getShipmentCollection() as $shipment)
131 if($shipment->isSystem())
134 $shipmentIndex = $shipment->getInternalIndex();
138 foreach ($shipment->getShipmentItemCollection() as $shipmentItem)
140 $itemIndex = $shipmentItem->getInternalIndex();
142 $storeCollection = $shipmentItem->getShipmentItemStoreCollection();
143 if ($storeCollection !==
null)
146 foreach ($shipmentItem->getShipmentItemStoreCollection() as $shipmentItemStore)
148 $externalFieldsSIS = $this->externalFields[
'SHIPMENTS'][$shipmentIndex][
'SHIPMENT_ITEMS'][$itemIndex][
'STORE'][$shipmentItemStore->getInternalIndex()] ?? [];
150 $stores[] = array_merge(
152 $shipmentItemStore->getFieldValues()
157 $externalFieldsSI = $this->externalFields[
'SHIPMENTS'][$shipmentIndex][
'SHIPMENT_ITEMS'][$itemIndex] ?? [];
159 $basketItems[] = array_merge(
161 $shipmentItem->getFieldValues(),
167 $externalFields = $this->externalFields[
'SHIPMENTS'][$shipmentIndex] ?? [];
169 $r[$shipmentIndex] = array_merge(
171 $shipment->getFieldValues(),
172 [
'SHIPMENT_ITEMS'=>$basketItems]
175 $this->fields[
'ORDER'][
'SHIPMENTS']= $r;
183 ->getApplyResult(
true);
184 if(is_array($list) && !empty($list))
186 $this->fields[
'ORDER'][
'DISCOUNTS'] = $list;
195 if(is_array($list) && !empty($list))
197 foreach ($list as $tax)
198 $this->fields[
'ORDER'][
'TAXES'][] = $tax;
202 public function tradeBindingsNormalize()
206 foreach($this->
getOrder()->getTradeBindingCollection() as $item)
208 $externalFields = isset($this->externalFields[
'TRADE_BINDINGS'][$item->getInternalIndex()])?
209 $this->externalFields[
'TRADE_BINDINGS'][$item->getInternalIndex()]:[];
213 $item->getFieldValues()
217 $this->fields[
'ORDER'][
'TRADE_BINDINGS']=$r;