26 $this->externalFields = $data;
38 $this->externalFields[
'ORDER'][$this->
getOrder()->getInternalId()]:[];
40 $this->fields[
'ORDER'] = array_merge(
46 public function basketNormalize()
50 foreach ($this->
getOrder()->getBasket() as $item)
52 $fields = $item->getFieldValues();
53 $externalFields = isset($this->externalFields[
'BASKET'][
'ITEMS'][$item->getInternalIndex()])?
54 $this->externalFields[
'BASKET'][
'ITEMS'][$item->getInternalIndex()]:[];
57 foreach ($item->getPropertyCollection() as $property)
59 $props[] = array_merge(
60 $property->getFieldValues()
64 $r[$item->getInternalIndex()] = array_merge(
67 [
'PROPERTIES'=>$props]
70 $this->fields[
'ORDER'][
'BASKET_ITEMS']=$r;
73 public function propertiesValueNormalize()
76 $propertyCollection = $this->
getOrder()->getPropertyCollection();
78 foreach ($propertyCollection as $property)
80 $externalFields = isset($this->externalFields[
'PROPERTIES'][$property->getInternalIndex()])?
81 $this->externalFields[
'PROPERTIES'][$property->getInternalIndex()]:[];
83 $r[$property->getInternalIndex()] = array_merge(
85 $property->getFieldValues()
88 $this->fields[
'ORDER'][
'PROPERTY_VALUES']=$r;
91 public function paymentsNormalize()
95 foreach($this->
getOrder()->getPaymentCollection() as $payment)
97 $externalFields = isset($this->externalFields[
'PAYMENTS'][$payment->getInternalIndex()])?
98 $this->externalFields[
'PAYMENTS'][$payment->getInternalIndex()]:[];
100 $r[$payment->getInternalIndex()] = array_merge(
102 $payment->getFieldValues()
105 $this->fields[
'ORDER'][
'PAYMENTS']=$r;
108 public function shipmentsNormalize()
112 foreach ($this->
getOrder()->getShipmentCollection() as $shipment)
115 if($shipment->isSystem())
120 foreach ($shipment->getShipmentItemCollection() as $shipmentItem)
124 foreach ($shipmentItem->getShipmentItemStoreCollection() as $shipmentItemStore)
126 $externalFieldsSIS = isset($this->externalFields[
'SHIPMENTS'][$shipment->getInternalIndex()][
'SHIPMENT_ITEMS'][$shipmentItem->getInternalIndex()][
'STORE'][$shipmentItemStore->getInternalIndex()])?
127 $this->externalFields[
'SHIPMENTS'][$shipment->getInternalIndex()][
'SHIPMENT_ITEMS'][$shipmentItem->getInternalIndex()][
'STORE'][$shipmentItemStore->getInternalIndex()]:[];
129 $stores[] = array_merge(
131 $shipmentItemStore->getFieldValues()
135 $externalFieldsSI = isset($this->externalFields[
'SHIPMENTS'][$shipment->getInternalIndex()][
'SHIPMENT_ITEMS'][$shipmentItem->getInternalIndex()])?
136 $this->externalFields[
'SHIPMENTS'][$shipment->getInternalIndex()][
'SHIPMENT_ITEMS'][$shipmentItem->getInternalIndex()]:[];
138 $basketItems[] = array_merge(
140 $shipmentItem->getFieldValues(),
146 $externalFields = isset($this->externalFields[
'SHIPMENTS'][$shipment->getInternalIndex()])?
147 $this->externalFields[
'SHIPMENTS'][$shipment->getInternalIndex()]:[];
149 $r[$shipment->getInternalIndex()] = array_merge(
151 $shipment->getFieldValues(),
152 [
'SHIPMENT_ITEMS'=>$basketItems]
155 $this->fields[
'ORDER'][
'SHIPMENTS']= $r;
162 ->getApplyResult(
true);
163 if(is_array($list) && !empty($list))
165 $this->fields[
'ORDER'][
'DISCOUNTS'] = $list;
174 if(is_array($list) && !empty($list))
176 foreach ($list as $tax)
177 $this->fields[
'ORDER'][
'TAXES'][] = $tax;
181 public function tradeBindingsNormalize()
185 foreach($this->
getOrder()->getTradeBindingCollection() as $item)
187 $externalFields = isset($this->externalFields[
'TRADE_BINDINGS'][$item->getInternalIndex()])?
188 $this->externalFields[
'TRADE_BINDINGS'][$item->getInternalIndex()]:[];
192 $item->getFieldValues()
196 $this->fields[
'ORDER'][
'TRADE_BINDINGS']=$r;