Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New UPS XML Shipping Module available


Recommended Posts

ah stupid me

Isn't there something like Ship in Cart that works as shipping estimator (I believe you have to type in your zip code somewhere)? I know some people have had problems with UPSXML but since I never looked at that contribution I don't know if everybody has the problem or only some.

Link to comment
Share on other sites

Isn't there something like Ship in Cart that works as shipping estimator (I believe you have to type in your zip code somewhere)? I know some people have had problems with UPSXML but since I never looked at that contribution I don't know if everybody has the problem or only some.

 

yes i've already tried that module .. but it didn't function properly .. i had a custom job done :)

Link to comment
Share on other sites

Well, how is UPS going to calculate shipping costs if they don't know to which zip code to send it? Logically they return an error.

 

Well i'm still getting the errors even after sticking a default zip code for the shipping estimator. http://www.advancespeedshop.com is where it's at. add an item then go to the shopping cart. Would turning on logging show me something i'm not seeing?

Link to comment
Share on other sites

Well i'm still getting the errors even after sticking a default zip code for the shipping estimator. http://www.advancespeedshop.com is where it's at. add an item then go to the shopping cart. Would turning on logging show me something i'm not seeing?

Check the errors to see what UPS is balking at. In the ship to part more of the address is sent than just the zip code (although UPS may not use/need that):

 

		"	   <ShipTo>\n".
	"		   <Address>\n".
	"			   <City>". $this->_upsDestCity ."</City>\n".
	"			   <StateProvinceCode>". $this->_upsDestStateProv ."</StateProvinceCode>\n".
	"			   <CountryCode>". $this->_upsDestCountryCode ."</CountryCode>\n".
	"			   <PostalCode>". $this->_upsDestPostalCode ."</PostalCode>\n".
	($this->quote_type == "Residential" ? "<ResidentialAddressIndicator/>\n" : "") .
	"		   </Address>\n".
	"	   </ShipTo>\n";

Link to comment
Share on other sites

I have a question about packaging that doesn't seem to be working quite right for me.

 

Here is the example:

 

I purchase 20 of the same item, dimensions are: 19x22x1.5

 

Using UPS Boxes Used I am told its packaged like this:

 

Using a box of dimensions 22x13x31, it packs 14 of the product.

Using a box of dimensions 24x8x20, it packs 6 of the product.

 

I'm having a hard time figuring out how it would pack 14 of those products into that dimension box.

 

Please help :)

Link to comment
Share on other sites

I have a question about packaging that doesn't seem to be working quite right for me.

 

Here is the example:

 

I purchase 20 of the same item, dimensions are: 19x22x1.5

 

Using UPS Boxes Used I am told its packaged like this:

 

Using a box of dimensions 22x13x31, it packs 14 of the product.

Using a box of dimensions 24x8x20, it packs 6 of the product.

 

I'm having a hard time figuring out how it would pack 14 of those products into that dimension box.

Quite simple: the algorithm aligns boxes and products in descending dimensions. So 31x22x13 will fit a product of 22x19x1.5. So far so good. Then it looks at volume: the product is 627, the box 8866 that makes 14.14 times so the algorithm decides it can fit 14 times.

 

If that is physically impossible because you can only fit 8 in with a 38% empty volume of the box is something the algorithm cannot see. That is just to complicated to calculate. It still is an approximation, but a better one than the standard osC one.

Link to comment
Share on other sites

i got these 2 errors. tried searching through for a fix, but i only found solutions for cURL: Error [60], not Error [6]. would they be the same?

 

Error from cURL: Error [6]: Couldn't resolve host 'www.ups.com' experienced by customer with id on 2007-12-02 10:48:44

Error from cURL: Error [6]: name lookup timed out experienced by customer with id on 2007-12-02 07:11:39

Link to comment
Share on other sites

i got these 2 errors. tried searching through for a fix, but i only found solutions for cURL: Error [60], not Error [6]. would they be the same?

 

Your web host is having difficulty resolving the host name. Mine does too - I replaced 'www.ups.com' with '88.221.41.243' in the assignment to $this->host.

Link to comment
Share on other sites

For users of negotiated rates, I've discovered some things that require adjustments.

 

1. The negotiated rates service has a "scheduled maintenance" from 10AM to noon Eastern Time on Sundays. Any requests for negotiated rates during this time will receive an error, and if you have the module configured to look for negotiated rates, you'll get garbage.

 

The ideal solution would be to notice the error and retrieve the list rates instead. I have tried to do this but without success so far. What I do now is test to see if I am in the window and if so, turn off negotiated rates. In function upsxml, after the assignment to $this->store_boxes, add this:

 

		// UPS has a "maintenance window" of 10AM-Noon Sunday ET for negotiated rates.  Use list rates during this time
	// Let the window go to 1PM
	$dcode = date("wG");
	if ($dcode >= "010" && $dcode < "013") {
	  $this->use_negotiated_rates = false;
	  $this->handling_fee = 0; // Don't pad list rates (you can omit this if you want)
	  }

 

