/** * Parses XML response into array. * * This is what reads the response XML and converts it into an array. * @param SimpleXMLObject $xml <p>The XML response from Amazon.</p> * @return boolean <b>FALSE</b> if no XML data is found */ protected function parseXML($xml) { if (!$xml) { return false; } foreach ($xml->children() as $x) { if ($x->getName() == 'ResponseMetadata') { continue; } $temp = (array) $x->attributes(); if (isset($temp['@attributes']['status']) && $temp['@attributes']['status'] != 'Success') { $this->log("Warning: product return was not successful", 'Warning'); } if (isset($x->Products)) { foreach ($x->Products->children() as $z) { $this->productList[$this->index] = new AmazonProduct($this->storeName, $z, $this->mockMode, $this->mockFiles, $this->config); $this->index++; } } else { if ($x->getName() == 'GetProductCategoriesForSKUResult' || $x->getName() == 'GetProductCategoriesForASINResult') { $this->productList[$this->index] = new AmazonProduct($this->storeName, $x, $this->mockMode, $this->mockFiles, $this->config); $this->index++; } else { foreach ($x->children() as $z) { if ($z->getName() == 'Error') { $error = (string) $z->Message; $this->productList['Error'] = $error; $this->log("Product Error: {$error}", 'Warning'); } elseif ($z->getName() != 'Product') { $this->productList[$z->getName()] = (string) $z; $this->log("Special case: " . $z->getName(), 'Warning'); } else { $this->productList[$this->index] = new AmazonProduct($this->storeName, $z, $this->mockMode, $this->mockFiles, $this->config); $this->index++; } } } } } }
/** * Default controller action. This is the default action which is executed * when no action is specified for a given call. * @see lib/controllers/Controller::getContents() */ public function getContents() { if (count($this->listFields) > 0) { $fieldNames = $this->listFields; } else { if ($this->app != null) { $fieldNames = $this->app->xpath("/app:app/app:list/app:field"); $concatenatedLabels = $this->app->xpath("/app:app/app:list/app:field/@label"); } else { $fieldNames = array(); $keyField = $this->model->getKeyField(); $fieldNames[$keyField] = "{$this->model->package}.{$keyField}"; $fields = $this->model->getFields(); foreach ($fields as $i => $field) { if ($field["reference"] == "") { $fieldNames[$i] = $this->model->package . "." . $field["name"]; } else { $modelInfo = Model::resolvePath($field["reference"]); $fieldNames[$i] = $modelInfo["model"] . "." . $field["referenceValue"]; } } } } foreach ($fieldNames as $i => $fieldName) { $fieldNames[$i] = substr((string) $fieldName, 0, 1) == "." ? $this->redirectedPackage . (string) $fieldName : (string) $fieldName; } if (count($this->fieldNames) > 0) { $fieldNames = $this->fieldNames; } if ($this->apiMode === false) { $this->setupList(); $params["fields"] = $fieldNames; $params["page"] = 0; $params["sort_field"] = array(array("field" => $this->model->database . "." . $this->model->getKeyField(), "type" => "DESC")); $this->table->setParams($params); $return = '<div id="table-wrapper">' . $this->toolbar->render() . $this->table->render() . '</div>'; } else { $params["fields"] = $fieldNames; $params["page"] = 0; $params["sort_field"] = array(array("field" => $this->model->database . "." . $this->model->getKeyField(), "type" => "DESC")); $return = json_encode(SQLDBDataStore::getMulti($params)); } return $return; }
/** * Parses XML response into array. * * This is what reads the response XML and converts it into an array. * @param SimpleXMLObject $xml <p>The XML response from Amazon.</p> * @return boolean <b>FALSE</b> if no XML data is found */ protected function parseXML($xml) { if (!$xml) { return false; } foreach ($xml->children() as $x) { $i = $this->index; $this->orderList[$i]['SellerFulfillmentOrderId'] = (string) $x->SellerFulfillmentOrderId; $this->orderList[$i]['DisplayableOrderId'] = (string) $x->DisplayableOrderId; $this->orderList[$i]['DisplayableOrderDateTime'] = (string) $x->DisplayableOrderDateTime; $this->orderList[$i]['DisplayableOrderComment'] = (string) $x->DisplayableOrderComment; $this->orderList[$i]['ShippingSpeedCategory'] = (string) $x->ShippingSpeedCategory; if (isset($x->DestinationAddress)) { $this->orderList[$i]['DestinationAddress']['Name'] = (string) $x->DestinationAddress->Name; $this->orderList[$i]['DestinationAddress']['Line1'] = (string) $x->DestinationAddress->Line1; if (isset($x->DestinationAddress->Line2)) { $this->orderList[$i]['DestinationAddress']['Line2'] = (string) $x->DestinationAddress->Line2; } if (isset($x->DestinationAddress->Line3)) { $this->orderList[$i]['DestinationAddress']['Line3'] = (string) $x->DestinationAddress->Line3; } if (isset($x->DestinationAddress->DistrictOrCounty)) { $this->orderList[$i]['DestinationAddress']['DistrictOrCounty'] = (string) $x->DestinationAddress->DistrictOrCounty; } $this->orderList[$i]['DestinationAddress']['City'] = (string) $x->DestinationAddress->City; $this->orderList[$i]['DestinationAddress']['StateOrProvinceCode'] = (string) $x->DestinationAddress->StateOrProvinceCode; $this->orderList[$i]['DestinationAddress']['CountryCode'] = (string) $x->DestinationAddress->CountryCode; if (isset($x->DestinationAddress->PostalCode)) { $this->orderList[$i]['DestinationAddress']['PostalCode'] = (string) $x->DestinationAddress->PostalCode; } if (isset($x->DestinationAddress->PhoneNumber)) { $this->orderList[$i]['DestinationAddress']['PhoneNumber'] = (string) $x->DestinationAddress->PhoneNumber; } } if (isset($x->FulfillmentPolicy)) { $this->orderList[$i]['FulfillmentPolicy'] = (string) $x->FulfillmentPolicy; } if (isset($x->FulfillmentMethod)) { $this->orderList[$i]['FulfillmentPolicy'] = (string) $x->FulfillmentMethod; } $this->orderList[$i]['ReceivedDateTime'] = (string) $x->ReceivedDateTime; $this->orderList[$i]['FulfillmentOrderStatus'] = (string) $x->FulfillmentOrderStatus; $this->orderList[$i]['StatusUpdatedDateTime'] = (string) $x->StatusUpdatedDateTime; if (isset($x->NotificationEmailList)) { $j = 0; foreach ($x->NotificationEmailList->children() as $y) { $this->orderList[$i]['NotificationEmailList'][$j++] = (string) $y; } } $this->index++; } }
/** * Parses XML response into array. * * This is what reads the response XML and converts it into an array. * @param SimpleXMLObject $xml <p>The XML response from Amazon.</p> * @return boolean <b>FALSE</b> if no XML data is found */ protected function parseXML($xml) { if (!$xml) { return false; } foreach ($xml->children() as $key => $x) { if ($key == 'Count') { $this->count = (string) $x; } if ($key != 'ReportSchedule') { continue; } $i = $this->index; $this->scheduleList[$i]['ReportType'] = (string) $x->ReportType; $this->scheduleList[$i]['Schedule'] = (string) $x->Schedule; $this->scheduleList[$i]['ScheduledDate'] = (string) $x->ScheduledDate; $this->index++; } }
/** * Parses XML response into array. * * This is what reads the response XML and converts it into an array. * @param SimpleXMLObject $xml <p>The XML response from Amazon.</p> * @return boolean <b>FALSE</b> if no XML data is found */ protected function parseXML($xml) { if (!$xml) { return false; } $i = 0; foreach ($xml->children() as $x) { if (isset($x->EstimatedShippingWeight)) { $this->previewList[$i]['EstimatedShippingWeight']['Unit'] = (string) $x->EstimatedShippingWeight->Unit; $this->previewList[$i]['EstimatedShippingWeight']['Value'] = (string) $x->EstimatedShippingWeight->Value; } $this->previewList[$i]['ShippingSpeedCategory'] = (string) $x->ShippingSpeedCategory; if (isset($x->FulfillmentPreviewShipments)) { $j = 0; foreach ($x->FulfillmentPreviewShipments->children() as $y) { $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['LatestShipDate'] = (string) $y->LatestShipDate; $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['LatestArrivalDate'] = (string) $y->LatestArrivalDate; $k = 0; foreach ($y->FulfillmentPreviewItems->children() as $z) { $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['FulfillmentPreviewItems'][$k]['EstimatedShippingWeight']['Unit'] = (string) $z->EstimatedShippingWeight->Unit; $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['FulfillmentPreviewItems'][$k]['EstimatedShippingWeight']['Value'] = (string) $z->EstimatedShippingWeight->Value; $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['FulfillmentPreviewItems'][$k]['SellerSKU'] = (string) $z->SellerSKU; $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['FulfillmentPreviewItems'][$k]['SellerFulfillmentOrderItemId'] = (string) $z->SellerFulfillmentOrderItemId; $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['FulfillmentPreviewItems'][$k]['ShippingWeightCalculationMethod'] = (string) $z->ShippingWeightCalculationMethod; $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['FulfillmentPreviewItems'][$k]['Quantity'] = (string) $z->Quantity; $k++; } $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['EarliestShipDate'] = (string) $y->EarliestShipDate; $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['EarliestArrivalDate'] = (string) $y->EarliestArrivalDate; $j++; } } if (isset($x->EstimatedFees)) { $j = 0; foreach ($x->EstimatedFees->children() as $y) { $this->previewList[$i]['EstimatedFees'][$j]['CurrencyCode'] = (string) $y->Amount->CurrencyCode; $this->previewList[$i]['EstimatedFees'][$j]['Value'] = (string) $y->Amount->Value; $this->previewList[$i]['EstimatedFees'][$j]['Name'] = (string) $y->Name; $j++; } } if (isset($x->UnfulfillablePreviewItems)) { $j = 0; foreach ($x->UnfulfillablePreviewItems->children() as $y) { $this->previewList[$i]['UnfulfillablePreviewItems'][$j]['SellerSKU'] = (string) $y->SellerSKU; $this->previewList[$i]['UnfulfillablePreviewItems'][$j]['SellerFulfillmentOrderItemId'] = (string) $y->SellerFulfillmentOrderItemId; $this->previewList[$i]['UnfulfillablePreviewItems'][$j]['Quantity'] = (string) $y->Quantity; $this->previewList[$i]['UnfulfillablePreviewItems'][$j]['ItemUnfulfillableReasons'] = (string) $y->ItemUnfulfillableReasons; $j++; } } if (isset($x->OrderUnfulfillableReasons)) { $j = 0; foreach ($x->OrderUnfulfillableReasons->children() as $y) { $this->previewList[$i]['OrderUnfulfillableReasons'][$j] = (string) $y; $j++; } } $this->previewList[$i]['IsFulfillable'] = (string) $x->IsFulfillable; $i++; } }
/** * Parses XML response into array. * * This is what reads the response XML and converts it into an array. * @param SimpleXMLObject $xml <p>The XML response from Amazon.</p> * @return boolean <b>FALSE</b> if no XML data is found */ protected function parseXML($xml) { if (!$xml) { return false; } foreach ($xml->children() as $key => $x) { $i = $this->index; if ($key == 'Count') { $this->count = (string) $x; $this->log("Successfully cancelled {$this->count} report requests."); } if ($key != 'FeedSubmissionInfo') { continue; } $this->feedList[$i]['FeedSubmissionId'] = (string) $x->FeedSubmissionId; $this->feedList[$i]['FeedType'] = (string) $x->FeedType; $this->feedList[$i]['SubmittedDate'] = (string) $x->SubmittedDate; $this->feedList[$i]['FeedProcessingStatus'] = (string) $x->FeedProcessingStatus; if (!empty($x->StartedProcessingDate)) { $this->feedList[$i]['StartedProcessingDate'] = (string) $x->StartedProcessingDate; } if (!empty($x->CompletedProcessingDate)) { $this->feedList[$i]['CompletedProcessingDate'] = (string) $x->CompletedProcessingDate; } $this->index++; } }
/** * Parses XML response into array. * * This is what reads the response XML and converts it into an array. * @param SimpleXMLObject $xml <p>The XML response from Amazon.</p> * @return boolean <b>FALSE</b> if no XML data is found */ protected function parseXML($xml) { if (!$xml) { return false; } foreach ($xml->children() as $key => $x) { $i = $this->index; if ($key == 'Count') { $this->count = (string) $x; $this->log("Successfully canceled {$this->count} report requests."); } if ($key != 'ReportRequestInfo') { continue; } $this->reportList[$i]['ReportRequestId'] = (string) $x->ReportRequestId; $this->reportList[$i]['ReportType'] = (string) $x->ReportType; $this->reportList[$i]['StartDate'] = (string) $x->StartDate; $this->reportList[$i]['EndDate'] = (string) $x->EndDate; $this->reportList[$i]['Scheduled'] = (string) $x->Scheduled; $this->reportList[$i]['SubmittedDate'] = (string) $x->SubmittedDate; $this->reportList[$i]['ReportProcessingStatus'] = (string) $x->ReportProcessingStatus; $this->reportList[$i]['GeneratedReportId'] = (string) $x->GeneratedReportId; $this->reportList[$i]['StartedProcessingDate'] = (string) $x->StartedProcessingDate; $this->reportList[$i]['CompletedProcessingDate'] = (string) $x->CompletedProcessingDate; $this->index++; } }
/** * Parses XML response into array. * * This is what reads the response XML and converts it into an array. * @param SimpleXMLObject $xml <p>The XML response from Amazon.</p> * @return boolean <b>FALSE</b> if no XML data is found */ protected function parseXML($xml) { if (!$xml) { return false; } foreach ($xml->children() as $key => $x) { $i = $this->index; if ($key != 'ReportInfo') { continue; } $this->reportList[$i]['ReportId'] = (string) $x->ReportId; $this->reportList[$i]['ReportType'] = (string) $x->ReportType; $this->reportList[$i]['ReportRequestId'] = (string) $x->ReportRequestId; $this->reportList[$i]['AvailableDate'] = (string) $x->AvailableDate; $this->reportList[$i]['Acknowledged'] = (string) $x->Acknowledged; $this->index++; } }
/** * Takes in XML data for Categories and parses it for the object to use * @param SimpleXMLObject $xml <p>The XML data from Amazon.</p> * @return boolean <b>FALSE</b> if no valid XML data is found */ protected function loadCategories($xml) { //Categories if (!$xml->Self) { return false; } $cnum = 0; foreach ($xml->children() as $x) { $this->data['Categories'][$cnum] = $this->genHierarchy($x); $cnum++; } }
/** * Parses XML response into array. * * This is what reads the response XML and converts it into an array. * @param SimpleXMLObject $xml <p>The XML response from Amazon.</p> * @return boolean <b>FALSE</b> if no XML data is found */ protected function parseXML($xml) { if (!$xml) { return false; } $i = 0; foreach ($xml->children() as $x) { foreach ($x->ShipToAddress->children() as $y => $z) { $this->planList[$i]['ShipToAddress'][$y] = (string) $z; } $this->planList[$i]['ShipmentId'] = (string) $x->ShipmentId; $this->planList[$i]['DestinationFulfillmentCenterId'] = (string) $x->DestinationFulfillmentCenterId; $this->planList[$i]['LabelPrepType'] = (string) $x->LabelPrepType; $j = 0; foreach ($x->Items->children() as $y => $z) { $this->planList[$i]['Items'][$j]['SellerSKU'] = (string) $z->SellerSKU; $this->planList[$i]['Items'][$j]['Quantity'] = (string) $z->Quantity; $this->planList[$i]['Items'][$j]['FulfillmentNetworkSKU'] = (string) $z->FulfillmentNetworkSKU; $j++; } $i++; } }
/** * Parses XML response into array. * * This is what reads the response XML and converts it into an array. * @param SimpleXMLObject $xml <p>The XML response from Amazon.</p> * @return boolean <b>FALSE</b> if no XML data is found */ protected function parseXML($xml) { if (!$xml) { return false; } foreach ($xml->children() as $item) { $n = $this->index; $this->itemList[$n]['ASIN'] = (string) $item->ASIN; $this->itemList[$n]['SellerSKU'] = (string) $item->SellerSKU; $this->itemList[$n]['OrderItemId'] = (string) $item->OrderItemId; $this->itemList[$n]['Title'] = (string) $item->Title; $this->itemList[$n]['QuantityOrdered'] = (string) $item->QuantityOrdered; if (isset($item->QuantityShipped)) { $this->itemList[$n]['QuantityShipped'] = (string) $item->QuantityShipped; } if (isset($item->GiftMessageText)) { $this->itemList[$n]['GiftMessageText'] = (string) $item->GiftMessageText; } if (isset($item->GiftWrapLevel)) { $this->itemList[$n]['GiftWrapLevel'] = (string) $item->GiftWrapLevel; } if (isset($item->ItemPrice)) { $this->itemList[$n]['ItemPrice']['Amount'] = (string) $item->ItemPrice->Amount; $this->itemList[$n]['ItemPrice']['CurrencyCode'] = (string) $item->ItemPrice->CurrencyCode; } if (isset($item->ShippingPrice)) { $this->itemList[$n]['ShippingPrice']['Amount'] = (string) $item->ShippingPrice->Amount; $this->itemList[$n]['ShippingPrice']['CurrencyCode'] = (string) $item->ShippingPrice->CurrencyCode; } if (isset($item->GiftWrapPrice)) { $this->itemList[$n]['GiftWrapPrice']['Amount'] = (string) $item->GiftWrapPrice->Amount; $this->itemList[$n]['GiftWrapPrice']['CurrencyCode'] = (string) $item->GiftWrapPrice->CurrencyCode; } if (isset($item->ItemTax)) { $this->itemList[$n]['ItemTax']['Amount'] = (string) $item->ItemTax->Amount; $this->itemList[$n]['ItemTax']['CurrencyCode'] = (string) $item->ItemTax->CurrencyCode; } if (isset($item->ShippingTax)) { $this->itemList[$n]['ShippingTax']['Amount'] = (string) $item->ShippingTax->Amount; $this->itemList[$n]['ShippingTax']['CurrencyCode'] = (string) $item->ShippingTax->CurrencyCode; } if (isset($item->GiftWrapTax)) { $this->itemList[$n]['GiftWrapTax']['Amount'] = (string) $item->GiftWrapTax->Amount; $this->itemList[$n]['GiftWrapTax']['CurrencyCode'] = (string) $item->GiftWrapTax->CurrencyCode; } if (isset($item->ShippingDiscount)) { $this->itemList[$n]['ShippingDiscount']['Amount'] = (string) $item->ShippingDiscount->Amount; $this->itemList[$n]['ShippingDiscount']['CurrencyCode'] = (string) $item->ShippingDiscount->CurrencyCode; } if (isset($item->PromotionDiscount)) { $this->itemList[$n]['PromotionDiscount']['Amount'] = (string) $item->PromotionDiscount->Amount; $this->itemList[$n]['PromotionDiscount']['CurrencyCode'] = (string) $item->PromotionDiscount->CurrencyCode; } if (isset($item->CODFee)) { $this->itemList[$n]['CODFee']['Amount'] = (string) $item->CODFee->Amount; $this->itemList[$n]['CODFee']['CurrencyCode'] = (string) $item->CODFee->CurrencyCode; } if (isset($item->CODFeeDiscount)) { $this->itemList[$n]['CODFeeDiscount']['Amount'] = (string) $item->CODFeeDiscount->Amount; $this->itemList[$n]['CODFeeDiscount']['CurrencyCode'] = (string) $item->CODFeeDiscount->CurrencyCode; } if (isset($item->PromotionIds)) { $i = 0; foreach ($item->PromotionIds->children() as $x) { $this->itemList[$n]['PromotionIds'][$i] = (string) $x; $i++; } } if (isset($item->InvoiceData)) { if (isset($item->InvoiceData->InvoiceRequirement)) { $this->itemList[$n]['InvoiceData']['InvoiceRequirement'] = (string) $item->InvoiceData->InvoiceRequirement; } if (isset($item->InvoiceData->BuyerSelectedInvoiceCategory)) { $this->itemList[$n]['InvoiceData']['BuyerSelectedInvoiceCategory'] = (string) $item->InvoiceData->BuyerSelectedInvoiceCategory; } if (isset($item->InvoiceData->InvoiceTitle)) { $this->itemList[$n]['InvoiceData']['InvoiceTitle'] = (string) $item->InvoiceData->InvoiceTitle; } if (isset($item->InvoiceData->InvoiceInformation)) { $this->itemList[$n]['InvoiceData']['InvoiceInformation'] = (string) $item->InvoiceData->InvoiceInformation; } } if (isset($item->ConditionId)) { $this->itemList[$n]['ConditionId'] = (string) $item->ConditionId; } if (isset($item->ConditionSubtypeId)) { $this->itemList[$n]['ConditionSubtypeId'] = (string) $item->ConditionSubtypeId; } if (isset($item->ConditionNote)) { $this->itemList[$n]['ConditionNote'] = (string) $item->ConditionNote; } if (isset($item->ScheduledDeliveryStartDate)) { $this->itemList[$n]['ScheduledDeliveryStartDate'] = (string) $item->ScheduledDeliveryStartDate; } if (isset($item->ScheduledDeliveryEndDate)) { $this->itemList[$n]['ScheduledDeliveryEndDate'] = (string) $item->ScheduledDeliveryEndDate; } $this->index++; } }
/** * Parses XML response into array. * * This is what reads the response XML and converts it into an array. * @param SimpleXMLObject $xml <p>The XML response from Amazon.</p> * @return boolean <b>FALSE</b> if no XML data is found */ protected function parseXML($xml) { if (!$xml) { return false; } foreach ($xml->children() as $x) { $this->supplyList[$this->index]['SellerSKU'] = (string) $x->SellerSKU; $this->supplyList[$this->index]['ASIN'] = (string) $x->ASIN; $this->supplyList[$this->index]['TotalSupplyQuantity'] = (string) $x->TotalSupplyQuantity; $this->supplyList[$this->index]['FNSKU'] = (string) $x->FNSKU; $this->supplyList[$this->index]['Condition'] = (string) $x->Condition; $this->supplyList[$this->index]['InStockSupplyQuantity'] = (string) $x->InStockSupplyQuantity; if ((int) $x->TotalSupplyQuantity > 0) { if ($x->EarliestAvailability->TimepointType == 'DateTime') { $this->supplyList[$this->index]['EarliestAvailability'] = (string) $x->EarliestAvailability->DateTime; } else { $this->supplyList[$this->index]['EarliestAvailability'] = (string) $x->EarliestAvailability->TimepointType; } } if (isset($this->options['ResponseGroup']) && $this->options['ResponseGroup'] == 'Detailed' && isset($x->SupplyDetail)) { $j = 0; foreach ($x->SupplyDetail->children() as $z) { if ((string) $z->EarliestAvailableToPick->TimepointType == 'DateTime') { $this->supplyList[$this->index]['SupplyDetail'][$j]['EarliestAvailableToPick'] = (string) $z->EarliestAvailableToPick->DateTime; } else { $this->supplyList[$this->index]['SupplyDetail'][$j]['EarliestAvailableToPick'] = (string) $z->EarliestAvailableToPick->TimepointType; } if ((string) $z->LatestAvailableToPick->TimepointType == 'DateTime') { $this->supplyList[$this->index]['SupplyDetail'][$j]['LatestAvailableToPick'] = (string) $z->LatestAvailableToPick->DateTime; } else { $this->supplyList[$this->index]['SupplyDetail'][$j]['LatestAvailableToPick'] = (string) $z->LatestAvailableToPick->TimepointType; } $this->supplyList[$this->index]['SupplyDetail'][$j]['Quantity'] = (string) $z->Quantity; $this->supplyList[$this->index]['SupplyDetail'][$j]['SupplyType'] = (string) $z->SupplyType; $j++; } } $this->index++; } }
/** * Parses XML response into array. * * This is what reads the response XML and converts it into an array. * @param SimpleXMLObject $xml <p>The XML response from Amazon.</p> * @return boolean <b>FALSE</b> if no XML data is found */ protected function parseXML($xml) { if (!$xml) { return false; } foreach ($xml->children() as $item) { $n = $this->index; $this->itemList[$n]['ASIN'] = (string) $item->ASIN; $this->itemList[$n]['SellerSKU'] = (string) $item->SellerSKU; $this->itemList[$n]['OrderItemId'] = (string) $item->OrderItemId; $this->itemList[$n]['Title'] = (string) $item->Title; $this->itemList[$n]['QuantityOrdered'] = (string) $item->QuantityOrdered; if (isset($item->QuantityShipped)) { $this->itemList[$n]['QuantityShipped'] = (string) $item->QuantityShipped; } if (isset($item->GiftMessageText)) { $this->itemList[$n]['GiftMessageText'] = (string) $item->GiftMessageText; } if (isset($item->GiftWrapLevel)) { $this->itemList[$n]['GiftWrapLevel'] = (string) $item->GiftWrapLevel; } if (isset($item->ItemPrice)) { $this->itemList[$n]['ItemPrice']['Amount'] = (string) $item->ItemPrice->Amount; $this->itemList[$n]['ItemPrice']['CurrencyCode'] = (string) $item->ItemPrice->CurrencyCode; } if (isset($item->ShippingPrice)) { $this->itemList[$n]['ShippingPrice']['Amount'] = (string) $item->ShippingPrice->Amount; $this->itemList[$n]['ShippingPrice']['CurrencyCode'] = (string) $item->ShippingPrice->CurrencyCode; } if (isset($item->GiftWrapPrice)) { $this->itemList[$n]['GiftWrapPrice']['Amount'] = (string) $item->GiftWrapPrice->Amount; $this->itemList[$n]['GiftWrapPrice']['CurrencyCode'] = (string) $item->GiftWrapPrice->CurrencyCode; } if (isset($item->ItemTax)) { $this->itemList[$n]['ItemTax']['Amount'] = (string) $item->ItemTax->Amount; $this->itemList[$n]['ItemTax']['CurrencyCode'] = (string) $item->ItemTax->CurrencyCode; } if (isset($item->ShippingTax)) { $this->itemList[$n]['ShippingTax']['Amount'] = (string) $item->ShippingTax->Amount; $this->itemList[$n]['ShippingTax']['CurrencyCode'] = (string) $item->ShippingTax->CurrencyCode; } if (isset($item->GiftWrapTax)) { $this->itemList[$n]['GiftWrapTax']['Amount'] = (string) $item->GiftWrapTax->Amount; $this->itemList[$n]['GiftWrapTax']['CurrencyCode'] = (string) $item->GiftWrapTax->CurrencyCode; } if (isset($item->ShippingDiscount)) { $this->itemList[$n]['ShippingDiscount']['Amount'] = (string) $item->ShippingDiscount->Amount; $this->itemList[$n]['ShippingDiscount']['CurrencyCode'] = (string) $item->ShippingDiscount->CurrencyCode; } if (isset($item->PromotionDiscount)) { $this->itemList[$n]['PromotionDiscount']['Amount'] = (string) $item->PromotionDiscount->Amount; $this->itemList[$n]['PromotionDiscount']['CurrencyCode'] = (string) $item->PromotionDiscount->CurrencyCode; } if (isset($item->CODFee)) { $this->itemList[$n]['CODFee']['Amount'] = (string) $item->CODFee->Amount; $this->itemList[$n]['CODFee']['CurrencyCode'] = (string) $item->CODFee->CurrencyCode; } if (isset($item->CODFeeDiscount)) { $this->itemList[$n]['CODFeeDiscount']['Amount'] = (string) $item->CODFeeDiscount->Amount; $this->itemList[$n]['CODFeeDiscount']['CurrencyCode'] = (string) $item->CODFeeDiscount->CurrencyCode; } if (isset($item->PromotionIds)) { $i = 0; foreach ($item->PromotionIds->children() as $x) { $this->itemList[$n]['PromotionIds'][$i] = (string) $x; $i++; } } $this->index++; } }
/** * Builds the SimpleXMLObject's attributes into an array * * @param SimpleXMLObject $simple_xml_obj * @return array */ public function get_opml_properties($simple_xml_obj) { $obj = $simple_xml_obj->attributes(); $array = array(); foreach ($obj as $key => $value) { $array[$key] = (string) $value; } return $array; }