Author Topic: UPS v2.0 (multiple functionality additions)  (Read 300283 times)

lowmips

  • Global Moderator
  • Hero Member
  • *
  • Posts: 1464
    • lowmips.com
Re: UPS v2.0 Bundled and Unbundled Shipping
« Reply #30 on: November 20, 2008, 19:04:30 pm »
Mike,
Put your site into debug mode and see what the XML request/replies are.  That should get you started on debugging your error.

As for the shipping modifier, it modifies the prices for ALL rates currently. Breaking it down further would require more code.


-Reggie
Visit my website at www.lowmips.com
View my newsletters Here (sign up for newsletters on the front page of my website)

cferrell

  • Beginner
  • *
  • Posts: 10
Re: UPS v2.0 Bundled and Unbundled Shipping
« Reply #31 on: November 20, 2008, 19:45:01 pm »
Hi Reggie,  I work with Mike and I'm trying to debug this.  I've got virtuemart in debug mode, so let me give you some more info on what we're seeing

Here's the XML reply from UPS: 
<?xml version="1.0"?><RatingServiceSelectionResponse><Response><TransactionReference><XpciVersion>1.0001</XpciVersion></TransactionReference><ResponseStatusCode>1</ResponseStatusCode><ResponseStatusDescription>Success</ResponseStatusDescription></Response><RatedShipment><Service><Code>03</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>54.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>21.17</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>21.17</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery></GuaranteedDaysToDelivery><ScheduledDeliveryTime></ScheduledDeliveryTime><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>21.17</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>21.17</MonetaryValue></TotalCharges><Weight>53.5</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>54.0</Weight></BillingWeight></RatedPackage></RatedShipment><RatedShipment><Service><Code>12</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>54.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>62.90</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>62.90</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery>3</GuaranteedDaysToDelivery><ScheduledDeliveryTime></ScheduledDeliveryTime><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>62.90</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>62.90</MonetaryValue></TotalCharges><Weight>53.5</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>54.0</Weight></BillingWeight></RatedPackage></RatedShipment><RatedShipment><Service><Code>02</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>54.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>79.86</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>79.86</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery>2</GuaranteedDaysToDelivery><ScheduledDeliveryTime></ScheduledDeliveryTime><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>79.86</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>79.86</MonetaryValue></TotalCharges><Weight>53.5</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>54.0</Weight></BillingWeight></RatedPackage></RatedShipment><RatedShipment><Service><Code>13</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>54.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>198.85</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>198.85</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery><ScheduledDeliveryTime></ScheduledDeliveryTime><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>198.85</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>198.85</MonetaryValue></TotalCharges><Weight>53.5</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>54.0</Weight></BillingWeight></RatedPackage></RatedShipment><RatedShipment><Service><Code>14</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>54.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>241.19</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>241.19</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery><ScheduledDeliveryTime>8:00 A.M.</ScheduledDeliveryTime><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>241.19</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>241.19</MonetaryValue></TotalCharges><Weight>53.5</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>54.0</Weight></BillingWeight></RatedPackage></RatedShipment><RatedShipment><Service><Code>01</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>54.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>204.57</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>204.57</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery><ScheduledDeliveryTime>10:30 A.M.</ScheduledDeliveryTime><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>204.57</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>204.57</MonetaryValue></TotalCharges><Weight>53.5</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>54.0</Weight></BillingWeight></RatedPackage></RatedShipment></RatingServiceSelectionResponse>

It looks like we're at least getting back some shipping cost from them, but in your code I see from debugging:

Debug: Caching rates for weight: 53.53 and insurance:
Debug: Added unbundled weight: 53.53. Orig price: . New price: 0
Debug: Added unbundled weight: 53.53. Orig price: . New price: 0

and then:

$0.00) - Weight: 53.53 , Fee: [[0(1)]+0](1)]


Do we maybe have the module configured incorrectly?

cferrell

  • Beginner
  • *
  • Posts: 10
Re: UPS v2.0 Bundled and Unbundled Shipping
« Reply #32 on: November 20, 2008, 19:48:30 pm »
Oh, and I forgot.  We're seeing the FSC problem seems to have to do with a Fuel Surcharge constant.  I put the FSC for the enabled types of shipping to 0, but it seems to still be happening.

lowmips

  • Global Moderator
  • Hero Member
  • *
  • Posts: 1464
    • lowmips.com
Re: UPS v2.0 Bundled and Unbundled Shipping
« Reply #33 on: November 20, 2008, 19:49:57 pm »
The XML response you posted is a valid succesful response. Was there still an error message posted ??


