VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Shipping VM 1.1 => UPS VM 1 => Topic started by: sacramentojoe on September 21, 2008, 04:16:29 AM

Title: Shipping Response displays all zeros for all shipping options (Now with FIX)
Post by: sacramentojoe on September 21, 2008, 04:16:29 AM
I just ran into a problem with the latest version of Joomla and VM 1.1.2, where a certain request to the shipping api, is showing zeros for the dollar amount to my users. My users think they are getting $150 worth of over night shipping for free.. BAD..

Here is my request in XML form:

<?xml version="1.0"?>
<AccessRequest xml:lang="en-US">
<AccessLicenseNumber>XXX</AccessLicenseNumber>
<UserId>XXX</UserId>
<Password>XXX</Password>
</AccessRequest>
<?xml version="1.0"?>
<RatingServiceSelectionRequest xml:lang="en-US">
<Request>
<TransactionReference>
<CustomerContext>Shipping Estimate</CustomerContext>
<XpciVersion>1.0001</XpciVersion>
</TransactionReference>
<RequestAction>rate</RequestAction>
<RequestOption>shop</RequestOption>
</Request>
<PickupType>
<Code>01</Code>
</PickupType>
<Shipment>
<Shipper>
<Address>
<PostalCode>95662</PostalCode>
<CountryCode>US</CountryCode>
</Address>
</Shipper>
<ShipTo>
<Address>
<PostalCode>95742</PostalCode>
<CountryCode>US</CountryCode>
<ResidentialAddressIndicator/>
</Address>
</ShipTo>
<ShipFrom>
<Address>
<PostalCode>95662</PostalCode>
<CountryCode>US</CountryCode>
</Address>
</ShipFrom>
<Package>
<PackagingType>
<Code>00</Code>
</PackagingType>
<PackageWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>80.25</Weight>
</PackageWeight>
</Package>
</Shipment>


