News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

UPS module not returning any results

Started by neherp, January 03, 2009, 17:08:03 PM

Previous topic - Next topic

neherp

Hello,

I hope someone can shed some light on my troubles implementing either of the UPS shipping modules.

Environment:  WAMPServer 2, J!1.5.8, VM1.1.2, UPS ver1.0 & ver2.0.208.12.22.

I am evaluating VM in a test environment.  The shop is very basic, with only one item defined.  The item is defined as 7"H x 4"W x .5"H, weighing 1 lb. with no shipping restrictions.  I have limited the shipping options to the use of the USPS module and the two UPS modules.

The store address is a complete and verified address, as is the test customer address.

I receive valid results from the USPS module.

I selected every UPS shipping option.

In the case of UPS ver1.0, I receive the error:  Undefined variable: shipment in C:\wamp\www\neherp\administrator\components\com_virtuemart\classes\shipping\ups.php on line 280


In the case of UPS ver2.0.2008.12.22, I receive two errors:
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.

I have attached the xlm posts and responses captured from the debug screen.

It looks like there are valid responses back from UPS in both instances, but they are not being interpreted by the respective modules. 

Additionally, when I access the UPS2.0 configuration screen, there are two errors displayed at the top of the page:

Notice: Undefined index: ship_to_info_id in C:\wamp\www\neherp\administrator\components\com_virtuemart\classes\shipping\upsv2.php on line 108

Notice: Use of undefined constant WEIGHT_UOM - assumed 'WEIGHT_UOM' in C:\wamp\www\neherp\administrator\components\com_virtuemart\classes\shipping\upsv2.php on line 173

Any help is very much appreciated.

Cheers,
Mike

Michael Labbe
Webmaster
New England Herpetological Society

[attachment cleanup by admin]

lowmips

#1
Hi,

QuoteNotice: Undefined index: ship_to_info_id in C:\wamp\www\neherp\administrator\components\com_virtuemart\classes\shipping\upsv2.php on line 108

Notice: Use of undefined constant WEIGHT_UOM - assumed 'WEIGHT_UOM' in C:\wamp\www\neherp\administrator\components\com_virtuemart\classes\shipping\upsv2.php on line 173

You may wish to set your global error/warning down a notch to get rid of these warnings.  You'll see things like this pop up in many places in VM.  I'll try to remember to add some checks for these indices in my module.

As for the other errors I'll look into it (for upsv2).

-Reggie

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

lowmips

QuoteIn the case of UPS ver2.0.2008.12.22, I receive two errors:
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.

Have you configured the upsv2.0 module? Which services have you selected?

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

neherp

Hi Reggie,

Thank you for looking into this. 

I have turned on all services in both ver1.0 and ver2.0.2008.12.22.

Cheers,
Mike

Michael Labbe
Webmaster
New England Herpetological Society

lowmips

Mike,
Have you customized any templates or other files? It is very strange that you get the "Notice: Undefined index: ship_to_info_id" error on line 108.  That index should exist at that point in the code execution.  Are you by chance somehow skipping the login procedure and/or the shipping address selection?

Also, I have worked with other users whose similar problems disappeared once they reinstalled VirtueMart.  If you have no customizations and have not skipped any of the checkout steps, this may be something to consider.

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

lowmips

Mike,
As for the code not showing any rates even though the XML reply is valid, we would need to run a debug session with a new upsv2.0.php file with additional debug info to track down that issue.  Let me know if you're interested.

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

neherp

Okay, I'll try reinstalling VM, and the UPS modules.  If that doesn't work, I'm certainly interested in pursuing any other options available.  I'll post my results of the reinstall, and take it from there.

Cheers,
Mike

Michael Labbe
Webmaster
New England Herpetological Society

neherp

Well, that didn't help.

I downloaded fresh copies of VM1.12 & upsv2.0.2008.12.22, and reinstalled all of the software.  My results are exactly the same.

I am using the JA Purity template that ships with J!.  I have not modified the template files in any way.

I am not skipping any of the checkout steps.  I have tried checking out using the 'Default (same as billing)' option, as well as defining a separate shipping address.  I have also tried with insurance on and off.  In all cases, the XML responses are identical, and I get the following debug notices:

Debug: Caching rates for weight: 1 and insurance: 0
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.

and

Debug: Caching rates for weight: 1 and insurance: 24.95
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.

respectively.

One thing, I am seeing the "Notice: Undefined index: ship_to_info_id" error on line 108 message in the administrator screen when I click save after configuring the UPS module, not during checkout.

How do I proceed to take you up on your offer of further debugging help?

Cheers,
Mike

Michael Labbe
Webmaster
New England Herpetological Society

lowmips

Mike,
PM me your email address, I'll mail you the debug code.

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

lowmips

Hi all,
Mike and I ran a debug session and resolved the problem.  His installation was not using cURL to post the XML request.  The VirtueMart code was using an alternative method, which causes the reply to have connection information inserted, such as:


HTTP/1.0 200 OK
Server: Apache/2.0.52 (Red Hat) mod_ssl/2.0.52 OpenSSL/0.9.7a
Content-Length: 7383
Content-Type: application/xml
Expires: Sat, 03 Jan 2009 14:30:30 GMT
Cache-Control: max-age=0, no-cache, no-store
Pragma: no-cache
Date: Sat, 03 Jan 2009 14:30:30 GMT
Connection: close


The upsv1.0 code as well as my upsv2.0 code use the DOMIT XML parsing utility to parse the replies, and DOMIT did not like this connection information being in the data.  So, the workaround is either add a bit of code to snip off that extra information, or get cURL installed and working on your installation.

Hope this helps someone in the future.
-Reggie
Visit my website at www.lowmips.com
View my newsletters Here (sign up for newsletters on the front page of my website)

lowmips

#10
I'll add this code to my next version of upsv2.0. Here's the line if anyone needs to add to their existing install.

in upsv2.2008.12.22, around line 580,
or in upsv2.2009.01.01 around line 628,
after:

$xmlResult = vmConnector::handleCommunication($this->ups_url, $xmlPost );


add:

// non-CURL alternative post method bug workaround
// http://forum.virtuemart.net/index.php?topic=49897.0
$xmlpos = strpos($xmlResult,"<?xml");
if ($xmlpos > 0) {
$xmlResult = substr($xmlResult, $xmlpos);
}
Visit my website at www.lowmips.com
View my newsletters Here (sign up for newsletters on the front page of my website)

neherp

I have also tested Reggie's code snippet in the UPS v1.0 module, and it fixes the problem there, too.

The code snippet should be inserted after the same line that Reggie mentioned in the last post, around line 155 in the code.

Huge kudos to Reggie for spotting what the problem was.

Cheers,
Mike

Michael Labbe
Webmaster
New England Herpetological Society

danimaster

Hello,
I have the same problem like you before,
please help me to solve it.
domain name: http://beautygarden.ca
user:test
pass:test
Virtue mart version:VirtueMart 1.1.4
UPS modul ver.:vm_ups_v2.0_2009.10.25
The error:
Error: The requested URL returned error: 404
Error: Internal Error processing the Request to UPS.com
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.
--------------------------------------------
i tried all the steps and really don't know what to do.

Please help,
Danimaster