Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New UPS XML Shipping Module available


Recommended Posts

A not regarding this error:

Fatal error: Call to a member function on a non-object in /blabla/includes/classes/xmldocument.php on line 57
While debugging a piece of code I got this error a number of times. Since I enabled logging in my testing environment I found that the response from UPS was:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
</body></html>

Because a response is returned, it will be passed on to includes/classes/xmldocument.php and of course trigger an error since we are not dealing with valid xml code.

 

I have tried to catch that error by adding some code to the function _post (close to the bottom of upsxml.php):

		if(!$xmlResponse || strstr(substr($xmlResponse, 0, 50), "!DOCTYPE") )  {
		$xmlResponse = "<?xml version=\"1.0\"?>\n".
		"<RatingServiceSelectionResponse>\n".
		"   <Response>\n".
		"	   <TransactionReference>\n".
		"		   <CustomerContext>Rating and Service</CustomerContext>\n".
		"		   <XpciVersion>1.0001</XpciVersion>\n".
		"	   </TransactionReference>\n".
		"	   <ResponseStatusCode>0</ResponseStatusCode>\n".
		"	   <ResponseStatusDescription>". MODULE_SHIPPING_UPSXML_RATES_TEXT_COMM_UNKNOWN_ERROR ."</ResponseStatusDescription>\n".
		"   </Response>\n".
		"</RatingServiceSelectionResponse>\n";
	return $xmlResponse;
	}
	if ($this->use_exec == '1') {
	return $xmlResponse[0]; // $xmlResponse is an array in this case
	} else {
	return $xmlResponse;
	}
}

Of course now I can't test it because the error does not come up anymore...

<_<

Link to comment
Share on other sites

Hello,

 

I am getting the following error when using UPS XML:

 

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

 

Please see my ups xml log here:

 

------------------------------------------ DATE AND TIME: 2005-11-17 20:46:33 UPS URL: https://wwwcie.ups.com:443/ups.app/xml/TimeInTransit UPS REQUEST: BBDED30BBD866BE0 myusername mypassword Time in Transit 1.0001 TimeInTransit Chelmsford UK cm13bx Chelmsford Essex GB CM26BN CM26BN 20051118 KGS 10 USD 100 Error from cURL: Error [60]: error setting certificate verify locations: CAfile: /data0/devel/build/donhost/webservers/php/install/share/curl/curl-ca-bundle.crt CApath: none UPS RESPONSE: ------------------------------------------ Time in Transit: 0 ------------------------------------------ DATE AND TIME: 2005-11-17 20:46:33 UPS URL: https://wwwcie.ups.com:443/ups.app/xml/Rate UPS REQUEST: BBDED30BBD866BE0 myusername mypassword Rating and Service 1.0001 Rate shop 06

Chelmsford UK cm13bx

Chelmsford Essex GB CM26BN

02 KGS 4 GBP 100 01 Error from cURL: Error [60]: error setting certificate verify locations: CAfile: /data0/devel/build/donhost/webservers/php/install/share/curl/curl-ca-bundle.crt CApath: none UPS RESPONSE:

 

Can anyone advise how i can resolve this error? Seems to be an error from Error from cURL?

 

Thanking you in advance,

 

Alec

Link to comment
Share on other sites

Error from cURL: Error [60]: error setting certificate verify locations:
The notes on this error are buried in the changes.txt in the UPSXML package, but they are there:

