Jump to content
torinwalker

New UPS XML Shipping Module available

Recommended Posts

When I uncomment that line, it gets rid of the ssl error on my local machine, but then the behavior becomes identical to the store I have on the hosting site. No ups data appears when I go to checkout_shipping.php

 

I'm pretty sure CURL is working locally, because I got curl errors when I didn't have curl turned on locally. I believe curl is setup on the hosting site as well.

 

I think I have a clue as to why the ups xml is not appearing. I added some logging to the classes/shipping.php file:

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

reset($this->modules);

while (list(, $value) = each($this->modules)) {

$class = substr($value, 0, strrpos($value, '.'));

 

error_log( $class . " " . $value . "\n", 3, 'upsxml.log' );

 

if (tep_not_null($module)) {

if ( ($module == $class) && ($GLOBALS[$class]->enabled) ) {

$include_quotes[] = $class;

}

} elseif ($GLOBALS[$class]->enabled) {

error_log( "enabled: " . $class . "\n", 3, 'upsxml.log' );

$include_quotes[] = $class;

}

else {

error_log( "not enabled: " . $class . "\n", 3, 'upsxml.log' );

}

}

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

 

when I goto the checkout, I'm seeing this in the upsxml.log:

upsxml upsxml.php

not enabled: upsxml

 

so... I am guessing that there is something I missed setting this up? but if so, why would errors appear if I don't include the access key?

 

I apologize if any of these questions are obvious, its just that I haven't done PHP for quite some time and the structure of oscommerce is a little confusing to me.

 

Roy

 

did you install it with or without the dimensional/packaging support?

 

and uncommenting that line about CURLOPT_SSL_VERIFYPEER should fix the ssl error you were getting on your local machine, thats why I suggested it.\

 

is CURL working on the servers that you are trying this on... nothing will work if its not enabled.

Share this post


Link to post
Share on other sites
when I goto the checkout, I'm seeing this in the upsxml.log:

upsxml upsxml.php

not enabled: upsxml

Did you choose "True" in the very first admin option: Enable UPS Shipping

Do you want to offer UPS shipping?

Share this post


Link to post
Share on other sites

Fatal error: Cannot redeclare class xmldocument in /home/gearbox/public_html/admin/includes/classes/xmldocument.php on line 19

 

I have already set dimension support to 0 and ensured that xmldocument.php is in the right two folders.

These are the only two fixes I have found?

 

Dan

Share this post


Link to post
Share on other sites

Yes.

 

I was hoping someone could give me advice on how to debug this. What would be the steps that you would take to find out where things are going wrong. So right now, I know that despite having the "Enable UPS Shipping" set to true, oscommerce still does not think this module is "enabled". So where would you look to see where this is set? Is it in the configuration table? Anyway, I'll keep looking.

 

Roy

 

Did you choose "True" in the very first admin option: Enable UPS Shipping

Do you want to offer UPS shipping?

Share this post


Link to post
Share on other sites

Dan,

