Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New UPS XML Shipping Module available


Recommended Posts

Starkness;

I never noticed the bit about protecting the XML config (guess I'll have to re-read the original install instructions and get back to you!). As for my own installation, I have just commented out the call to the .htaccess file, without any apparent problems being caused. I don't know to this day why it was there in the original contribution.

 

Thanks for your response mugitty!

 

About the .htaccess addition... I was working on several different things yesterday, so it may be that I was dreaming when I saw that. LOL Anyway, I could have swore it was somewhere having to do with this mod.

 

Thanks again!

 

starkness

Thanks!

 

Starkness

Link to comment
Share on other sites

I have installed this great contribution.  But I cannot get it to work.  Everytime I try to check out, I get the following error on the Shipping page of my website:

 

Rating and Service 1.0001 0 An unknown error occured while attempting to contact the UPS gateway : Rating and Service 1.0001 0 An unknown error occured while attempting to contact the UPS gateway

I emailed UPS about it, but I have yet to get a response back.

 

Anybody here have any ideas?

 

Thanks,

Craig

 

check this post, follow the directions that will provide with you exact error you can work on.

POST

Link to comment
Share on other sites

would like a little help to make sure I dont mess this up :)

 

Step 5- Option2(since I have never worked in Db's, I figured now is probably not a good time to start......my luck it would end up destroyed, so we'll go with option2)

 

2) In catalog/includes/modules/shipping/upsxml.php (about line 291) Find the key MODULE_SHIPPING_UPSXML_TYPES and remove at least 2 of the shipping methods listed there to reduce the field to less than 255 characters

 

 

 

Here is, hopefully, the rigth section that needs modified:

 

('Shipping Methods', 'MODULE_SHIPPING_UPSXML_TYPES', 'Next Day Air, 2nd Day Air, Ground, Worldwide Express, Standard, 3 Day Select', 'Select the UPS services to be offered.', '6', '20', 'tep_cfg_select_multioption(array(\'Next Day Air\', \'2nd Day Air\', \'Ground\', \'Worldwide Express\', \'Worldwide Expedited\', \'Standard\', \'3 Day Select\', \'Next Day Air Saver\', \'Next Day Air Early A.M.\', \'Worldwide Express Plus\', \'2nd Day Air A.M.\', \'Express NA1\', \'Express Saver\'), ', now())");

 

What exactly needs deleted? U realize the actual shipping choice I delete is up to me, but more specifically.........what section of that do i do it from? the "'Next Day Air, 2nd Day Air, Ground, Worldwide Express, Standard, 3 Day Select'" part, the part after"'tep_cfg_select_multioption(array(\" ? Both? Thanks for the help, I want to make sure I get this right.

Link to comment
Share on other sites

check this post, follow the directions that will provide with you exact error you can work on.

POST

 

 

Thanks, but I have done all of that...and this is what shows up in shopping cart:

 

Rating and Service 1.0001 0 An unknown error occured while attempting to contact the UPS gateway : Rating and Service 1.0001 0 An unknown error occured while attempting to contact the UPS gateway

 

In the log, this is the UPS response:

 

Time in Transit: This module supports only xpci version 1.0001 of the UPS Rates Interface. Please contact the webmaster for additional assistance.

 

Craig

Link to comment
Share on other sites

would like a little help to make sure I dont mess this up :)

 

Step 5- Option2(since I have never worked in Db's, I figured now is probably not a good time to start......my luck it would end up destroyed, so we'll go with option2)

 

2) In catalog/includes/modules/shipping/upsxml.php (about line 291) Find the key MODULE_SHIPPING_UPSXML_TYPES and remove at least 2 of the shipping methods listed there to reduce the field to less than 255 characters

Here is, hopefully, the rigth section that needs modified:

 

('Shipping Methods', 'MODULE_SHIPPING_UPSXML_TYPES', 'Next Day Air, 2nd Day Air, Ground, Worldwide Express, Standard, 3 Day Select', 'Select the UPS services to be offered.', '6', '20', 'tep_cfg_select_multioption(array(\'Next Day Air\', \'2nd Day Air\', \'Ground\', \'Worldwide Express\', \'Worldwide Expedited\', \'Standard\', \'3 Day Select\', \'Next Day Air Saver\', \'Next Day Air Early A.M.\', \'Worldwide Express Plus\', \'2nd Day Air A.M.\', \'Express NA1\', \'Express Saver\'), ',  now())");

 