ps. In the future, please paste the XML response in a text file and attach it to your message, instead of pasting it directly into a forum post =)
Visit my website at www.lowmips.com
View my newsletters Here (sign up for newsletters on the front page of my website)

lowmips

  • Global Moderator
  • Hero Member
  • *
  • Posts: 1464
    • lowmips.com
UPS v2.0 Update
« Reply #34 on: November 20, 2008, 19:56:35 pm »
Update 2: 2008/11/20
- added option to skip handling charges on packages with free shipping
- removed bug where in certain cases handling was being charged twice (original UPSv1.0 code)
- please use file vm_ups_v2.0_2008-11-20.zip
Please note, the bug from version UPSv2.0_2008-11-09.zip is still present in this version.  If you need to use the "UPS Worldwide Expedited SM" service, do not use this module!
Visit my website at www.lowmips.com
View my newsletters Here (sign up for newsletters on the front page of my website)

cferrell

  • Beginner
  • *
  • Posts: 10
Re: UPS v2.0 Bundled and Unbundled Shipping
« Reply #35 on: November 20, 2008, 20:11:47 pm »
I think the relevant portion of the debug output is:

Debug: Caching rates for weight: 53.53 and insurance:
Debug: Added unbundled weight: 53.53. Orig price: . New price: 0
Debug: Added unbundled weight: 53.53. Orig price: . New price: 0

and then:

$0.00) - Weight: 53.53 , Fee: [[0(1)]+0](1)]

Look at the Fee calculation above.  It comes out $0.00 everytime.

lowmips

  • Global Moderator
  • Hero Member
  • *
  • Posts: 1464
    • lowmips.com
Re: UPS v2.0 Bundled and Unbundled Shipping
« Reply #36 on: November 20, 2008, 20:17:11 pm »
Can you attach the XML request also please?
Also, which version of the UPSv2.0 module are you using?
How many items are in the cart? How many bundled? How many unbundled?


What worries me is the original price is showing a blank.
Debug: Added unbundled weight: 53.53. Orig price: . New price: 0
Debug: Added unbundled weight: 53.53. Orig price: . New price: 0

That is very odd.  From your XML response we should be getting an original charge of $21 and up!
Visit my website at www.lowmips.com
View my newsletters Here (sign up for newsletters on the front page of my website)

cferrell

  • Beginner
  • *
  • Posts: 10
Re: UPS v2.0 Bundled and Unbundled Shipping
« Reply #37 on: November 20, 2008, 20:29:55 pm »
Attached is the UPS request and response.

The version we're using is the one 11-17-08 you posted today with the fix for the product.product-display.php with 9xxx bytes or so.

There is one item in the cart, unbundled.

[attachment cleanup by admin]

lowmips

  • Global Moderator
  • Hero Member
  • *
  • Posts: 1464
    • lowmips.com
Re: UPS v2.0 Bundled and Unbundled Shipping
« Reply #38 on: November 20, 2008, 20:56:32 pm »
cferrell:
Joomla version? Virtuemart version?

product price? padding? shipping modifier? handling fee?

I'm scratching my head on this one, I've tested one unbundled product on my site and it came through fine, as always.

-Reggie
Visit my website at www.lowmips.com
View my newsletters Here (sign up for newsletters on the front page of my website)

cferrell

  • Beginner
  • *
  • Posts: 10
Re: UPS v2.0 Bundled and Unbundled Shipping
« Reply #39 on: November 20, 2008, 21:02:00 pm »
Maybe this will help: 

In upsv2.php around line 320, right before

