Last Updated on Tuesday, 17 November 2009 07:26 Written by Rodney McCabe
I was fixing a Joomla installation for a client who was using the UPS module in Virtuemart when I noticed that certain items were showing up as
having valid shipping options but at a $0 cost. Obviously this was not correct so I dug into the /administrator/components/com_virtuemart/classes/shipping/ups.php code.
You'll find the following code block starting at line 230:
// Second Element: BillingWeight
if( $currNode->childNodes[$e]->nodeName == 'RatedShipmentWarning') {
$e++;
}
This block assumes that at most one warning will be returned. This was not the case in our situation; we had two warnings!Therefore the easy fix is to iterate over all RateShipmentWarning nodes in the XML response. All that needs to be done to make this happen is to change the if to while:
// Second Element: BillingWeight
// rmccabe ... changed if to while to accomodate multiple warnings
while ( $currNode->childNodes[$e]->nodeName == 'RatedShipmentWarning') {
$e++;
}
That got us past that hurdle ... next was the 150lb package weight. In case you are unaware, UPS has a cap on the weight it will quote through the API and the Virtuemart UPS plugin author was kind enough to take packages that weigh more and reduce the weight to 150lbs. This will certainly get you a quote, but may end up eating your margins!