What exactly needs deleted? U realize the actual shipping choice I delete is up to me, but more specifically.........what section of that do i do it from? the "'Next Day Air, 2nd Day Air, Ground, Worldwide Express, Standard, 3 Day Select'" part, the part after"'tep_cfg_select_multioption(array(\" ? Both?  Thanks for the help, I want to make sure I get this right.

That's the correct section. I would suggest removing the last 2 options, so it looks like this:

('Shipping Methods', 'MODULE_SHIPPING_UPSXML_TYPES', 'Next Day Air, 2nd Day Air, Ground, Worldwide Express, Standard, 3 Day Select', 'Select the UPS services to be offered.', '6', '20', 'tep_cfg_select_multioption(array(\'Next Day Air\', \'2nd Day Air\', \'Ground\', \'Worldwide Express\', \'Worldwide Expedited\', \'Standard\', \'3 Day Select\', \'Next Day Air Saver\', \'Next Day Air Early A.M.\', \'Worldwide Express Plus\', \'2nd Day Air A.M.\'), ',  now())");

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

Thanks Stuart for checking this out for me. Your help is greatly appreciated. I'll await your findings. :thumbsup:

 

Katrina

Edited by kcornell
Link to comment
Share on other sites

having an issue.........

 

the module.php change is causing problems. When I go to the admin section, everything is fine.......but going to the modules section under admin causes the page to lose all the background colors for the columns, etc. I have retried step 3 a couple times, still doesnt work. I have actually copied the hole section of code from the "how it should look" part of the readme, still doesnt work. If I replace the altered file with the original, all looks fine......and the UPD XML modules is there ready to install.

 

Any idea what is going on? What does the change to the module.php even do? Thanks

Link to comment
Share on other sites

The catalog/admin/modules.php modification in step 3 is there for the ability to select which shipping options you will show to your customers. It gives the ability to select and save multiple checkboxes in the admin area, in conjunction with the addition of the tep_cfg_select_multioption function that is added to catalog/admin/includes/functions/general.php in step 4.

 

If you just want to offer EVERY shipping option (ie: Next Day Air, Next Day Air Early AM, Next Day Air Saver, etc.) that UPS offers for a given origin/destination, it is not needed.

 

You can compare it to the change for the same module that exists in the install instructions for the USPS Methods contribution - it should be the same. If you find an error in the UPSXML installation instruction for this segment, let me know. As far as I know, it's correct.

 

Just for reference, this is the ONLY change I currently have in my catalog/admin/modules.php that differs from the stock osC MS2 file.

 

Original (from line 43):

  if (tep_not_null($action)) {
   switch ($action) {
     case 'save':
       while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) {
         tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . $value . "' where configuration_key = '" . $key . "'");
       }
       tep_redirect(tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $HTTP_GET_VARS['module']));
       break;
     case 'install':

Modified:

  if (tep_not_null($action)) {
   switch ($action) {
     case 'save':
       while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) {

//BOF added for USPS Methods - UPSXML 
if( is_array( $value ) ){
         $value = implode( ", ", $value);
   $value = ereg_replace (", --none--", "", $value);
     }
//EOF

         tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . $value . "' where configuration_key = '" . $key . "'");
       }
       tep_redirect(tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $HTTP_GET_VARS['module']));
       break;
     case 'install':

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

I copied the code you posted above, and it didnt help.

 

Basically, now when I go to the moduels section, the background is totally white and the font is larger. All of the grey boxes/columns are gone. When you pass your cursor over the module choices, it says "script error!" in the lower corner of my browser.

Link to comment
Share on other sites

figured it out. For some reason the lines:

 

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

<script language="javascript" src="includes/general.js"></script>

 

 

was getting changed to :

 

<link rel="stylesheet" type="text/css" href="Original%20Files/Original%20Files/includes/stylesheet.css">

<script language="javascript" src="Original%20Files/Original%20Files/includes/general.js"></script>

 

 

 

....when I resaved the file after making the changes. Dont know why, but its fixed now :)

Link to comment
Share on other sites

on to the next problem............

 

Warning: error_log(/home/farmex/public_html/shop/includes/modules/shipping/upsxml.log): failed to open stream: No such file or directory in /home/XXXXXX/public_html/catalog/includes/modules/shipping/upsxml.php on line 604

 