for ($rateLooper=0;$rateLooper<count($tmpRates);$rateLooper++) {

// the looper for unbundled items

I put $vmLogger->debug($tmpRates);

right below

$tmpRates=&$this->get_ups_rates($shipments[$shipmentLooper]
['weight'],$shipments[$shipmentLooper]['insurance']);

and get back

Debug: Array
(
[2] => Array
(
[ServiceCode] => 02
[ServiceName] => UPS 2nd Day Air
[BillingWeight] => 54.0
[transportationCharges] => 79.86
[ServiceOptionsCharges] => 0.00
[TotalCharges] => 79.86
[GuaranteedDaysToDelivery] => 2<br>
)

[5] => Array
(
[ServiceCode] => 01
[ServiceName] => UPS Next Day Air
[BillingWeight] => 54.0
[transportationCharges] => 204.57
[ServiceOptionsCharges] => 0.00
[TotalCharges] => 204.57
[GuaranteedDaysToDelivery] => 1<br>
)


It seems to me that the interesting bit there above is the index of the array (2 and 5).

So if count($tmpRates) comes up with 2, then it's going to index 0 and 1 in the loop, and not get the indexes 2 and 5.

Or am I totally off here?

cferrell

  • Beginner
  • *
  • Posts: 10
Re: UPS v2.0 Bundled and Unbundled Shipping
« Reply #40 on: November 20, 2008, 21:23:11 pm »
Something else that might be interesting.  I can't seem to turn off the UPS Worldwide Expedited SM in the configuration of your module.  I save it, but it always comes back checked.

lowmips

  • Global Moderator
  • Hero Member
  • *
  • Posts: 1464
    • lowmips.com
Re: UPS v2.0 Bundled and Unbundled Shipping
« Reply #41 on: November 20, 2008, 21:27:24 pm »
Worldwide Expedited SM -> See the bug notice about that.


Weird array indice thing ->
Very very weird.  If you'll look at the get_ups_rates function, it counts the <RatedShipment> nodes in the response, and loops through them one at a time, assigning the information gathered to the array $shipments.  $shipments has arrays at indice 0 to indice ($childCount). $shipments is what is actually returned, and is what $tmpRates refers to.

Try this:
remove the ampersand from the call. It may have something to do with $shipments not being a global variable and being referred to outside of the function.

Also, put this vmLogger call at the bottom of ups_get_rates, before the return:
$vmLogger->($shipment);
Visit my website at www.lowmips.com
View my newsletters Here (sign up for newsletters on the front page of my website)

cferrell

  • Beginner
  • *
  • Posts: 10
Re: UPS v2.0 Bundled and Unbundled Shipping
« Reply #42 on: November 20, 2008, 22:31:53 pm »
Removed the ampersands from the calls to get_ups_rates in bundled and unbundled, and put a $vmLogger->debug($shipment) right before the return in get_ups_rates.

Unsuprisingly, got back this right before the return in get_ups_rates :

Debug: Array
(
  • => Array

(
[ServiceCode] => 03
[ServiceName] => UPS Ground
[BillingWeight] => 54.0
[transportationCharges] => 21.17
[ServiceOptionsCharges] => 0.00
[TotalCharges] => 21.17
[GuaranteedDaysToDelivery] => <br>
)

[2] => Array
(
[ServiceCode] => 02
[ServiceName] => UPS 2nd Day Air
[BillingWeight] => 54.0
[transportationCharges] => 79.86
[ServiceOptionsCharges] => 0.00
[TotalCharges] => 79.86
[GuaranteedDaysToDelivery] => 2<br>
)

[5] => Array
(
[ServiceCode] => 01
[ServiceName] => UPS Next Day Air
[BillingWeight] => 54.0
[transportationCharges] => 204.57
[ServiceOptionsCharges] => 0.00
[TotalCharges] => 204.57
[GuaranteedDaysToDelivery] => 1<br>
)

)


I'm going to take another look at that UPS XML result to see how many rates it's sending back.

I added UPS ground as a shipment method, and that's why there's elements of the array now.

Mr Justin

  • Beginner
  • *
  • Posts: 6
Re: UPS v2.0 Bundled and Unbundled Shipping
« Reply #43 on: November 20, 2008, 23:23:36 pm »
I have a Question I am using Joomla 1.5.8 and vm 1.1.2 i am trying to set up the latest version of the UPS v2.0 2008.11.20

When i add any items to my cart and go to the shipping part of the check out i get this error

Error: Error processing the Request to UPS.com
Error: We could not find a UPS shipping rate. Please make sure you have entered a valid shipping address. Or choose a rate below.

When i tern on both v1.0 and v.2.0 It shows Two out puts that's the only time v2.0 seems to work why is?
example

UPS Ground ($16.12)


UPS Ground ($16.12)

When just v1.0 is on it works like it did be for. This works like this with any kind of Shipping Method turned on or off in v2.0 but if there all ones on v1.0 are on it shows up like this.

UPS Ground ($16.12)
UPS 3 Day Select ($19.82)
UPS 2nd Day Air ($24.51)
UPS Next Day Air ($34.21)


UPS Ground ($16.12)
UPS 3 Day Select ($19.82)
UPS 2nd Day Air ($24.51)
UPS Next Day Air ($34.21)

Any one know what i missed?
Thank You for you time



cferrell

  • Beginner
  • *
  • Posts: 10
Re: UPS v2.0 Bundled and Unbundled Shipping
« Reply #44 on: November 20, 2008, 23:38:01 pm »
I'm pretty sure I know why the indices of the $shipment array are the way they are.

In get_ups_rates there's a

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

...

then there's a

switch-case in another loop below that.  in the case statments, there's statements like $shipment[$i]["ServiceCode"] = .....

So even though the service types that we're not interested in are getting ignored with

if ( in_array($currNode->childNodes[0]->getText(),$myservicecodes) )  {

the indexes are still based off that outer loop of $i.