当前位置: 首页>>代码示例>>PHP>>正文


PHP SimpleXMLObject::children方法代码示例

本文整理汇总了PHP中SimpleXMLObject::children方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleXMLObject::children方法的具体用法?PHP SimpleXMLObject::children怎么用?PHP SimpleXMLObject::children使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleXMLObject的用法示例。


在下文中一共展示了SimpleXMLObject::children方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: parseXML

 /**
  * 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++;
                     }
                 }
             }
         }
     }
 }
开发者ID:przemekperon,项目名称:amazon-mws-laravel,代码行数:47,代码来源:AmazonProductsCore.php

示例2: parseXML

 /**
  * 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++;
     }
 }
开发者ID:przemekperon,项目名称:amazon-mws-laravel,代码行数:59,代码来源:AmazonFulfillmentOrderList.php

示例3: parseXML

 /**
  * 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++;
     }
 }
开发者ID:mesingh,项目名称:amazon-mws-laravel,代码行数:26,代码来源:AmazonReportScheduleManager.php

示例4: parseXML

 /**
  * 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++;
     }
 }
开发者ID:rajtrivedi2001,项目名称:phpAmazonMWS-1,代码行数:34,代码来源:AmazonFeedList.php

示例5: parseXML

 /**
  * 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++;
     }
 }
开发者ID:tapha,项目名称:mws-laravel,代码行数:69,代码来源:AmazonFulfillmentPreview.php

示例6: parseXML

 /**
  * 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++;
     }
 }
开发者ID:jsrgqinbin,项目名称:amazon-mws-laravel,代码行数:25,代码来源:AmazonReportList.php

示例7: parseXML

 /**
  * 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++;
     }
 }
开发者ID:mycrom,项目名称:phpAmazonMWS,代码行数:34,代码来源:AmazonReportRequestList.php

示例8: loadCategories

 /**
  * 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++;
     }
 }
开发者ID:zaffar-saffee,项目名称:laravel-5-amazon-mws-persistent,代码行数:17,代码来源:AmazonProduct.php

示例9: parseXML

 /**
  * 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++;
     }
 }
开发者ID:przemekperon,项目名称:amazon-mws-laravel,代码行数:30,代码来源:AmazonShipmentPlanner.php

示例10: parseXML

 /**
  * 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;
//.........这里部分代码省略.........
开发者ID:sebastien-fauvel,项目名称:phpAmazonMWS,代码行数:101,代码来源:AmazonOrderItemList.php

示例11: parseXML

 /**
  * 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++;
     }
 }
开发者ID:2brosdevelopment,项目名称:php-amazon-mws,代码行数:47,代码来源:AmazonInventoryList.php

示例12: parseXML

 /**
  * 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++;
     }
 }
开发者ID:tapha,项目名称:mws-laravel,代码行数:78,代码来源:AmazonOrderItemList.php


注:本文中的SimpleXMLObject::children方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。