" line 603

" line 615

" line 619

" line 801

" line 802

" line 215

" line 216

 

Im getting some of those multiple times. Any help? Also, no idea where the "farmex" part is coming from.

Link to comment
Share on other sites

Somewhere around line 72 the file includes/modules/shipping/upsxml.php has:

 

// $this->logfile = '/home/gordond/public_html/catalog/includes/modules/shipping/upsxml.log';

 

To troubleshoot the module it comes in handy to write the error messages of UPS and CURL to an error log. For this, the line is uncommented and the full (correct) path to the error log should be put in.

 

It looks like in your case this line is uncommented and reads:

$this->logfile = '/home/farmex/public_html/shop/includes/modules/shipping/upsxml.log';

 

instead of

 

$this->logfile = '/home/XXXXXX/public_html/catalog/includes/modules/shipping/upsxml.php';

 

otherwise I wouldn't know the answer.

Link to comment
Share on other sites

Sorry...

 

That line was supposed to be commented before I uploaded the new version (I'll correct it in the next complete upload-whenever that is)

 

This is how that line should read - then, if you needed to record a logfile for bug checking, you would uncomment it and change the path to whatever path you desired your logfile to be, create an empty text file named upsxml.log and upload it to that location with 777 permissions.

//  $this->logfile = '/home/your_site/public_html/catalog/includes/modules/shipping/upsxml.log';

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

that helps things along :thumbsup:

 

It should write that log file everytime if I dont comment it out, right? I simply changed the path and it wrote a log file.......and the error was gone. I shouldnt worry that it actually wrote a log file right......is it an "error log"?

 

 

Now everything LOOKS like its working fine. Only one problem, the values I get at checkout are even further off from what they were with the previous module. About $20 off, to the customers favor of course. And, for some reason, running the SAME numbers through the UPS website as I did yesterday doesnt return all the same shipping options(I cant get it to give me a qoute for ground shipping). Any ideas? Hopefully im close to getting this thing working 100% B)

Link to comment
Share on other sites

ok, ive been running different weights and whatnot for awhile now, and nothing is mathicng up. I have went over all the settings multiple times....everything looks the same between my module settings and what im putting into the UPS website.

 

 

randomly getting this error too.........

 

Fatal error: Call to a member function on a non-object in /home/XXXXX/public_html/catalog/includes/classes/xmldocument.php on line 57

 

 

happened when I hit refresh at one point to update the page, and once when I deleted some stuff from my cart and went back to checkout.

Link to comment
Share on other sites

is it an "error log
No, it's a log of the request and response from UPS... If there is an error, it will show in the log, but a perfectly good request and response will also show.
what is "standard" shipping
UPS Standard to Canada (basically, UPS Ground to Canada)
Fatal error: Call to a member function on a non-object in /home/XXXXX/public_html/catalog/includes/classes/xmldocument.php on line 57
Well, that's from the section of xmldocument.php that deals with "function getValueByPath($path)" but I'm afraid I can't tell you what's causing the error (maybe a specific configuration for xml in your server?)
nothing is mathicng up

If you want to post the settings that you are using for the module (except your access key, user name and password), I'll put your origin zip into my test store and try running a few comparisons