Here is the response that comes back from UPS.
Any help would be greatly appreciated, Thank you.
<ratingserviceselectionresponse>
<response>
<transactionreference>
<customercontext>Shipping Estimate</customercontext>
<xpciversion>1.0001</xpciversion>
</transactionreference>
<responsestatuscode>1</responsestatuscode>
<responsestatusdescription>Success</responsestatusdescription>
</response>
<ratedshipment>
<service>
<code>03</code>
</service>
<ratedshipmentwarning>Additional Handling has automatically been set on Package 1.</ratedshipmentwarning>
<ratedshipmentwarning>Your invoice may vary from the displayed reference rates</ratedshipmentwarning>
<billingweight>
<unitofmeasurement>
<code>LBS</code>
</unitofmeasurement>
<weight>81.0</weight>
</billingweight>
<transportationcharges>
<currencycode>USD</currencycode>
<monetaryvalue>26.39</monetaryvalue>
</transportationcharges>
<serviceoptionscharges>
<currencycode>USD</currencycode>
<monetaryvalue>6.50</monetaryvalue>
</serviceoptionscharges>
<totalcharges>
<currencycode>USD</currencycode>
<monetaryvalue>32.89</monetaryvalue>
</totalcharges>
<guaranteeddaystodelivery></guaranteeddaystodelivery>
<scheduleddeliverytime></scheduleddeliverytime>
<ratedpackage>
<transportationcharges>
<currencycode>USD</currencycode>
<monetaryvalue>26.39</monetaryvalue>
</transportationcharges>
<serviceoptionscharges>
<currencycode>USD</currencycode>
<monetaryvalue>6.50</monetaryvalue>
</serviceoptionscharges>
<totalcharges>
<currencycode>USD</currencycode>
<monetaryvalue>32.89</monetaryvalue>
</totalcharges>
<weight>80.2</weight>
<billingweight>
<unitofmeasurement>
<code>LBS</code>
</unitofmeasurement>
<weight>81.0</weight>
</billingweight>
</ratedpackage>
</ratedshipment>
<ratedshipment>
<service>
<code>12</code>
</service>
<ratedshipmentwarning>Additional Handling has automatically been set on Package 1.</ratedshipmentwarning>
<ratedshipmentwarning>Your invoice may vary from the displayed reference rates</ratedshipmentwarning>
<billingweight>
<unitofmeasurement>
<code>LBS</code>
</unitofmeasurement>
<weight>81.0</weight>
</billingweight>
<transportationcharges>
<currencycode>USD</currencycode>
<monetaryvalue>60.79</monetaryvalue>
</transportationcharges>
<serviceoptionscharges>
<currencycode>USD</currencycode>
<monetaryvalue>6.50</monetaryvalue>
</serviceoptionscharges>
<totalcharges>
<currencycode>USD</currencycode>
<monetaryvalue>67.29</monetaryvalue>
</totalcharges>
<guaranteeddaystodelivery>3</guaranteeddaystodelivery>
<scheduleddeliverytime></scheduleddeliverytime>
<ratedpackage>
<transportationcharges>
<currencycode>USD</currencycode>
<monetaryvalue>60.79</monetaryvalue>
</transportationcharges>
<serviceoptionscharges>
<currencycode>USD</currencycode>
<monetaryvalue>6.50</monetaryvalue>
</serviceoptionscharges>
<totalcharges>
<currencycode>USD</currencycode>
<monetaryvalue>67.29</monetaryvalue>
</totalcharges>
<weight>80.2</weight>
<billingweight>
<unitofmeasurement>
<code>LBS</code>
</unitofmeasurement>
<weight>81.0</weight>
</billingweight>
</ratedpackage>
</ratedshipment>
<ratedshipment>
<service>
<code>02</code>
</service>
<ratedshipmentwarning>Additional Handling has automatically been set on Package 1.</ratedshipmentwarning>
<ratedshipmentwarning>Your invoice may vary from the displayed reference rates</ratedshipmentwarning>
<billingweight>
<unitofmeasurement>
<code>LBS</code>
</unitofmeasurement>
<weight>81.0</weight>
</billingweight>
<transportationcharges>
<currencycode>USD</currencycode>
<monetaryvalue>80.77</monetaryvalue>
</transportationcharges>
<serviceoptionscharges>
<currencycode>USD</currencycode>
<monetaryvalue>6.50</monetaryvalue>
</serviceoptionscharges>
<totalcharges>
<currencycode>USD</currencycode>
<monetaryvalue>87.27</monetaryvalue>
</totalcharges>
<guaranteeddaystodelivery>2</guaranteeddaystodelivery>
<scheduleddeliverytime></scheduleddeliverytime>
<ratedpackage>
<transportationcharges>
<currencycode>USD</currencycode>
<monetaryvalue>80.77</monetaryvalue>
</transportationcharges>
<serviceoptionscharges>
<currencycode>USD</currencycode>
<monetaryvalue>6.50</monetaryvalue>
</serviceoptionscharges>
<totalcharges>
<currencycode>USD</currencycode>
<monetaryvalue>87.27</monetaryvalue>
</totalcharges>
<weight>80.2</weight>
<billingweight>
<unitofmeasurement>
<code>LBS</code>
</unitofmeasurement>
<weight>81.0</weight>
</billingweight>
</ratedpackage>
</ratedshipment>
<ratedshipment>
<service>
<code>13</code>
</service>
<ratedshipmentwarning>Additional Handling has automatically been set on Package 1.</ratedshipmentwarning>
<ratedshipmentwarning>Your invoice may vary from the displayed reference rates</ratedshipmentwarning>
<billingweight>
<unitofmeasurement>
<code>LBS</code>
</unitofmeasurement>
<weight>81.0</weight>
</billingweight>
<transportationcharges>
<currencycode>USD</currencycode>
<monetaryvalue>128.99</monetaryvalue>
</transportationcharges>
<serviceoptionscharges>
<currencycode>USD</currencycode>
<monetaryvalue>6.50</monetaryvalue>
</serviceoptionscharges>
<totalcharges>
<currencycode>USD</currencycode>
<monetaryvalue>135.49</monetaryvalue>
</totalcharges>
<guaranteeddaystodelivery>1</guaranteeddaystodelivery>
<scheduleddeliverytime></scheduleddeliverytime>
<ratedpackage>
<transportationcharges>
<currencycode>USD</currencycode>
<monetaryvalue>128.99</monetaryvalue>
</transportationcharges>
<serviceoptionscharges>
<currencycode>USD</currencycode>
<monetaryvalue>6.50</monetaryvalue>
</serviceoptionscharges>
<totalcharges>
<currencycode>USD</currencycode>
<monetaryvalue>135.49</monetaryvalue>
</totalcharges>
<weight>80.2</weight>
<billingweight>
<unitofmeasurement>
<code>LBS</code>
</unitofmeasurement>
<weight>81.0</weight>
</billingweight>
</ratedpackage>
</ratedshipment>
<ratedshipment>
<service>
<code>14</code>
</service>
<ratedshipmentwarning>Additional Handling has automatically been set on Package 1.</ratedshipmentwarning>
<ratedshipmentwarning>Your invoice may vary from the displayed reference rates</ratedshipmentwarning>
<billingweight>
<unitofmeasurement>
<code>LBS</code>
</unitofmeasurement>
<weight>81.0</weight>
</billingweight>
<transportationcharges>
<currencycode>USD</currencycode>
<monetaryvalue>190.38</monetaryvalue>
</transportationcharges>
<serviceoptionscharges>
<currencycode>USD</currencycode>
<monetaryvalue>6.50</monetaryvalue>
</serviceoptionscharges>
<totalcharges>
<currencycode>USD</currencycode>
<monetaryvalue>196.88</monetaryvalue>
</totalcharges>
<guaranteeddaystodelivery>1</guaranteeddaystodelivery>
<scheduleddeliverytime>8:30 A.M.</scheduleddeliverytime>
<ratedpackage>
<transportationcharges>
<currencycode>USD</currencycode>
<monetaryvalue>190.38</monetaryvalue>
</transportationcharges>
<serviceoptionscharges>
<currencycode>USD</currencycode>
<monetaryvalue>6.50</monetaryvalue>
</serviceoptionscharges>
<totalcharges>
<currencycode>USD</currencycode>
<monetaryvalue>196.88</monetaryvalue>
</totalcharges>
<weight>80.2</weight>
<billingweight>
<unitofmeasurement>
<code>LBS</code>
</unitofmeasurement>
<weight>81.0</weight>
</billingweight>
</ratedpackage>
</ratedshipment>
<ratedshipment>
<service>
<code>01</code>
</service>
<ratedshipmentwarning>Additional Handling has automatically been set on Package 1.</ratedshipmentwarning>
<ratedshipmentwarning>Your invoice may vary from the displayed reference rates</ratedshipmentwarning>
<billingweight>
<unitofmeasurement>
<code>LBS</code>
</unitofmeasurement>
<weight>81.0</weight>
</billingweight>
<transportationcharges>
<currencycode>USD</currencycode>
<monetaryvalue>152.05</monetaryvalue>
</transportationcharges>
<serviceoptionscharges>
<currencycode>USD</currencycode>
<monetaryvalue>6.50</monetaryvalue>
</serviceoptionscharges>
<totalcharges>
<currencycode>USD</currencycode>
<monetaryvalue>158.55</monetaryvalue>
</totalcharges>
<guaranteeddaystodelivery>1</guaranteeddaystodelivery>
<scheduleddeliverytime>10:30 A.M.</scheduleddeliverytime>
<ratedpackage>
<transportationcharges>
<currencycode>USD</currencycode>
<monetaryvalue>152.05</monetaryvalue>
</transportationcharges>
<serviceoptionscharges>
<currencycode>USD</currencycode>
<monetaryvalue>6.50</monetaryvalue>
</serviceoptionscharges>
<totalcharges>
<currencycode>USD</currencycode>
<monetaryvalue>158.55</monetaryvalue>
</totalcharges>
<weight>80.2</weight>
<billingweight>
<unitofmeasurement>
<code>LBS</code>
</unitofmeasurement>
<weight>81.0</weight>
</billingweight>
</ratedpackage>
</ratedshipment>
</ratingserviceselectionresponse>
Title: Re: Shipping Response displays all zeros for all shipping options
Post by: sacramentojoe on September 21, 2008, 20:00:47 PM
I found the problem, working on a fix as we speak.
In the ups.php file while rate list is being parsed, the code only expects one RatedShipmentWarning element and in this case, there are two.
I'll post a fix once I'm done.
Title: Re: Shipping Response displays all zeros for all shipping options
Post by: sacramentojoe on September 21, 2008, 21:16:10 PM
OK, this was an easy fix, after I read the domit lite api documentation.
In the ups.php file, I changed the following:

