PHP Classes

Amazon Order Processing

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  Amazon Order Processing  
Subject:Amazon Order Processing
Summary:Parsing Amazon Order - XML format
Messages:3
Author:Peggy Rader
Date:2010-07-04 03:33:14
Update:2010-07-04 20:29:18
 

  1. Amazon Order Processing   Reply   Report abuse  
Picture of Peggy Rader Peggy Rader - 2010-07-04 04:27:15
I am a PHP newbie and trying to parse an Amazon order (sample XML appended).

I have found xml_parse_into_struct - which creates the attached XML document.

I am trying to figure out the code that will allow me to get

the address information, &Name, &AddressFieldOne,&AddressFieldTwo,&City,&StateOrRegion,&PostalCode,&CountryCode,&PhoneNumber

The order information (Item, ItemPrice and ItemFees).

I've been searching many PHP examples looking for a sample to model the parsing after.

I've found

"http://www.nusphere.com/kb/phpmanual/function.xml-parse-into-struct.htm?" -- but I don't think this is what I need.

If anyone has examples of processing an XML document with similar arrays like Amazon has in it's order processing (or an Amazon order), I'd appreciate any direction.

Thanks in advance for any pointer.

phpNewbie

***

Array
(
[AmazonEnvelope] => Array
(
[Header] => Array
(
[DocumentVersion] => 1.01
[MerchantIdentifier] => M_SAMPLE_465273
)

[MessageType] => OrderReport
[Message] => Array
(
[MessageID] => 1
[OrderReport] => Array
(
[AmazonOrderID] => 105-9999999-2217036
[AmazonSessionID] => 105-9999999-2217036
[OrderDate] => 2010-06-23T17:42:47-07:00
[OrderPostedDate] => 2010-06-23T17:42:47-07:00
[BillingData] => Array
(
[BuyerEmailAddress] => xyz@marketplace.amazon.com
[BuyerName] => John Smith
[BuyerPhoneNumber] => 999-999-9999
)

[FulfillmentData] => Array
(
[FulfillmentMethod] => Ship
[FulfillmentServiceLevel] => Standard
[Address] => Array
(
[Name] => John Smith
[AddressFieldOne] => 100 N MAIN St.
[City] => PLANO
[StateOrRegion] => TX
[PostalCode] => 75099-1948
[CountryCode] => US
[PhoneNumber] => 972-999-9999
)

)

[Item] => Array
(
[0] => Array
(
[AmazonOrderItemCode] => 42532279579999
[SKU] => SAMP1160
[Title] => Sample Widget1
[Quantity] => 1
[ProductTaxCode] => A_GEN_NOTAX
[ItemPrice] => Array
(
[Component] => Array
(
[0] => Array
(
[Type] => Principal
[Amount] => 11.95
[Amount_attr] => Array
(
[currency] => USD
)

)

[1] => Array
(
[Type] => Shipping
[Amount] => 3.58
[Amount_attr] => Array
(
[currency] => USD
)

)

[2] => Array
(
[Type] => Tax
[Amount] => 0.00
[Amount_attr] => Array
(
[currency] => USD
)

)

[3] => Array
(
[Type] => ShippingTax
[Amount] => 0.00
[Amount_attr] => Array
(
[currency] => USD
)

)

)

)

[ItemFees] => Array
(
[Fee] => Array
(
[Type] => Commission
[Amount] => -1.86
[Amount_attr] => Array
(
[currency] => USD
)

)

)

)

[1] => Array
(
[AmazonOrderItemCode] => 39683025999999
[SKU] => SAMP1100
[Title] => Sample Widget 2
[Quantity] => 1
[ProductTaxCode] => A_GEN_NOTAX
[ItemPrice] => Array
(
[Component] => Array
(
[0] => Array
(
[Type] => Principal
[Amount] => 149.95
[Amount_attr] => Array
(
[currency] => USD
)

)

[1] => Array
(
[Type] => Shipping
[Amount] => 19.34
[Amount_attr] => Array
(
[currency] => USD
)

)

[2] => Array
(
[Type] => Tax
[Amount] => 0.00
[Amount_attr] => Array
(
[currency] => USD
)

)

[3] => Array
(
[Type] => ShippingTax
[Amount] => 0.00
[Amount_attr] => Array
(
[currency] => USD
)

)

)

)

[ItemFees] => Array
(
[Fee] => Array
(
[Type] => Commission
[Amount] => -20.31
[Amount_attr] => Array
(
[currency] => USD
)

)

)

)

[2] => Array
(
[AmazonOrderItemCode] => 08742863199999
[SKU] => SAMP1199
[Title] => Sample Widget 3
[Quantity] => 1
[ProductTaxCode] => A_GEN_NOTAX
[ItemPrice] => Array
(
[Component] => Array
(
[0] => Array
(
[Type] => Principal
[Amount] => 17.95
[Amount_attr] => Array
(
[currency] => USD
)

)

[1] => Array
(
[Type] => Shipping
[Amount] => 3.59
[Amount_attr] => Array
(
[currency] => USD
)

)

[2] => Array
(
[Type] => Tax
[Amount] => 0.00
[Amount_attr] => Array
(
[currency] => USD
)

)

[3] => Array
(
[Type] => ShippingTax
[Amount] => 0.00
[Amount_attr] => Array
(
[currency] => USD
)

)

)

)

[ItemFees] => Array
(
[Fee] => Array
(
[Type] => Commission
[Amount] => -2.58
[Amount_attr] => Array
(
[currency] => USD
)

)

)

)

)

)

)

)

[AmazonEnvelope_attr] => Array
(
[xmlns:xsi] => http://www.w3.org/2001/XMLSchema-instance
[xsi:noNamespaceSchemaLocation] => amzn-envelope.xsd
)

)


There are 2 replies in this thread, which are not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.