(you DID set tare weight and % increase both to "0" for testing purposes, didn't you?)

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

Fatal error: Call to a member function on a non-object in /home/XXXXX/public_html/catalog/includes/classes/xmldocument.php on line 57

happened when I hit refresh at one point to update the page, and once when I deleted some stuff from my cart and went back to checkout.

I had never had this error occur before I saw your post and one other in the last couple of days. Now it's popping up on my checkout_shipping page as well. It seems to be random, and 1 or 2 refreshes of the page invariably will finally render the page as it should be.

 

I suspect that the error has to be coming from the call to either "root" or "getName", but they are both declared in the xmldocument file, so I don't know if its a matter of something not being presented in the correct order or some other reason.

 

The upsxml.php "requires" the xml document - I don't know if "require once" might be appropriate here??? Or has something changed recently either with PEAR, CURL or the UPS servers themselves?

 

I'm grasping at straws here - hopefully someone with a better knowledge of coding will come forward with a solution.

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

I've just started getting this error of an illegal object as well today. Of course it was just after I finished testing the purchase without account mod, but as far as I can tell they aren't connected. I even get it with that turned off.

 

It seems to happen when the response on the TimeInTransit doesn't come back right from UPS. When I get the error, the response is really short. When I don't, the TimeInTransit response is really long.

 

It's happening at this call in the uspsxml.php module

 

  // Get version. Must be xpci version 1.0001 or this might not work.
//  print "call 5"; (I added this to track where I was)
 $responseVersion = $doc->getValueByPath('TimeInTransitResponse/Response/TransactionReference/XpciVersion');

 

But I can't see how $doc can't be defined as an object, that code is just above it somewhere.

And, refreshing the page once or twice will show the correct checkout_shipping.php page.

 

This happens occasionally right when the "checkout" button is hit and the first display of checkout_shipping.

Link to comment
Share on other sites

I've debugged it further, and my error is definately caused by a bad return from _upsGetTime() - when there isn't a true value returned, then the object error occurs. And it doesn't seem to be $doc - that does say it is an object.

 

If I comment out the _upsGetTime() function call, and just set the variable to 0, the error goes away. Not necessarily what you want to do, but I did it just for debug. I haven't enabled the log yet to see if there's something to catch and bypass the error.

Link to comment
Share on other sites

Might it have something to do with this?

	function _post($protocol, $host, $port, $path, $version, $timeout, $xmlRequest) {
  $url = $protocol."://".$host.":".$port.$path;
  if ($this->logfile) {
   error_log("------------------------------------------\n", 3, $this->logfile);
   error_log("UPS URL: " . $url . "\n", 3, $this->logfile);
  }
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlRequest);
  curl_setopt($ch, CURLOPT_TIMEOUT, (int)$timeout);

As you see, the variable "$version" is included here (which deals with the Rates and Services), but "$transitversion" (which deals with Time In Transit) is not identified in "function _post", even though it is called at line 752

$xmlTransitResult = $this->_post($this->protocol, $this->host, $this->port, $this->transitpath, $this->transitversion, $this->timeout, $xmlTransitRequest);

and the same applies to "$this->transitpath" and "$xmlTransitRequest"

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

Hi Stuart,

 

I was wondering if you had gotten a chance to test out my ready to ship problem on your cart?

 

I know you have been trying to help Bob & Robin figure out a problem that they are having, so I thoroughly understand if you haven't had the chance. I would offer my help, but I don't seem to be having their problem and haven't been able to duplicate it.

 

Thanks again for any help you can give.

 

 

Katrina

Link to comment
Share on other sites

Katrina:

No, sorry, I haven't had a chance to look at it yet. My honeydoos took up a bit more time than anticipated this weekend. I'll continue to try to find some time to look at it through the week.

 

Robin:

Of course today, on a different server, I can't get it to fail
Same here... This morning I couldn't get it to fail more than once in about 20 tries, while over the weekend, it was failing about 1 out of 3 times.

 

I was initially looking at xmldocument.php as being the problem, but now I'm convinced that it is in the Time In Transit portion of upsxml.php

 

If you look at "function _post" (line 600), you'll see that it specifies certain variables and then the $url on the next line uses some of those variables

	function _post($protocol, $host, $port, $path, $version, $timeout, $xmlRequest) {
  $url = $protocol."://".$host.":".$port.$path;

and in "function _upsGetQuote()" (the rates and services API), "$xmlResult" (line 596) says

  $xmlResult = $this->_post($this->protocol, $this->host, $this->port, $this->path, $this->version, $this->timeout, $xmlRequest);
 return $this->_parseResult($xmlResult);

using the variables that were declared in "function _post".

 

When you look at "function _upsGetTime()" (line 698), you will see there is also a result line ("$xmlTransitResult" - line 752)

  $xmlTransitResult = $this->_post($this->protocol, $this->host, $this->port, $this->transitpath, $this->transitversion, $this->timeout, $xmlTransitRequest);
 return $this->_transitparseResult($xmlTransitResult);

but the variables in this result do not all match the variables that were declared in "function _post" even though the statement above is using the same "function _post" as did "function _upsGetQuote()".

 

What I am not sure about, and what I need someone's help with, is how to properly add the variables that deal with the Time In Transit API that are missing in the original "function _post".

 

Just looking at it, I would think that these missing variables would cause an error, particularly in light of the comment that someone made where if they commented out the Time In Transit portion of the code, the errors went away. What I still can't understand is why the error would be intermittent rather than constant.

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...