Changes from 1.1.3 to 1.1.4
-------------------------------
Modification of catalog/includes/modules/shipping/upsxml.php in function _post to 
1. also log cURL errors if they occur 
2. add the date and time of the UPS request to the log file. 
3. The two lines:
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
are commented out again. These need only be uncommented if you get curl error 60: 
"error setting certificate verify locations" and likely only the first one.
Search the cURL website (http://curl.haxx.se) for more details on this error.

Link to comment
Share on other sites

UPS XML and dscount

 

Hello All,

 

Have sucessfully installed the UPS xml shipping module but the UPS online tools do not account for the discount that is given to us. We get 30% discount off list pricing on all ups shipments. Is is possible to change the code so that all returned values have less 30% discount?

 

This would make us more competitive in the market.

 

Thanks.

Link to comment
Share on other sites

Ooooops...sorry did some searching and can see that this quetion has been asked before. Janz....I can see you have picked out the snippet of code to adjust for dscount. If I wanted a blanket discount of 30% on all returned values how would the new code look?

Link to comment
Share on other sites

Hey everyone,

 

Sorry if this question has been asked and answered already but there are a ton of pages for this thread!

 

With that said, can the shpping info be exported to the UPS website?

 

How do you go about printing the labels...

 

Do you have to go and log into the UPS site and then enter all the information or is it already set to be printed?

 

Thanks in advance! :)

Link to comment
Share on other sites

Alec,

If I wanted a blanket discount of 30% on all returned values how would the new code look?

I'm almost 100% sure this should work (original line around 260 in upsxml.php) like you want:

$methods[] = array('id' => $type, 'title' => $_type, 'cost' => ($this->handling_fee + (0.7*$cost)));

Link to comment
Share on other sites

Brian,

With that said, can the shpping info be exported to the UPS website?

 

How do you go about printing the labels...

 

Do you have to go and log into the UPS site and then enter all the information or is it already set to be printed?

I don't remember a contribution that uploads information to the UPS website. Don't forget that UPS is a globally operating company: "the" website doesn't exist. In the US UPS has software for Windows (Worldship) for doing that, which is not available for Europe (as far as I know). Better check the contribution section though, you never know :)
Link to comment
Share on other sites

Hi, I am really desperate to get this to work. My client is supposed to open the store in a few days.

 

Just wondering, is curl_init needed on their server or is it something that can be disabled and still getting UPS to work?

 

2, Also, is it possible to get the packaging slip generated?

 

3, Are customers able to track their orders or can that be solved with another contribution?

 

Thanks!!!

Link to comment
Share on other sites

Oh, the most important thing was; can I run this contribution without Curl? (I do not even know what that is :)
No. Without cURL, no https connection => no connect with the UPS servers. Most servers with PHP have cURL installed too.

 

cURL is: a command line tool for transferring files with URL syntax, supporting FTP, FTPS, TFTP, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE and LDAP. curl supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos...), file transfer resume, proxy tunneling and a busload of other useful tricks.

 

You can't do a packing slip either. For tracking there is some contribution (UPS XML Tracking I think it is called) but never used it myself so can't tell you anything about it.

Link to comment
Share on other sites

Thanks for answering.

 

I really hope I can use both this contribution and UPS XML tracking 2.2.1.

 

How do the rest of you make packaging slips?

Click the Packingslip button in the Orders admin screen. When you click on an order, the right pane has a packingslip button, and when viewing the order, there is a packingslip button. It's created by /catalog/admin/packingslip.php if you want to edit it's appearance.

Link to comment
Share on other sites

Hi Janz,

 

Have not tried the discount yet but will let you know soon when i give ita go. Thanks for your suggestion!

 

However the data the UPS is sending back to me is incorrect. I have provided all the details as per the contribution and my shop is in the UK.

 

The ups module quite often returns UPS Express NA1 and this is only supposed to be for the states. Quite often it also does not provide me with all the options. I have contacted ups (uk) however they are very unhelpful and just suggest that it must be a buggy contribution. Has anyone else got this contribution working well in the UK? Or maybe its somthing i have done?

 

I have also moved hosts recently and get errors when trying to view my debug log, please see below:

 

The XML page cannot be displayed

Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.

 

 

--------------------------------------------------------------------------------

 

Invalid at the top level of the document. Error processing resource 'http://www.voipon.co.uk/includes/modules/shipping/upsx...

 

------------------------------------------

^

 

How can this be fixed?

 

Thanks for any help,

 

Alec

Edited by AlecUK
Link to comment
Share on other sites

Hi everyone,

 

