antonb Posted May 22, 2008 Share Posted May 22, 2008 See example below. I would like to be able to do this with SimpleXML... <Options><ServiceDetail><ServiceType>FEDEX_2_DAY_FREIGHT</ServiceType><PackagingType>YOUR_PACKAGING</PackagingType><DeliveryDay>MON</DeliveryDay><DeliveryDate>2008-05-26</DeliveryDate><DestinationStationId>DFW</DestinationStationId><SignatureOption>SERVICE_DEFAULT</SignatureOption></ServiceDetail><ActualRateType>PAYOR_ACCOUNT</ActualRateType><RatedShipmentDetails><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount><ShipmentRateDetail><RateType>PAYOR_ACCOUNT</RateType><RateScale>06704</RateScale><RateZone>5</RateZone><TotalBillingWeight><Units>LB</Units><Value>728.0</Value></TotalBillingWeight><TotalBaseCharge><Currency>USD</Currency><Amount>1142.96</Amount></TotalBaseCharge><TotalFreightDiscounts><Currency>USD</Currency><Amount>0.00</Amount></TotalFreightDiscounts><TotalSurcharges><Currency>USD</Currency><Amount>228.59</Amount></TotalSurcharges><TotalNetCharge><Currency>USD</Currency><Amount>1371.55</Amount></TotalNetCharge> <TotalRebates><Currency>USD</Currency><Amount>0.00</Amount></TotalRebates></ShipmentRateDetail><RatedPackages><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount></RatedPackages></RatedShipmentDetails><RatedShipmentDetails><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount><ShipmentRateDetail><RateType>PAYOR_LIST</RateType><RateZone>5</RateZone><TotalBaseCharge><Currency>USD</Currency><Amount>1142.96</Amount></TotalBaseCharge><TotalFreightDiscounts><Currency>USD</Currency><Amount>0.00</Amount></TotalFreightDiscounts><TotalSurcharges><Currency>USD</Currency><Amount>228.59</Amount></TotalSurcharges><TotalNetCharge><Currency>USD</Currency><Amount>1371.55</Amount></TotalNetCharge><TotalRebates><Currency>USD</Currency><Amount>0.00</Amount></TotalRebates></ShipmentRateDetail><RatedPackages><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount></RatedPackages></RatedShipmentDetails></Options> <Options><ServiceDetail><ServiceType>FEDEX_1_DAY_FREIGHT</ServiceType><PackagingType>YOUR_PACKAGING</PackagingType><DeliveryDay>FRI</DeliveryDay><DeliveryDate>2008-05-23</DeliveryDate><DestinationStationId>DFW</DestinationStationId><SignatureOption>SERVICE_DEFAULT</SignatureOption></ServiceDetail><ActualRateType>PAYOR_ACCOUNT</ActualRateType><RatedShipmentDetails><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount><ShipmentRateDetail><RateType>PAYOR_ACCOUNT</RateType><RateScale>02176</RateScale><RateZone>5</RateZone><TotalBillingWeight><Units>LB</Units><Value>728.0</Value></TotalBillingWeight><TotalBaseCharge><Currency>USD</Currency><Amount>2278.64</Amount></TotalBaseCharge><TotalFreightDiscounts><Currency>USD</Currency><Amount>0.00</Amount></TotalFreightDiscounts><TotalSurcharges><Currency>USD</Currency><Amount>455.73</Amount></TotalSurcharges><TotalNetCharge><Currency>USD</Currency><Amount>2734.37</Amount></TotalNetCharge> <TotalRebates><Currency>USD</Currency><Amount>0.00</Amount></TotalRebates></ShipmentRateDetail><RatedPackages><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount></RatedPackages></RatedShipmentDetails><RatedShipmentDetails><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount><ShipmentRateDetail><RateType>PAYOR_LIST</RateType><RateZone>5</RateZone><TotalBaseCharge><Currency>USD</Currency><Amount>2278.64</Amount></TotalBaseCharge><TotalFreightDiscounts><Currency>USD</Currency><Amount>0.00</Amount></TotalFreightDiscounts><TotalSurcharges><Currency>USD</Currency><Amount>455.73</Amount></TotalSurcharges><TotalNetCharge><Currency>USD</Currency><Amount>2734.37</Amount></TotalNetCharge><TotalRebates><Currency>USD</Currency><Amount>0.00</Amount></TotalRebates></ShipmentRateDetail><RatedPackages><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount></RatedPackages></RatedShipmentDetails></Options> <Options><ServiceDetail><ServiceType>FEDEX_3_DAY_FREIGHT</ServiceType><PackagingType>YOUR_PACKAGING</PackagingType><DeliveryDay>TUE</DeliveryDay><DeliveryDate>2008-05-27</DeliveryDate><DestinationStationId>DFW</DestinationStationId><SignatureOption>SERVICE_DEFAULT</SignatureOption></ServiceDetail><ActualRateType>PAYOR_ACCOUNT</ActualRateType><RatedShipmentDetails><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount><ShipmentRateDetail><RateType>PAYOR_ACCOUNT</RateType><RateScale>07186</RateScale><RateZone>5</RateZone><TotalBillingWeight><Units>LB</Units><Value>728.0</Value></TotalBillingWeight><TotalBaseCharge><Currency>USD</Currency><Amount>1077.44</Amount></TotalBaseCharge><TotalFreightDiscounts><Currency>USD</Currency><Amount>0.00</Amount></TotalFreightDiscounts><TotalSurcharges><Currency>USD</Currency><Amount>215.49</Amount></TotalSurcharges><TotalNetCharge><Currency>USD</Currency><Amount>1292.93</Amount></TotalNetCharge> <TotalRebates><Currency>USD</Currency><Amount>0.00</Amount></TotalRebates></ShipmentRateDetail><RatedPackages><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount></RatedPackages></RatedShipmentDetails><RatedShipmentDetails><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount><ShipmentRateDetail><RateType>PAYOR_LIST</RateType><RateZone>5</RateZone><TotalBaseCharge><Currency>USD</Currency><Amount>1077.44</Amount></TotalBaseCharge><TotalFreightDiscounts><Currency>USD</Currency><Amount>0.00</Amount></TotalFreightDiscounts><TotalSurcharges><Currency>USD</Currency><Amount>215.49</Amount></TotalSurcharges><TotalNetCharge><Currency>USD</Currency><Amount>1292.93</Amount></TotalNetCharge><TotalRebates><Currency>USD</Currency><Amount>0.00</Amount></TotalRebates></ShipmentRateDetail><RatedPackages><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount></RatedPackages></RatedShipmentDetails></Options> Quote Link to comment Share on other sites More sharing options...
rhodesa Posted May 22, 2008 Share Posted May 22, 2008 First, what you have is not valid XML. There can only be one top level element. But, to fix that, just wrap it in a tag. Here is an example: <?php $xml = '<Options><ServiceDetail><ServiceType>FEDEX_2_DAY_FREIGHT</ServiceType><PackagingType>YOUR_PACKAGING</PackagingType><DeliveryDay>MON</DeliveryDay><DeliveryDate>2008-05-26</DeliveryDate><DestinationStationId>DFW</DestinationStationId><SignatureOption>SERVICE_DEFAULT</SignatureOption></ServiceDetail><ActualRateType>PAYOR_ACCOUNT</ActualRateType><RatedShipmentDetails><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount><ShipmentRateDetail><RateType>PAYOR_ACCOUNT</RateType><RateScale>06704</RateScale><RateZone>5</RateZone><TotalBillingWeight><Units>LB</Units><Value>728.0</Value></TotalBillingWeight><TotalBaseCharge><Currency>USD</Currency><Amount>1142.96</Amount></TotalBaseCharge><TotalFreightDiscounts><Currency>USD</Currency><Amount>0.00</Amount></TotalFreightDiscounts><TotalSurcharges><Currency>USD</Currency><Amount>228.59</Amount></TotalSurcharges><TotalNetCharge><Currency>USD</Currency><Amount>1371.55</Amount></TotalNetCharge> <TotalRebates><Currency>USD</Currency><Amount>0.00</Amount></TotalRebates></ShipmentRateDetail><RatedPackages><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount></RatedPackages></RatedShipmentDetails><RatedShipmentDetails><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount><ShipmentRateDetail><RateType>PAYOR_LIST</RateType><RateZone>5</RateZone><TotalBaseCharge><Currency>USD</Currency><Amount>1142.96</Amount></TotalBaseCharge><TotalFreightDiscounts><Currency>USD</Currency><Amount>0.00</Amount></TotalFreightDiscounts><TotalSurcharges><Currency>USD</Currency><Amount>228.59</Amount></TotalSurcharges><TotalNetCharge><Currency>USD</Currency><Amount>1371.55</Amount></TotalNetCharge><TotalRebates><Currency>USD</Currency><Amount>0.00</Amount></TotalRebates></ShipmentRateDetail><RatedPackages><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount></RatedPackages></RatedShipmentDetails></Options> <Options><ServiceDetail><ServiceType>FEDEX_1_DAY_FREIGHT</ServiceType><PackagingType>YOUR_PACKAGING</PackagingType><DeliveryDay>FRI</DeliveryDay><DeliveryDate>2008-05-23</DeliveryDate><DestinationStationId>DFW</DestinationStationId><SignatureOption>SERVICE_DEFAULT</SignatureOption></ServiceDetail><ActualRateType>PAYOR_ACCOUNT</ActualRateType><RatedShipmentDetails><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount><ShipmentRateDetail><RateType>PAYOR_ACCOUNT</RateType><RateScale>02176</RateScale><RateZone>5</RateZone><TotalBillingWeight><Units>LB</Units><Value>728.0</Value></TotalBillingWeight><TotalBaseCharge><Currency>USD</Currency><Amount>2278.64</Amount></TotalBaseCharge><TotalFreightDiscounts><Currency>USD</Currency><Amount>0.00</Amount></TotalFreightDiscounts><TotalSurcharges><Currency>USD</Currency><Amount>455.73</Amount></TotalSurcharges><TotalNetCharge><Currency>USD</Currency><Amount>2734.37</Amount></TotalNetCharge> <TotalRebates><Currency>USD</Currency><Amount>0.00</Amount></TotalRebates></ShipmentRateDetail><RatedPackages><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount></RatedPackages></RatedShipmentDetails><RatedShipmentDetails><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount><ShipmentRateDetail><RateType>PAYOR_LIST</RateType><RateZone>5</RateZone><TotalBaseCharge><Currency>USD</Currency><Amount>2278.64</Amount></TotalBaseCharge><TotalFreightDiscounts><Currency>USD</Currency><Amount>0.00</Amount></TotalFreightDiscounts><TotalSurcharges><Currency>USD</Currency><Amount>455.73</Amount></TotalSurcharges><TotalNetCharge><Currency>USD</Currency><Amount>2734.37</Amount></TotalNetCharge><TotalRebates><Currency>USD</Currency><Amount>0.00</Amount></TotalRebates></ShipmentRateDetail><RatedPackages><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount></RatedPackages></RatedShipmentDetails></Options> <Options><ServiceDetail><ServiceType>FEDEX_3_DAY_FREIGHT</ServiceType><PackagingType>YOUR_PACKAGING</PackagingType><DeliveryDay>TUE</DeliveryDay><DeliveryDate>2008-05-27</DeliveryDate><DestinationStationId>DFW</DestinationStationId><SignatureOption>SERVICE_DEFAULT</SignatureOption></ServiceDetail><ActualRateType>PAYOR_ACCOUNT</ActualRateType><RatedShipmentDetails><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount><ShipmentRateDetail><RateType>PAYOR_ACCOUNT</RateType><RateScale>07186</RateScale><RateZone>5</RateZone><TotalBillingWeight><Units>LB</Units><Value>728.0</Value></TotalBillingWeight><TotalBaseCharge><Currency>USD</Currency><Amount>1077.44</Amount></TotalBaseCharge><TotalFreightDiscounts><Currency>USD</Currency><Amount>0.00</Amount></TotalFreightDiscounts><TotalSurcharges><Currency>USD</Currency><Amount>215.49</Amount></TotalSurcharges><TotalNetCharge><Currency>USD</Currency><Amount>1292.93</Amount></TotalNetCharge> <TotalRebates><Currency>USD</Currency><Amount>0.00</Amount></TotalRebates></ShipmentRateDetail><RatedPackages><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount></RatedPackages></RatedShipmentDetails><RatedShipmentDetails><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount><ShipmentRateDetail><RateType>PAYOR_LIST</RateType><RateZone>5</RateZone><TotalBaseCharge><Currency>USD</Currency><Amount>1077.44</Amount></TotalBaseCharge><TotalFreightDiscounts><Currency>USD</Currency><Amount>0.00</Amount></TotalFreightDiscounts><TotalSurcharges><Currency>USD</Currency><Amount>215.49</Amount></TotalSurcharges><TotalNetCharge><Currency>USD</Currency><Amount>1292.93</Amount></TotalNetCharge><TotalRebates><Currency>USD</Currency><Amount>0.00</Amount></TotalRebates></ShipmentRateDetail><RatedPackages><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount></RatedPackages></RatedShipmentDetails></Options>'; $sxml = simplexml_load_string('<document>'.$xml.'</document>'); foreach($sxml->Options as $option){ echo $option->ActualRateType.'<br>'; } ?> Quote Link to comment Share on other sites More sharing options...
antonb Posted May 22, 2008 Author Share Posted May 22, 2008 Perfect! I owe you a coffee. Is there any easy way to change the order that they return in? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted May 22, 2008 Share Posted May 22, 2008 No, but you can sort it with PHP after getting the values. Explain more about what order you want, and I can help you with the code. Quote Link to comment Share on other sites More sharing options...
antonb Posted May 22, 2008 Author Share Posted May 22, 2008 I would like to sort the information by price so that the cheapest option is always at the top. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted May 22, 2008 Share Posted May 22, 2008 How would you calculate the amount to be compared? For each option, there are multiple RatedShipmentDetails... Quote Link to comment Share on other sites More sharing options...
antonb Posted May 22, 2008 Author Share Posted May 22, 2008 I would use "TotalNetCharge". Quote Link to comment Share on other sites More sharing options...
rhodesa Posted May 22, 2008 Share Posted May 22, 2008 Right, but each of the "Options" has two "RatedShipmentDetails", one for PAYOR_ACCOUNT and one for PAYOR_LIST. Each of those has it's own separate TotalNetCharge (even though in your example they are the same amount). What I'm asking is which TotalNetCharge should be compared? The PAYOR_ACCOUNT one or the PAYOR_LIST one? Quote Link to comment Share on other sites More sharing options...
antonb Posted May 22, 2008 Author Share Posted May 22, 2008 My bad. Technically it doesn't matter, but PAYOR_LIST is good. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted May 22, 2008 Share Posted May 22, 2008 Basically, loop over each option, and add it to an array, and it's cost to another array. Then do an array_multisort() and loop over the options array again. <?php $xml = '<Options><ServiceDetail><ServiceType>FEDEX_2_DAY_FREIGHT</ServiceType><PackagingType>YOUR_PACKAGING</PackagingType><DeliveryDay>MON</DeliveryDay><DeliveryDate>2008-05-26</DeliveryDate><DestinationStationId>DFW</DestinationStationId><SignatureOption>SERVICE_DEFAULT</SignatureOption></ServiceDetail><ActualRateType>PAYOR_ACCOUNT</ActualRateType><RatedShipmentDetails><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount><ShipmentRateDetail><RateType>PAYOR_ACCOUNT</RateType><RateScale>06704</RateScale><RateZone>5</RateZone><TotalBillingWeight><Units>LB</Units><Value>728.0</Value></TotalBillingWeight><TotalBaseCharge><Currency>USD</Currency><Amount>1142.96</Amount></TotalBaseCharge><TotalFreightDiscounts><Currency>USD</Currency><Amount>0.00</Amount></TotalFreightDiscounts><TotalSurcharges><Currency>USD</Currency><Amount>228.59</Amount></TotalSurcharges><TotalNetCharge><Currency>USD</Currency><Amount>1371.55</Amount></TotalNetCharge> <TotalRebates><Currency>USD</Currency><Amount>0.00</Amount></TotalRebates></ShipmentRateDetail><RatedPackages><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount></RatedPackages></RatedShipmentDetails><RatedShipmentDetails><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount><ShipmentRateDetail><RateType>PAYOR_LIST</RateType><RateZone>5</RateZone><TotalBaseCharge><Currency>USD</Currency><Amount>1142.96</Amount></TotalBaseCharge><TotalFreightDiscounts><Currency>USD</Currency><Amount>0.00</Amount></TotalFreightDiscounts><TotalSurcharges><Currency>USD</Currency><Amount>228.59</Amount></TotalSurcharges><TotalNetCharge><Currency>USD</Currency><Amount>1371.55</Amount></TotalNetCharge><TotalRebates><Currency>USD</Currency><Amount>0.00</Amount></TotalRebates></ShipmentRateDetail><RatedPackages><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount></RatedPackages></RatedShipmentDetails></Options> <Options><ServiceDetail><ServiceType>FEDEX_1_DAY_FREIGHT</ServiceType><PackagingType>YOUR_PACKAGING</PackagingType><DeliveryDay>FRI</DeliveryDay><DeliveryDate>2008-05-23</DeliveryDate><DestinationStationId>DFW</DestinationStationId><SignatureOption>SERVICE_DEFAULT</SignatureOption></ServiceDetail><ActualRateType>PAYOR_ACCOUNT</ActualRateType><RatedShipmentDetails><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount><ShipmentRateDetail><RateType>PAYOR_ACCOUNT</RateType><RateScale>02176</RateScale><RateZone>5</RateZone><TotalBillingWeight><Units>LB</Units><Value>728.0</Value></TotalBillingWeight><TotalBaseCharge><Currency>USD</Currency><Amount>2278.64</Amount></TotalBaseCharge><TotalFreightDiscounts><Currency>USD</Currency><Amount>0.00</Amount></TotalFreightDiscounts><TotalSurcharges><Currency>USD</Currency><Amount>455.73</Amount></TotalSurcharges><TotalNetCharge><Currency>USD</Currency><Amount>2734.37</Amount></TotalNetCharge> <TotalRebates><Currency>USD</Currency><Amount>0.00</Amount></TotalRebates></ShipmentRateDetail><RatedPackages><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount></RatedPackages></RatedShipmentDetails><RatedShipmentDetails><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount><ShipmentRateDetail><RateType>PAYOR_LIST</RateType><RateZone>5</RateZone><TotalBaseCharge><Currency>USD</Currency><Amount>2278.64</Amount></TotalBaseCharge><TotalFreightDiscounts><Currency>USD</Currency><Amount>0.00</Amount></TotalFreightDiscounts><TotalSurcharges><Currency>USD</Currency><Amount>455.73</Amount></TotalSurcharges><TotalNetCharge><Currency>USD</Currency><Amount>2734.37</Amount></TotalNetCharge><TotalRebates><Currency>USD</Currency><Amount>0.00</Amount></TotalRebates></ShipmentRateDetail><RatedPackages><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount></RatedPackages></RatedShipmentDetails></Options> <Options><ServiceDetail><ServiceType>FEDEX_3_DAY_FREIGHT</ServiceType><PackagingType>YOUR_PACKAGING</PackagingType><DeliveryDay>TUE</DeliveryDay><DeliveryDate>2008-05-27</DeliveryDate><DestinationStationId>DFW</DestinationStationId><SignatureOption>SERVICE_DEFAULT</SignatureOption></ServiceDetail><ActualRateType>PAYOR_ACCOUNT</ActualRateType><RatedShipmentDetails><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount><ShipmentRateDetail><RateType>PAYOR_ACCOUNT</RateType><RateScale>07186</RateScale><RateZone>5</RateZone><TotalBillingWeight><Units>LB</Units><Value>728.0</Value></TotalBillingWeight><TotalBaseCharge><Currency>USD</Currency><Amount>1077.44</Amount></TotalBaseCharge><TotalFreightDiscounts><Currency>USD</Currency><Amount>0.00</Amount></TotalFreightDiscounts><TotalSurcharges><Currency>USD</Currency><Amount>215.49</Amount></TotalSurcharges><TotalNetCharge><Currency>USD</Currency><Amount>1292.93</Amount></TotalNetCharge> <TotalRebates><Currency>USD</Currency><Amount>0.00</Amount></TotalRebates></ShipmentRateDetail><RatedPackages><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount></RatedPackages></RatedShipmentDetails><RatedShipmentDetails><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount><ShipmentRateDetail><RateType>PAYOR_LIST</RateType><RateZone>5</RateZone><TotalBaseCharge><Currency>USD</Currency><Amount>1077.44</Amount></TotalBaseCharge><TotalFreightDiscounts><Currency>USD</Currency><Amount>0.00</Amount></TotalFreightDiscounts><TotalSurcharges><Currency>USD</Currency><Amount>215.49</Amount></TotalSurcharges><TotalNetCharge><Currency>USD</Currency><Amount>1292.93</Amount></TotalNetCharge><TotalRebates><Currency>USD</Currency><Amount>0.00</Amount></TotalRebates></ShipmentRateDetail><RatedPackages><EffectiveNetDiscount><Currency>USD</Currency><Amount>0.00</Amount></EffectiveNetDiscount></RatedPackages></RatedShipmentDetails></Options>'; $sxml = simplexml_load_string('<document>'.$xml.'</document>'); $options = array(); $cost = array(); foreach($sxml->Options as $option){ $options[] = $option; $cost[] = (float)$option->RatedShipmentDetails->ShipmentRateDetail->TotalNetCharge->Amount; } array_multisort($cost,$options); foreach($options as $option){ echo $option->ServiceDetail->ServiceType.'<br>'; } ?> Quote Link to comment Share on other sites More sharing options...
antonb Posted May 27, 2008 Author Share Posted May 27, 2008 Thanks again for your help. I finally got around to implementing this today and it worked just fine. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.