Fatal error: Cannot redeclare class xmldocument in /home/gearbox/public_html/admin/includes/classes/xmldocument.php on line 19
You are sure there are no two upsxml.php documents (one could be renamed to something else) in modules/shipping ? The way osC works is that it reads the list of files in that directory that end in .php, then loads the respective language files of the same name (big error if that file isn't there) and only then looks which shipping modules are enabled.

 

Leaving a backup copy in that directory gives all kinds of trouble you don't expect.

Share this post


Link to post
Share on other sites

OK, I got it now... it has to do with the ZONE check.

 

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

if (($this->enabled == true) && ((int)MODULE_SHIPPING_UPSXML_RATES_ZONE > 0)) {

$check_flag = false;

$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_UPSXML_RATES_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");

while ($check = tep_db_fetch_array($check_query)) {

if ($check['zone_id'] < 1) {

$check_flag = true;

break;

} elseif ($check['zone_id'] == $order->delivery['zone_id']) {

$check_flag = true;

break;

}

}

if ($check_flag == false) {

$this->enabled = false;

}

}

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

 

Is there something I haven't setup correctly? Where would the zones_to_geo_zones table get filled?

 

Roy

 

 

Yes.

 

I was hoping someone could give me advice on how to debug this. What would be the steps that you would take to find out where things are going wrong. So right now, I know that despite having the "Enable UPS Shipping" set to true, oscommerce still does not think this module is "enabled". So where would you look to see where this is set? Is it in the configuration table? Anyway, I'll keep looking.

 

Roy

Share this post


Link to post
Share on other sites
OK, I got it now... it has to do with the ZONE check.
Are you sure? That piece of code seems to refer to the setting of the Shipping Zone in the admin section of UPSXML:
Shipping Zone
If a zone is selected, only enable this shipping method for that zone.<br><select name="configuration[MODULE_SHIPPING_UPSXML_RATES_ZONE]"><option value="0" SELECTED>--none--</option>

You don't happen to have SPPC installed and not added UPSXML to the shipping methods for the customer groups?

Share this post


Link to post
Share on other sites

I think I need to understand taxes and zones some more.

 

The store is going to be New York based, so I assumed I needed a tax for any resident of new york. So I added a tax zone of New York and then added United States/New York to that via the admin interface. So now only customers with an address of New York get the UPS display, but I want everyone to get the UPS options and only add tax to New York state.

 

Perhaps I need to do RTFM some more?

 

Roy

 

Are you sure? That piece of code seems to refer to the setting of the Shipping Zone in the admin section of UPSXML:
Shipping Zone
If a zone is selected, only enable this shipping method for that zone.<br><select name="configuration[MODULE_SHIPPING_UPSXML_RATES_ZONE]"><option value="0" SELECTED>--none--</option>

You don't happen to have SPPC installed and not added UPSXML to the shipping methods for the customer groups?

Share this post


Link to post
Share on other sites
The store is going to be New York based, so I assumed I needed a tax for any resident of new york. So I added a tax zone of New York and then added United States/New York to that via the admin interface. So now only customers with an address of New York get the UPS display, but I want everyone to get the UPS options and only add tax to New York state.
IMHO that is quite independent of the UPS XML module. Just make sure you haven't set anything in the "Shipping Zone" of the UPS XML admin module and it should show to all customers.

 

By the way, I just uploaded the new version 1.2 :D

Share this post


Link to post
Share on other sites

Thanks JanZ for helping this newb. Great module!

 

IMHO that is quite independent of the UPS XML module. Just make sure you haven't set anything in the "Shipping Zone" of the UPS XML admin module and it should show to all customers.

 

By the way, I just uploaded the new version 1.2 :D

Share this post


Link to post
Share on other sites

JanZ,

 

I uploaded a new version of upsxml.php to the contrib, adding a couple features and fixing one bug I found.

 

- added the ability to choose the time in transit display being either the raw style or the more readable version from the admin tool instead of having to edit the code.

- created a workaround for when the total weight of all boxes is greater than the maximum weight for time in transit in either lbs (150) or kgs (70). It will limit the weight to the maximum just for time in transit (will not affect shipping wieght).

- Added the ability to define handling fee as either a Flat Fee or a Percentage through the admin screen.

Edited by mucter

Share this post


Link to post
Share on other sites

Jay,

I uploaded a new version of upsxml.php to the contrib, adding a couple features and fixing one bug I found.
Excellent. Good work, much obliged.

Share this post


Link to post
Share on other sites

so, I was adding the estimated shipping contrib, and it work fine, only thing is, it won't return the EDD from time in transit. Now the estimated shipping just goes off the country code and the zip code to return the shipping quotes. I looked at the time in transit documentation and it claims that time in transit should work with just the destination country and zip, but I looked at the XML returned and it is just straight up missing the time in transit estimations... am I missing something?

 

The only things not being sent to the server in the xml are PoliticalDivision2 and PoliticalDivision1, but again the documentation from UPS says that those aren't required. Is it incorrect? If I remove them from the xml document generated in upsxml.php, time in transit doesn't work on the normal shipping page either...

 

ugh >_<

Share this post


Link to post
Share on other sites
Now the estimated shipping just goes off the country code and the zip code to return the shipping quotes.
Yes, but the UPS module uses country[iso_code_2] (e.g. US) whereas estimated shipping probably uses country[id] (223 for the US). That might be the problem.

 

By the way, thanks to user feedback (thanks Donna) I found out about an error in a query in upsxml that caused the volume of the packaging boxes to be wrong. I uploaded the corrected file, together with the other ones to make a complete package this evening.

Share this post


Link to post
Share on other sites

I just added the newest version, I have not had this error before and it only appears when I click to edit the UPS module

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/mediafee/public_html/now/admin/modules.php(220) : eval()'d code on line 1

 

I also have the USPS methods, Fedex XML and the UPS packages installed. The error only shows up with this newest version of UPSXML.

Any ideas, what to do? I know I could edit the modules.php file but I dont think that would be correct since no other shipping modules are affected.


Follow the community build:

BS3 to osCommerce Responsive from the Get Go!

Check out the new construction:

Admin Gone to Total BS!

Share this post


Link to post
Share on other sites

I have the latest version of the UPS XML module installed, and I have logging turned on. When I try to go to the checkout page with the module enabled, all I get is a white screen. The log file then contains the XML and everything looks ok there, and nothing is entered into the error log.

 

I have the store pickup and usps modules enabled.

 

Any ideas? I really need this, but I don't know how to get it working.

 

My site is live, but I currently have the UPS module disabled.

 

 

EDIT:

 

I had it working with a bit older version, but then my webhosts server crashed, and I moved to a new hosting service. Now it doesn't work anymore. But, I reinstalled it entirely.

 

Thanks.

Edited by khenn

Share this post


Link to post
Share on other sites
I just added the newest version, I have not had this error before and it only appears when I click to edit the UPS module

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/mediafee/public_html/now/admin/modules.php(220) : eval()'d code on line 1

You get that error when you don't do step 5 of the readme.txt (change the type for field "set_function" from VARCHAR(255) to TEXT). Once you have done that you have to do a "remove" and then "install" in the admin.

Share this post


Link to post
Share on other sites
I have the latest version of the UPS XML module installed, and I have logging turned on.
Do you mean by install that you uploaded the new files and put back a backup copy of your site? Since there have been added quite a few keys that have to be in the database, you have to do a "remove" and "install" in the admin to get the new version working. Perhaps that is the problem.

 

It looks like you are getting PHP errors. Hard to debug when you don't get any feedback. Perhaps there is a PHP error log for your site with the webhost?

Share this post


Link to post
Share on other sites
You get that error when you don't do step 5 of the readme.txt (change the type for field "set_function" from VARCHAR(255) to TEXT). Once you have done that you have to do a "remove" and then "install" in the admin.

 

 

Excellent! I changed it in the php file the first time but failed to do it this time around, now I just changed it in the SQL so I wont have to worry about it again.

Thanks for the help and all you have done with this contribution.


Follow the community build:

BS3 to osCommerce Responsive from the Get Go!

Check out the new construction:

Admin Gone to Total BS!

Share this post


Link to post
Share on other sites

JanZ,

 

I was wondering if you had any suggestions for an easy way to have a particular product be packaged in 2 boxes. For example, my client has a couple products that weigh 224lbs, in order to ship one of those products they ship them in 2 boxes each weighing 112lbs. There currently is no way in OSC to tell it that there are multiple packages for 1 product.

 

I looked into the master/slave packages contrib, but I didn't like how drastically I had to change the code to make that work when it is waayyy overkill for what I need, and really it is too complicated for my client to deal with.

 

Thanks for any input.

Share this post


Link to post
Share on other sites
I was wondering if you had any suggestions for an easy way to have a particular product be packaged in 2 boxes.
I would try to hard code that in the function packProducts($productsArray). See below for what I think is a good spot to split the particular product.

		// Get the product array and expand multiple qty items.
	$productsRemaining = array();
	for ($i = 0; $i < count($productsArray); $i++) {
		$product = $productsArray[$i];
.
.
.
// here the productsRemaining is filled with quantity * products
// good spot to insert the split for a certain product, or right behind this for loop depending
// on $productsArray[$i]['products_id'] or model or whatever suits you.
		for ($j = 0; $j < $productsArray[$i]['quantity']; $j++) {
			$productsRemaining[] = $product;
		}
	}

Share this post


Link to post
Share on other sites
Do you mean by install that you uploaded the new files and put back a backup copy of your site? Since there have been added quite a few keys that have to be in the database, you have to do a "remove" and "install" in the admin to get the new version working. Perhaps that is the problem.

 

It looks like you are getting PHP errors. Hard to debug when you don't get any feedback. Perhaps there is a PHP error log for your site with the webhost?

 

JanZ,

 

Well, thanks for the reply. I had done this before, but tonight I again unintsalled and reinstalled the module through the admin side of osc, and now it works! Don't ask me why, but I'm not complaining.

 

I do have a suggestion though, it would be nice that if the admin enables insurance on the UPS shipping, that it would somehow be displayed to the user so that they know that insurance is already calculated in the shipping amount.

 

Thanks for the contribution.

Share this post


Link to post
Share on other sites
I would try to hard code that in the function packProducts($productsArray). See below for what I think is a good spot to split the particular product.

		// Get the product array and expand multiple qty items.
	$productsRemaining = array();
	for ($i = 0; $i < count($productsArray); $i++) {
		$product = $productsArray[$i];
.
.
.
// here the productsRemaining is filled with quantity * products
// good spot to insert the split for a certain product, or right behind this for loop depending
// on $productsArray[$i]['products_id'] or model or whatever suits you.
		for ($j = 0; $j < $productsArray[$i]['quantity']; $j++) {
			$productsRemaining[] = $product;
		}
	}

 

Funny, thats exactly where I ended up putting something, great minds think alike... lol :thumbsup:

Share this post


Link to post
Share on other sites

I just installed UPSXML_v1_2_2 for the first time on a new site.

When i out it gives a blank page for catalog/checkout_shipping.php.

If i remove UPSXML it works fine.

I changed the What did i do wrong?

Thanks for your help

Share this post


Link to post
Share on other sites

When I click the Edit button on the UPS XML module in my admin console I get the following error:

Fatal error: Call to undefined function: tep_cfg_select_multioption() in /home/bearpaws/public_html/catalog/admin/modules.php(216) : eval()'d code on line 1

 

Is this an issue with my UPS XML install?

Jake

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×