for ($i = 0; $i < $rate_list->getLength(); $i++) {
$currNode =& $rate_list->item($i);

to read as

for ($i = 0; $i < $rate_list->getLength(); $i++) {
$currNode =& $rate_list->item($i);
//place holder for RatedShipmentWarning tags
$ratedShipmentWarnings = $currNode->getElementsByTagName("RatedShipmentWarning");


I basically added a variable to hold the number of RatedShipmentWarning elements.

I also changed this code:

if( $currNode->childNodes[$e]->nodeName == 'RatedShipmentWarning') {
$e++;
}

to read

if( $currNode->childNodes[$e]->nodeName == 'RatedShipmentWarning') {
$e += $ratedShipmentWarnings->getLength();
}


This allows us to increment the $e , element counter variable, to include an infinite number of RatedShipmentWarning messages.

I'm not sure if this is already a known error / bug, but I didn't find anything when I searched the forums. Hopefully this will help out the next person who runs into this issue.

Joe
Title: Re: Shipping Response displays all zeros for all shipping options (Now with FIX)
Post by: SA_Chick on November 10, 2008, 23:00:10 PM
Do you know if this fixes the rates for items that are over 80lbs? Seem to be having issues like everyone else. Was wondering why shipping was calculating so low.
Title: Re: Shipping Response displays all zeros for all shipping options (Now with FIX)
Post by: lowmips on November 10, 2008, 23:37:14 PM
This is exactly what I fixed in my UPS2.0 module yesterday. I modified the parse code to check each element's name before performing an action on it, instead of assuming a fixed number of elements (well, for the most part. I assumed the XML node children had a fixed number of elements).  See my UPSv2.0 post for details/download if interested.
Title: Re: Shipping Response displays all zeros for all shipping options (Now with FIX)
Post by: SA_Chick on November 10, 2008, 23:39:15 PM
Plan on installing this as soon as my backup is done downloading, and I will give you a holler after some testing.

Thanks a billion!
Title: Re: Shipping Response displays all zeros for all shipping options (Now with FIX)
Post by: quickturn on December 08, 2008, 01:20:48 AM
Quote from: sacramentojoe on September 21, 2008, 21:16:10 PM
OK, this was an easy fix, after I read the domit lite api documentation.
In the ups.php file, I changed the following:

for ($i = 0; $i < $rate_list->getLength(); $i++) {
$currNode =& $rate_list->item($i);

to read as

for ($i = 0; $i < $rate_list->getLength(); $i++) {
$currNode =& $rate_list->item($i);
//place holder for RatedShipmentWarning tags
$ratedShipmentWarnings = $currNode->getElementsByTagName("RatedShipmentWarning");

I basically added a variable to hold the number of RatedShipmentWarning elements.
I also changed this code:

if( $currNode->childNodes[$e]->nodeName == 'RatedShipmentWarning') {
$e++;
}

to read

if( $currNode->childNodes[$e]->nodeName == 'RatedShipmentWarning') {
$e += $ratedShipmentWarnings->getLength();
}

This allows us to increment the $e , element counter variable, to include an infinite number of RatedShipmentWarning messages.
I'm not sure if this is already a known error / bug, but I didn't find anything when I searched the forums. Hopefully this will help out the next person who runs into this issue.
Joe

MAJOR MAJOR MAJOR thank you for this.
Title: Re: Shipping Response displays all zeros for all shipping options (Now with FIX)
Post by: zigsdesign on February 19, 2010, 15:46:46 PM
Thank you, This fix also worded for me. It was not a weight related issue. I only had the problem when customers chose Alaska as the shipping destination. It would skip one of the UPS shipping methods and would then only display the handling fee for the rest.
Title: Re: Shipping Response displays all zeros for all shipping options (Now with FIX)
Post by: ctf on February 26, 2010, 23:25:02 PM
I thought the code change worked for me.  and it did fix the problem of the UPS handling fee showing up as the shipping charge when the order weight went over 70lbs.  But now i have another issue.  It won't charge over a certain amount - for example no matter how many items i add when shipping to an example address, the UPS shipping will NOT go over $89.87.  Is it stopping calculating after a certain weight? 

I sell clothing lots, so a 100 pc. lot may be (3) 70lb boxes.  So for the weight I put 210.    i'm not sure at what weight it no longer adds.
Title: Re: Shipping Response displays all zeros for all shipping options (Now with FIX)
Post by: heypachuco on March 24, 2010, 15:52:40 PM
I can't thank you enough for this!
Title: Re: Shipping Response displays all zeros for all shipping options (Now with FIX)
Post by: ihale on August 12, 2010, 20:50:38 PM
SAME problem, no matter how many i purchase, 2 or 100, the ups rate doesn't change. please help!!!!!!!!!!!!!

thanks.
Title: Re: Shipping Response displays all zeros for all shipping options (Now with FIX)
Post by: theengel on August 12, 2010, 22:23:11 PM

Thanks a billion Joe.  Worked wonderfully.
Title: Re: Shipping Response displays all zeros for all shipping options (Now with FIX)
Post by: richart on September 02, 2011, 11:15:50 AM
Thanks so much!  Worked perfectly.