I'm trying to set this module up for a shopping cart, and i haven't noticed the problem i'm having listed here yet. If it has, please let me know and i'll keep searching through the 29 pages of discussions!

 

The shopping cart i'm trying to add this to has a few contribs already installed (checkout without creating an account, print receipt, and shipping insurance), so perhaps that could be causing the problem.

 

What happens is when i upload the files (just for the ups xml, not the dimensional support), and even when i've made the changes to the code in steps 3-4, and changed the configuration table as in step 5, when i go to my admin--modules--shipping, i'm missing some of the options, the ups xml one is definitely not up there, and the install/delete column is missing! :blink:

 

Does anyone have any ideas about what is causing that? As soon as i remove the new files, everything is restored to normal.

 

Thanks for anyone's advice or help they can give =D

 

Justin

Link to comment
Share on other sites

Alec,

The ups module quite often returns UPS Express NA1 and this is only supposed to be for the states.
I wouldn't know. In includes/languages/english/shipping/upsxml.php it is defined as one of the European origin ones:

define('MODULE_SHIPPING_UPSXML_SERVICE_CODE_EU_ORIGIN_65', 'UPS Express NA1');

Since you are getting a quote for it, to me it proves that that is correct.

Quite often it also does not provide me with all the options.
Blame UPS, if the server doesn't give you a quote, what can the UPS XML contribution do about it?
The XML page cannot be displayed

Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.

Sounds like you try to view the log file with Internet Explorer or another browser. It is a text file however and you should try to read it with a text editor.
Link to comment
Share on other sites

Justin,

What happens is when i upload the files (just for the ups xml, not the dimensional support), and even when i've made the changes to the code in steps 3-4, and changed the configuration table as in step 5, when i go to my admin--modules--shipping, i'm missing some of the options, the ups xml one is definitely not up there, and the install/delete column is missing!
I don't get it: you miss some of the options? UPS XML is not there?

 

When you have uploaded the two upsxml.php files (in different locations), you will see United Parcel Service (XML) as a shipping module when you go to Modules -> Shipping. Click on the "i" and you will get an Install/Remove Edit column. That is how it is supposed to work.

 

If you did step 5 too late, you may still get that error but if your server is configured not to show you errors you might not see it.

Link to comment
Share on other sites

Many thanks Janz for your response, i also discovered that ie is not a good reader, however firefox works well. If I want to remove the ups na1 option from europe will commenting out the following line remove it from the UPS options or do i have to make a different modification:

 

define('MODULE_SHIPPING_UPSXML_SERVICE_CODE_EU_ORIGIN_65', 'UPS Express NA1');

 

I guess I should blame UPS but I need to understand whats going on before i appraoch them. I think i need to do some more testing.

 

Again thanks for your time and response,

Link to comment
Share on other sites

If I want to remove the ups na1 option from europe will commenting out the following line remove it from the UPS options or do i have to make a different modification:

 

define('MODULE_SHIPPING_UPSXML_SERVICE_CODE_EU_ORIGIN_65', 'UPS Express NA1');

Better turn it off in the admin section of UPSXML (bottom right):

 

Shipping Methods

Select the UPS services to be offered.

Link to comment
Share on other sites

Hi Janz, have followed your advice.

 

I am having trouble getting ups to output value for certain destinations. When i look in my debug i can see ups does respond with a value. However the ups module does not actually display the value on my website nor display any errors, it just displays the following:

 

United Parcel Service (1 pkg x 0.5 kgs total)

 

This is the response i get from my debug from ups:

 