You'll want to adjust the times depending on what timezone your server is in. I extended the window to 1PM because I don't trust UPS to bring the service back right on time - and indeed today I had a failure at 1:43PM (not sure if that was the cause, though.)

 

2. The negotiated rates service does not like the "new" (since 1993) 8-digit Brazilian postcodes. The list rates service has no problem with these. Go figure. Also, and this applies to all services, UPS treats the "island territories" of the US (such as Puerto Rico, Marshall Islands, etc.) as separate countries and will not accept them as US states. USPS, on the other hand, wants to see these as states and not countries! To fix both of these problems I replaced routine _upsDest with the following:

 

	function _upsDest($city, $stateprov, $country, $postal) {
	$this->_upsDestCity = $city;
	$this->_upsDestStateProv = $stateprov;
	$this->_upsDestCountryCode = $country;
	$postal = str_replace(' ', '', $postal);
	if ($country == 'US') {
		$this->_upsDestPostalCode = substr($postal, 0, 5);
		$territories = array('AS','FM','GU','MH','MP','PR','PW','VI');
		if (in_array($this->_upsDestStateProv,$territories)) {
		  $this->_upsDestCountryCode = $stateprov;
		  }
	} else if ($country == 'BR') {
		$this->_upsDestPostalCode = substr($postal, 0, 5);
	} else {
		$this->_upsDestPostalCode = $postal;
	}
}

 

As noted earlier, I also protect against garbage results and other errors I replace the two occurrences of:

 

 if (!$serviceCode) {

 

with:

 

if (!($serviceCode && is_numeric($totalCharge))  && ($totalCharge > 2.50)) {

 

I also added code to send me an email when a bad result is returned, and I get this sporadically during the week. Usually in those cases a refresh will get a good result.

Edited by stevel
Link to comment
Share on other sites

Error Code:

 

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

If you prefer to use ups as your shipping method, please contact...

 

I am attempting to change catalog/includes/modules/shipping/upsxml.php

 

Around line 340

 

From This

 

        if ((is_array($upsQuote)) && (sizeof($upsQuote) > 0)) {
           if ($this->dimensions_support > 0) {
               $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $this->boxCount . ($this->boxCount > 1 ? ' pkg(s), ' : ' pkg, ') . round($totalWeight,0) . ' ' . strtolower($this->unit_weight) . ' total)');
           } else {
               $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ($this->boxCount > 1 ? ' pkg(s) x ' : ' pkg x ') . round($shipping_weight,0) . ' ' . strtolower($this->unit_weight) . ' total)');
           }

 

To This

 

        if ((is_array($upsQuote)) && (sizeof($upsQuote) > 0)) {
           if ($this->dimensions_support > 0) {
               $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $this->boxCount . ($this->boxCount > 1 ? ' pkg(s), ' : ' pkg, ') . round($totalWeight,0) . ' ' . strtolower($this->unit_weight) . ' total)');
           } else {
               $this->quotes = array('id' => $this->code, 'module' => $this->title); 
           }

 

In efforts to change

United Parcel Service (1 pkg x 9 lbs total)

 

To

United Parcel Service

 

That is when I start getting the error above (1.0001). Am I looking in the wrong file? Is there somewhere else to change the output in the checkout_shipping.php file?

 

When I change it back I still get the same error. The only fix is to upload the original upsxml.php file from the contribution.

 

I am running RC1 and using DreamWeaver MX to code the site.

 

Any help would be greatly appreciated.

 

Thanks in advance,

 

-Jim

Link to comment
Share on other sites

  • 2 weeks later...

This may be buried in the string somewhere but I haven't found it.

 

We have a UPS discounted shipping rate. However, on the backend we get hit with extra fees on our UPS so we don't want to charge the customer the discounted rate, we want to charge them either the public rate (like you get from the UPS public website) or our discounted rate plus 12%.

 

Does anyone know how to do this?

Link to comment
Share on other sites

This may be buried in the string somewhere but I haven't found it.

 

We have a UPS discounted shipping rate. However, on the backend we get hit with extra fees on our UPS so we don't want to charge the customer the discounted rate, we want to charge them either the public rate (like you get from the UPS public website) or our discounted rate plus 12%.

 

Does anyone know how to do this?

Where is says Negotiated Rates in the admin when you edit the UPSXML settings just leave it on false and the module will use the public rates.

Link to comment
Share on other sites

If you want to charge the public rate, simply don't select the option for "negotiated rates" in admin. If you want to charge negotiated+12%, do select negotiated rates, choose "percentage" for "Handling type" and enter "12" for "Handling fee".

 

If you do opt to use Negotiated rates, see my post 1684 above.

Link to comment
Share on other sites

If you do opt to use Negotiated rates, see my post 1684 above.

I'm working on a new version, using the xml document that kymation used in Bax Global and hpdl in osC 3 alpha 4. Using list rates when negotiated rates are not available works there. Will probably take me a few more weeks to iron out a few things like update instructions.

Link to comment
Share on other sites

I'm having an issue with this module.

 

First, my home folder is shopping vs. catalog.

 

So I had an early version of UPS XML (I inherited it so I have no idea which).

 

I upgraded to the most current version and now I get this error when I open the shipping module:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/mainstr1/public_html/shopping/admin/modules.php(202) : eval()'d code on line 1

 

I also can't seem to get the module to get either the public rates OR the negotiated rates plus 12%.

 

Has anyone got a clue what I need to fix?

Link to comment
Share on other sites

I'm having an issue with this module.

 

First, my home folder is shopping vs. catalog.

 

So I had an early version of UPS XML (I inherited it so I have no idea which).

 

I upgraded to the most current version and now I get this error when I open the shipping module:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/mainstr1/public_html/shopping/admin/modules.php(202) : eval()'d code on line 1

 

I also can't seem to get the module to get either the public rates OR the negotiated rates plus 12%.

 

Has anyone got a clue what I need to fix?

For the parse error go back to the install instructions and read step 5. My bet is you didn't first "remove" the old UPSXML before you added the new one? That might give an issue with leftover configuration keys in the table configuration that were in an older version but not in a newer. Better do step 5 first. Do a "remove" in the admin when editing the shipping module UPSXML, check your table configuration if there is anything left that has UPSXML in its name and remove that manually. Then install again properly.

 

The "can't seem to get the module to get either the public rates OR the negotiated rates plus 12%." is really vague. Is it working or not? When you set the negotiated rates to true but don't get any returned from UPS you get nonsensical rates in the checkout_shipping page (actually the UPS code numbers of the shipping options).

Link to comment
Share on other sites

Can it round so the shipping price is only has 2 decimals. For some reasons it has 3 decimals. like $15.345 for shipping price.

UPS sends them with two decimals. If you get three it is your tax rate or something else doing it. It is formatted in checkout_shipping.php:

<td class="main" align="right" colspan="2"><?php echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])) . tep_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']); ?></td>

