Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Shipping XML Request and Response: How to receive XML tags? 
 
leetaylordoes
Sr. Member
 
Total Posts:  227
Joined:  2008-02-05
San Diego, CA
 

Hi all,

I am working with UPS to receive negotiated rates via adjusting the Shipping PHP and XML (request & response), and am in need to present to them the entire Shipping XML Request and Response information.

Is anyone familiar with the most efficient way to display the XML tags and values like below?

I’ve thrown a var_dump() just before the request & response to show the variables, though only the variables are shown without any XML tags in place.

UPS requested a view like this:

<?xml version="1.0" encoding="UTF-8"?>
<RatingServiceSelectionResponse>
  <
Response>
    <
TransactionReference>
      <
CustomerContext>Rating and Service</CustomerContext>
      <
XpciVersion>1.0001</XpciVersion>
    </
TransactionReference>
    <
ResponseStatusCode>1</ResponseStatusCode>
    <
ResponseStatusDescription>Success</ResponseStatusDescription>
  </
Response>
  <
RatedShipment>
    <
Service>
      <
Code>01</Code>
    </
Service>
    <
RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning>
    <
BillingWeight>
      <
UnitOfMeasurement>
        <
Code>LBS</Code>
      </
UnitOfMeasurement>
      <
Weight>2.0</Weight>
    </
BillingWeight>
    <
TransportationCharges>
      <
CurrencyCode>USD</CurrencyCode>
      <
MonetaryValue>52.34</MonetaryValue>
    </
TransportationCharges>
    <
ServiceOptionsCharges>
      <
CurrencyCode>USD</CurrencyCode>
      <
MonetaryValue>0.00</MonetaryValue>
    </
ServiceOptionsCharges>
    <
TotalCharges>
      <
CurrencyCode>USD</CurrencyCode>
      <
MonetaryValue>52.34</MonetaryValue>
    </
TotalCharges>
    <
GuaranteedDaysToDelivery/>
    <
ScheduledDeliveryTime/>
    <
RatedPackage>
      <
TransportationCharges>
        <
CurrencyCode>USD</CurrencyCode>
        <
MonetaryValue>52.34</MonetaryValue>
      </
TransportationCharges>
      <
ServiceOptionsCharges>
        <
CurrencyCode>USD</CurrencyCode>
        <
MonetaryValue>0.00</MonetaryValue>
      </
ServiceOptionsCharges>
      <
TotalCharges>
        <
CurrencyCode>USD</CurrencyCode>
        <
MonetaryValue>52.34</MonetaryValue>
      </
TotalCharges>
      <
Weight>1.5</Weight>
      <
BillingWeight>
        <
UnitOfMeasurement>
          <
Code>LBS</Code>
        </
UnitOfMeasurement>
        <
Weight>2.0</Weight>
      </
BillingWeight>
    </
RatedPackage>
    <
NegotiatedRates>
      <
NetSummaryCharges>
        <
GrandTotal>
          <
CurrencyCode>USD</CurrencyCode>
          <
MonetaryValue>30.36</MonetaryValue>
        </
GrandTotal>
      </
NetSummaryCharges>
    </
NegotiatedRates>
  </
RatedShipment>
</
RatingServiceSelectionResponse>

Evidently, the <NegotiatedRates> container holds the negotiated rates, if all other customization has been implemented.

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
leetaylordoes
Sr. Member
 
Total Posts:  227
Joined:  2008-02-05
San Diego, CA
 

For more clarification:

Evidently, my first step is to make sure the <NegotiatedRates> container is being sent back from UPS in the response. Thus, I need to not only see the values available post-response receiving, but I need to see the XML tags associated with the XML response from UPS to make sure the <NegotiatedRates> container is present.

Secondly, I need to make sure the rates that are displayed are the values from within the <NegotiatedRates> container and not the (default) <TotalCharges> container. Thus, I need to display the XML tags and values PRE-XML parsing.

Any ideas? Should be fairly straightforward.

Thanks,
Lee

 
Magento Community Magento Community
Magento Community
Magento Community
 
leetaylordoes
Sr. Member
 
Total Posts:  227
Joined:  2008-02-05
San Diego, CA
 

Hi all,

I’ve actually been able to get negotiated rates!! We’re very excited, and will be rolling out with our customization soon. We’ll be sure to add it to the community either as an extension or with instructions on how to do so.

One thing I need to find, and thought I’d throw it out to see if anyone has a quick answer while I look around into the code.

I need to dynamically throw in a correct value for the actual STATE being shipped TO. The XML sends it in this tag:

<Shipment>
      <
Shipper>
      <
Address>
          <
StateProvinceCode>

Thus, I’m trying to get the correct State to be shipped TO sent through and available via the $params array (which in Ups.php includes many other values such as the city, country, etc.)

Anyone know how to pass through the desired Shipping To state location, and available in a 2 letter, capitalized format?

Thanks,
Lee

 
Magento Community Magento Community
Magento Community
Magento Community
 
leetaylordoes
Sr. Member
 
Total Posts:  227
Joined:  2008-02-05
San Diego, CA
 

Actually, I need these two items to be available via the Ups.php file (probably via $params array for both Shipping TO, and Shipping FROM.

Items:

- Shipping TO State
- Shipping FROM State

 
Magento Community Magento Community
Magento Community
Magento Community
 
leetaylordoes
Sr. Member
 
Total Posts:  227
Joined:  2008-02-05
San Diego, CA
 

Hi all,

I’ll still be looking how to dynamically grab these variables into the Ups.php file functions:

- Origin State/Providence
- Destination State/Providence

If anyone has a quick suggestion, feel free to throw it this way.

Thanks,
- Lee

 
Magento Community Magento Community
Magento Community
Magento Community
 
evL
Member
 
Total Posts:  32
Joined:  2008-04-23
 

If you didn’t found already, it’s already in the Ups.php file.

They get the data from the request.

 
Magento Community Magento Community
Magento Community
Magento Community
 
leetaylordoes
Sr. Member
 
Total Posts:  227
Joined:  2008-02-05
San Diego, CA
 

Hi evL,

Thanks for the post. I went ahead and tracked them down, realizing they were within the Ups.php file.

Furthermore, I have successfully modified the code via usage of UPS Online Tools API and the XML request and response to apply “negotiated rates” to our client’s account.

I’ll soon be rolling out with either an extension or wiki doc as to the modifications that need to be made in order to make this happen.

Thanks again for the reply, and we’re excited to help extend Magento a bit more for the community’s benefit - as it continues to prove itself as a really great application.

- Lee

 
Magento Community Magento Community
Magento Community
Magento Community
 
Pukos
Sr. Member
 
Avatar
Total Posts:  108
Joined:  2008-02-15
 
timothyleetaylor - 14 August 2008 09:12 AM

Hi evL,

Thanks for the post. I went ahead and tracked them down, realizing they were within the Ups.php file.

Furthermore, I have successfully modified the code via usage of UPS Online Tools API and the XML request and response to apply “negotiated rates” to our client’s account.

I’ll soon be rolling out with either an extension or wiki doc as to the modifications that need to be made in order to make this happen.

Thanks again for the reply, and we’re excited to help extend Magento a bit more for the community’s benefit - as it continues to prove itself as a really great application.

- Lee

Hi Timothy,
I’m still in the same pain: can’t get the destination state.

Is there any possibilities that you release your ups.php to us (Also without explanations)?
I really, really need it…

Tnx in advance

 
Magento Community Magento Community
Magento Community
Magento Community
 
unclek
Jr. Member
 
Total Posts:  7
Joined:  2008-08-18
Canada
 

try $response->getRegionCode()

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top