UPS RESPONSE: <?xml version="1.0"?><RatingServiceSelectionResponse><Response><TransactionReference><CustomerContext>Rating and Service</CustomerContext><XpciVersion>1.0001</XpciVersion></TransactionReference><ResponseStatusCode>1</ResponseStatusCode><ResponseStatusDescription>Success</ResponseStatusDescription></Response><RatedShipment><Service><Code>65</Code></Service><BillingWeight><UnitOfMeasurement><Code>KGS</Code></UnitOfMeasurement><Weight>1.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>GBP</CurrencyCode><MonetaryValue>50.79</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>GBP</CurrencyCode><MonetaryValue>1.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>GBP</CurrencyCode><MonetaryValue>51.79</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery></GuaranteedDaysToDelivery><ScheduledDeliveryTime></ScheduledDeliveryTime><RatedPackage><TransportationCharges><CurrencyCode> </CurrencyCode><MonetaryValue> </MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode> </CurrencyCode><MonetaryValue> </MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode> </CurrencyCode><MonetaryValue> </MonetaryValue></TotalCharges><Weight>1.0</Weight><BillingWeight><UnitOfMeasurement><Code> </Code></UnitOfMeasurement><Weight> </Weight></BillingWeight></RatedPackage></RatedShipment></RatingServiceSelectionResponse>

 

This is example is for a shipment going out to malta.

 

Also in the upsxml configuration it asks for the following:

 

Origin State/Province

 

Is this for the states only because i have left mine blank.

 

Janz, just tested your dicount code edit and it works well....has reduced my ups charges by 30%...excellent!

Link to comment
Share on other sites

I am having trouble getting ups to output value for certain destinations. When i look in my debug i can see ups does respond with a value. However the ups module does not actually display the value on my website nor display any errors, it just displays the following:

 

United Parcel Service (1 pkg x 0.5 kgs total)

 

This is the response i get from my debug from ups:

 

UPS RESPONSE: <?xml version="1.0"?>
...
<RatedShipment>
<Service>
<Code>65</Code>
</Service>
<BillingWeight>
<UnitOfMeasurement>
<Code>KGS</Code>
</UnitOfMeasurement>
<Weight>1.0</Weight>
</BillingWeight>
<TransportationCharges>
<CurrencyCode>GBP</CurrencyCode>
<MonetaryValue>50.79</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
...

</RatedShipment>
</RatingServiceSelectionResponse>

As you can see the only service they have quoted you for is the service with code 65:

define('MODULE_SHIPPING_UPSXML_SERVICE_CODE_EU_ORIGIN_65', 'UPS Express NA1');

And that is exactly the one that is kicked out because you don't want to offer this to your customer. I have no clue what it stands for, UPS Express NA1, by the way.

 

Also in the upsxml configuration it asks for the following:

 

Origin State/Province

Apparently you don't get errors from UPS, so I guess they don't care about having this filled in for the UK. They also don't care about the pickup (see earlier in the thread, somebody even had to comment it out to get quotes).
Link to comment
Share on other sites

So is the general consensus UPS online xml tools are inaccurate and buggy? Or can this application be improved, or is it a combination of both? I have noticed that in different circumstances 4 different shipping methods are retrieved but only 2 are displayed an also that the monetery values are different than what i get from the ups website. Does anyone else notice this?

 

alec

Link to comment
Share on other sites

Justin,

I don't get it: you miss some of the options? UPS XML is not there?

 

When you have uploaded the two upsxml.php files (in different locations), you will see United Parcel Service (XML) as a shipping module when you go to Modules -> Shipping. Click on the "i" and you will get an Install/Remove Edit column. That is how it is supposed to work.

 

If you did step 5 too late, you may still get that error but if your server is configured not to show you errors you might not see it.

 

JanZ,

Before i upload the 4 files in STEP 2, my Modules->Shipping is a 4-column table: Modules, Sort Order, Action, and the column with the [iNSTALL] button and details. The modules that are listed are Flat Rate, Per Item, Table Rate, United Parcel Service, United States Postal Service, and Zone Rates. I have UPS and USPS installed.

 

After i upload the 4 files, my Modules->Shipping is a 3-column table: Modules, Sort Order, and Action (the column with the INSTALL button and details is gone). The only modules that are listed are Flat Rate, Per Item, Table Rate, and United Parcel Service (the same one as before). The USPS and Zone Rates modules are gone.

 

It's crazy, i really don't know what's going on! Do you have any suggestions or ideas? Thank you so much!

Justin

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.

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...