Link to comment
Share on other sites

For the parse error go back to the install instructions and read step 5. My bet is you didn't first "remove" the old UPSXML before you added the new one? That might give an issue with leftover configuration keys in the table configuration that were in an older version but not in a newer. Better do step 5 first. Do a "remove" in the admin when editing the shipping module UPSXML, check your table configuration if there is anything left that has UPSXML in its name and remove that manually. Then install again properly.

 

The "can't seem to get the module to get either the public rates OR the negotiated rates plus 12%." is really vague. Is it working or not? When you set the negotiated rates to true but don't get any returned from UPS you get nonsensical rates in the checkout_shipping page (actually the UPS code numbers of the shipping options).

Okay I think I'm almost there.

 

I've gotten rid of the parse error but couldn't get my system to pick up the right rates no matter how I configured.

 

I inherited this mess and the guy before me added a multiple vendor contribution. As it turns out, buried in the management of that is another copy of the older UPSXML. Could someone point me in the right direction. I had removed all the old configuration keys and got rid of this module but I'm at a loss for how to update it to the current version.

Link to comment
Share on other sites

I inherited this mess and the guy before me added a multiple vendor contribution.

That's a pretty complicated one that assigns products to certain shipping methods. Better download it to see where it makes the changes to reverse them if you want that.

Link to comment
Share on other sites

I have the following settings:

 

Pickup Method

Customer Counter

 

Packaging Type

UPS Express Box

 

Customer Classification Code

03

 

Shipping Origin

US Origin

 

Origin City

xxxxxxxx

 

Origin State/Province

xx

 

Origin Country

US

 

Origin Zip/Postal Code

xxxxx

 

Test or Production Mode

Production

 

Unit Weight

LBS

 

Unit Length

IN

 

Dimensions Support

No

 

Quote Type

Residential

 

Negotiated rates

False

 

Handling Type

Flat Fee

 

Handling Fee

2.00

 

Enable Insurance

False

 

UPS Currency Code

USD

 

Tax Class

Taxable Goods

 

Shipping Zone

--none--

 

Sort order of display.

0

 

Disallowed Shipping Methods

Next Day Air, Express, Next Day Air Early A.M., Expedited, 2nd Day Air A.M., Saver, Express Early A.M., Express Plus

 

Shipping Delay

2

 

Email UPS errors

Yes

 

Time in Transit Display

No

 

Time in Transit View Type

Detailed

 

And then when I go to make a test order, the only shipping options I get are:

 

UPS 2nd Day Air

UPS Next Day Air Saver

 

Why does it only give me two options, and does anyone know how to correct this? :'(

Link to comment
Share on other sites

And then when I go to make a test order, the only shipping options I get are:

 

UPS 2nd Day Air

UPS Next Day Air Saver

 

Why does it only give me two options, and does anyone know how to correct this? :'(

You will have to ask UPS that. You disabled most shipping options but you are missing UPS Ground at least. UPS not always quotes every shipping option they have by the way.

Link to comment
Share on other sites

You will have to ask UPS that. You disabled most shipping options but you are missing UPS Ground at least. UPS not always quotes every shipping option they have by the way.

 

Oh, ok, thanks Jan - so it's a UPS thing. Ok, cool, I can live with that. Thanks again :)

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