Jump to content
fulluvscents

USPS Rate V4, Intl Rate V2 (official support thread)

Recommended Posts

Never replace a file unless you're certain that both are based on the same osCommerce version. Mixing files from 2.3.1 and any 2.2 version is asking for trouble. Use a comparison program to compare your file with the new one, and only copy over changes that are marked with references to the Addon you're installing.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Hi Jetta,

 

I have installed the module which was specifically developed by you for version 2.2 (http://addons.oscommerce.com/info/8403) and I followed all instructions in readme file.. Though it works perfectly in admin but i am having a hard time showing it on client end (checkout_shipping.php). All my installed modules (UPS) show up but not USPS :(.. Could anyone guide me in that matter? Thanks in advance :).

Share this post


Link to post
Share on other sites

Thanks Jim. It was working fine for a while, but then started giving this error on last step of checkout when the checkout button is used.

 

Fatal error: Class 'httpClient' not found in /home/combatk2/public_html/store/includes/modules/shipping/usps.php on line 287

 

When using the paypal checkout button it goes to paypal site, but does not carry the shipping through.

 

This was working when I made my last post.

Share this post


Link to post
Share on other sites

Ok, I am confused. I switched to paypal website standard and everything works fine, and the shipping carries over just like it should.

Share this post


Link to post
Share on other sites

Hello Jetta,

 

Thanks for the contribution! So many nightmares with 2.2 RC2 and Rate V4 I don't know where to begin.

 

I installed your contribution.

 

I got to the fourth part, Configure settings from admin panel.

 

When I got into admin -> modules -> Shipping Modules and click on EDIT I get this error:

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

Fatal error: Call to undefined function tep_cfg_usps_services() in /home/candleli/public_html/store/admin/modules.php(341) : eval()'d code on line 1

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

 

Any idea what might be causing the error?

 

I have yet to proceed to the application_top.php, general.php and modules.php edits.

 

Best,

Chris

 

Hey team,

 

Any idea on the error I'm encountering?

 

Thanks!

Share this post


Link to post
Share on other sites

Hello Jetta,

 

For a novice coder like myself, can you tell me which USPS rate v4 module I should install for an osCommerce version 2.2-MS2?

 

I installed and followed the instructions for "USPS Rate V4 Intl Rate V2", but my edited perferences in the Shipping Module admin page wouldn't stay (after clicking "confirm"), and this link (http://www.uspsprioritymail.com/et_regcert.html) was not good when I went to check on my USPS account status.

 

Thank you so much!

 

Matthew

Share this post


Link to post
Share on other sites

Hey team,

 

Any idea on the error I'm encountering?

 

Thanks!

 

Did you follow the instructions provided in the readme.txt file? If so, you should have the following code under admin/includes/functions/general.php:

// USPS START
function tep_cfg_usps_services($select_array, $key_value, $key = '')
{
$key_values = explode( ", ", $key_value);
$name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value');
$string = '<b><div style="width:20px;float:left;text-align:center;"> </div><div style="width:30px;float:left;text-align:center;">Min</div><div style="width:30px;float:left;text-align:center;">Max</div><div style="float:left;"></div><div style="width:50px;float:right;text-align:center;">Handling</div></b><div style="clear:both;"></div>';
for ($i=0; $i<sizeof($select_array); $i++)
 {
 $string .= '<div id="' . $key . $i . '">';
 $string .= '<div style="width:20px;float:left;text-align:center;">' . tep_draw_checkbox_field($name, $select_array[$i], (in_array($select_array[$i], $key_values) ? 'CHECKED' : '')) . '</div>';
 if (in_array($select_array[$i], $key_values)) next($key_values);
 $string .= '<div style="width:30px;float:left;text-align:center;">' . tep_draw_input_field($name, current($key_values), 'size="1"') . '</div>';
 next($key_values);
 $string .= '<div style="width:30px;float:left;text-align:center;">' . tep_draw_input_field($name, current($key_values), 'size="1"') . '</div>';
 next($key_values);
 $string .= '<div style="float:left;">' . preg_replace(array('/RM/', '/TM/', '/International/', '/Envelope/', '/ Mail/', '/Large/', '/Medium/', '/Small/', '/First/', '/Legal/', '/Padded/', '/Flat Rate/', '/Regional Rate/', '/Express Guaranteed /'), array('', '', 'Intl', 'Env', '', 'Lg.', 'Md.', 'Sm.', '1st', 'Leg.', 'Pad.', 'F/R', 'R/R', 'Exp Guar'), $select_array[$i]) . '</div>';
 $string .= '<div style="width:50px;float:right;text-align:center;">$' . tep_draw_input_field($name, current($key_values), 'size="2"') . '</div>';
 next($key_values);
 $string .= '<div style="clear:both;"></div></div>';
 }
return $string;
}
function tep_cfg_usps_extraservices($select_array, $key_value, $key = '')
{
$key_values = explode( ", ", $key_value);
$name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value');
$string = '<b><div style="width:20px;float:left;text-align:center;">N</div><div style="width:20px;float:left;text-align:center;">Y</div></b><div style="clear:both;"></div>';
for ($i=0; $i<sizeof($select_array); $i++)
 {
 $string .= tep_draw_hidden_field($name, $select_array[$i]);
 next($key_values);
 $string .= '<div id="' . $key . $i . '">';
 $string .= '<div style="width:20px;float:left;text-align:center;"><input type="checkbox" name="' . $name . '" value="N" ' . (current($key_values) == 'N' || current($key_values) == '' ? 'CHECKED' : '') . ' id="N-'.$key.$i.'" onClick="if(this.checked==1)document.getElementById(\'Y-'.$key.$i.'\').checked=false;else document.getElementById(\'Y-'.$key.$i.'\').checked=true;"></div>';
 $string .= '<div style="width:20px;float:left;text-align:center;"><input type="checkbox" name="' . $name . '" value="Y" ' . (current($key_values) == 'Y' ? 'CHECKED' : '') . ' id="Y-'.$key.$i.'" onClick="if(this.checked==1)document.getElementById(\'N-'.$key.$i.'\').checked=false;else document.getElementById(\'N-'.$key.$i.'\').checked=true;"></div>';
 next($key_values);
 $string .= preg_replace(array('/Signature/', '/without/', '/Merchandise/', '/TM/', '/RM/'), array('Sig', 'w/out', 'Merch.', '', ''), $select_array[$i]) . '<br>';
 $string .= '<div style="clear:both;"></div></div>';
 }
return $string;
}
// USPS END

Share this post


Link to post
Share on other sites

I am new to osCommerce - came from Magento and I will admit it has been a struggle. I only left Magento because my provider bases their usage on size of database files and Magento is about 43M out of the box, they allow 2GB, even their pro is only 3GB. Anyway, I was hoping to use the USPS mudule included in osCommerce 2.3.1, but after struggling with and only getting Libray Shipping to work that I gave up and went to Methods. Got that to work, but my primary shipping method, First-Class Parcel, wasn't populating the description. Again, after a long hard struggle I gave up and went to USPS Rate V4 Intl Rate V2 - v.1.7_1 with USPS Restrict Methods and just now seems to be working, but to be honest not sure if I am getting full functionality.

The only way I got this to work was to use the drop on top method, I am assuming there are a number of steps missing in the step by step instructions since the step by step didn't have some of the changed files included in the instructions and I wasn't in the mood to do a file compare - I've been at osCommerce for a month trying to get it where I need/want it. Paypal is now broken. Fix one thing, breaks another...on to my next struggle.

Share this post


Link to post
Share on other sites

This has got me scratching my head.

Using the old USPS module that went dark we did not have this error.

After installling the module and emailing USPS, we get rates for Cont. U.S.

But,

we only offer postal service to Alaska, Hawaii, APO and FPO addresses.

When running a test I get this error:

<Package ID="1">

<Error>

<Number>-2147219401</Number>

<Source>;clsRateV4.CreateSinglePostage-CreateSinglePostage;RateEngineV4.ProcessRequest</Source>

<Description> Error Information: The Destination ZIP Code you have entered is invalid.</Description>

<HelpFile></HelpFile>

<HelpContext>1000440</HelpContext>

</Error>

</Package>

</RateV4Response>

Address is:

APO, AE 09391

 

This is a valid US Postal Service Zip Code.

Any thoughts?


If you choose not to decide you still have made a choice, I will choose a purpose clear, I will choose Free Will. --Neal Peart - Rush

Share this post


Link to post
Share on other sites

I believe there is a forum rule about posting the same question in multiple topics.

 

09391 is not a valid zip code.

Share this post


Link to post
Share on other sites

The current USPS database says that 09391 is valid: it's assigned to Joint Base Balad in Iraq. Perhaps none of the services you have selected are available to that destination. You could ask the USPS what services are available.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

@@NovemberDirge

 

I have yet to proceed to the application_top.php, general.php and modules.php edits

 

tep_cfg_usps_services()

 

isn't being defined because you haven't finished the installation

Share this post


Link to post
Share on other sites

@@jdfitch

 

USPS already gave you the answer:

 

Error Information: The Destination ZIP Code you have entered is invalid

 

If you believe it is a valid zip code, then contact their technical center.

Share this post


Link to post
Share on other sites

Have been trying to resolve my USPS problems for weeks. Had USPS methods installed for years but after most recent changes first class domestic disappeared, I applied all kinds of updates and it wouldn't resolve. So tried this contribution and all domestic finally works fine but now my international calculations are down. I get the following error(s): Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 84: parser error : etc. So international rates are not showing at all now.

Share this post


Link to post
Share on other sites

I have something happening that I need help with. My USPS shipping rates have been working great since I installed this contrib at the end of March. Today I wanted to go into admin/module.php, and all I got was a blank page. To make a long story short, every time I try to access modules.php from admin, it throws the following error:

 

PHP Fatal error: Call to a member function getAll() on a non-object in /home5/cascadec/public_html/admin/modules.php on line 17

 

Line 17 is this:

 

$modules = $cfgModules->getAll();

 

I don't know why this worked when I first installed the mod, but now I can't open my modules.php, or shipping Can anyone tell me what this line is having a problem with? I run a 2.2 shop.

 

Ron West

Share this post


Link to post
Share on other sites

First I must say, Jetta I really appreciate the plugin. It, thus far, has been great.

 

Now for the topic of my concern....

 

I can't for the life of me seem to actually make any changes to the shipping meathods... Every time I check mark, set the min or max rate, or change the handing price, upon saving it loses everything. I am seening no errors in the log and the oly fireld that is filled is the min value in the 1st-Class Lg. Env. It is, for some reason filled with the value "Array" and resets to that everytime I save my settings.

 

If it helps in teh main shipping modules I also get the following:

Shipping Methods (Domestic and International)

Array

 

Extra Services (Domestic)

Array

 

Extra Services (International)

Array

 

I am lost on what to do and would appreciate your (or anyones) help.

Share this post


Link to post
Share on other sites

Thank for the contribution.

 

There seems to a $6.00 minimum shipping charge.

 

If I have a 6 oz item it's $6.05. If I have 10lb item it's $10.00.

 

I only have parcel post selected with no handling charge at present.

 

thanks

 

Walter

Share this post


Link to post
Share on other sites

Never mind. I'm a dope:)

 

Great contribution. I finally realized that individual item shipping rates can be manipulated by using the min and max weights for each shipping method.

 

Sweet!

Share this post


Link to post
Share on other sites

Hello folks!

 

The USPS module is mistakenly adding weight and therefore adding shipping costs. The problem is a workshop registration with a weight set at 0.00 which doesn't require any shippng.

 

When when a customer checks out they end up on the checkout_shipping.php page and the module is calculating rates based on 1 oz.

 

The module is acting like the product has weight even though it's set to 0.00 (I've even tried setting it to a negative number).

 

I've tried changing my tare weight to zero and editing the minimium weights in the USPS module but the problem persists.

 

Is this a database or product attributes problem? I would love to hear ideas for a possible solution. What's baffling is that I have some mp3s for sale on my site with a 0.00 weight that work just fine; they successfully go right through to the payment page.

 

Thank you so much!

 

Version: USPS Rate V4 Intl Rate V2 - v.1.7

Share this post


Link to post
Share on other sites

Hi,

Now we use osc22RC2A and your lastest USPS module.

 

we use Paypal Standard module.

 

we get this error when go to checkout:

 

"The link you have used to enter the PayPal system contains an incorrectly formatted item amount."

 

I think your Priority Mail® , ® have issue, would you please help to check and give your suggestion?

 

 

 

Best Regards,

Share this post


Link to post
Share on other sites

Hi,

Now we use osc22RC2A and your lastest USPS module.

 

we use Paypal Standard module.

 

we get this error when go to checkout:

 

"The link you have used to enter the PayPal system contains an incorrectly formatted item amount."

 

I think your Priority Mail® , ® have issue, would you please help to check and give your suggestion?

 

 

 

Best Regards,

 

sorry we use PayPal IPN v2.3.4.6 now. have this issue on USPS.

Share this post


Link to post
Share on other sites

Hi,

 

If any one need ability to choose Live or Test server.

 

File to work with is usps.php

 

Find:

 

if ($http->Connect('production.shippingapis.com', 80))

{

$http->addHeader('Host', 'production.shippingapis.com');

$http->addHeader('User-Agent', 'osCommerce');

$http->addHeader('Connection', 'Close');

if ($http->Get('/shippingapi.dll?' . $request)) $body = preg_replace(array('/\<sup\>\&reg;\<\/sup\>/', '/\<sup\>\&trade;\<\/sup\>/', '/\" /', '/\",/', '/\"<br>/', '/<br>/'), array('RM', 'TM', '",', '" ', '"<br>', 'BREAK'), htmlspecialchars_decode($http->getBody()));

// mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, $body);

$http->Disconnect();

return json_decode(json_encode(simplexml_load_string($body)),TRUE);

}

 

Replace with:

 

//Start Live or test server

if (MODULE_SHIPPING_USPS_SERVER == 'Live') {

 

if ($http->Connect('production.shippingapis.com', 80))

{

$http->addHeader('Host', 'production.shippingapis.com');

$http->addHeader('User-Agent', 'osCommerce');

$http->addHeader('Connection', 'Close');

if ($http->Get('/shippingapi.dll?' . $request)) $body = preg_replace(array('/\<sup\>\&reg;\<\/sup\>/', '/\<sup\>\&trade;\<\/sup\>/', '/\" /', '/\",/', '/\"<br>/', '/<br>/'), array('RM', 'TM', '",', '" ', '"<br>', 'BREAK'), htmlspecialchars_decode($http->getBody()));

//echo "Body = ";

//echo $body;

//echo "<br>";

$http->Disconnect();

return json_decode(json_encode(simplexml_load_string($body)),TRUE);

}

}

if (MODULE_SHIPPING_USPS_SERVER == 'Test') {

 

if ($http->Connect('testing.shippingapis.com', 80))

{

$http->addHeader('Host', 'testing.shippingapis.com');

$http->addHeader('User-Agent', 'osCommerce');

$http->addHeader('Connection', 'Close');

if ($http->Get('/ShippingAPITest.dll?' . $request)) $body = preg_replace(array('/\<sup\>\&reg;\<\/sup\>/', '/\<sup\>\&trade;\<\/sup\>/', '/\" /', '/\",/', '/\"<br>/', '/<br>/'), array('RM', 'TM', '",', '" ', '"<br>', 'BREAK'), htmlspecialchars_decode($http->getBody()));

//echo "Body = ";

//echo $body;

//echo "<br>";

$http->Disconnect();

return json_decode(json_encode(simplexml_load_string($body)),TRUE);

}

}

//End Live or test server

 

Find:

 

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Show International Regulations:', 'MODULE_SHIPPING_USPS_REGULATIONS', 'True', 'Displays international regulations and customs information.', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

 

Add after it:

 

//Start Live or test server

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Server', 'MODULE_SHIPPING_USPS_SERVER', 'Live', 'Use the testing or live server for transactions?<br><b>Live :</b> production.shippingapis.com/shippingapi.dll<br><b>Test :</b> testing.shippingapis.com/ShippingAPITest.dll', '6', '0', 'tep_cfg_select_option(array(\'Live\', \'Test\'), ', now())");

//End Live or test server

 

Find:

 

return array('MODULE_SHIPPING_USPS_STATUS', 'MODULE_SHIPPING_USPS_USERID', 'MODULE_SHIPPING_USPS_TAX_CLASS', 'MODULE_SHIPPING_USPS_ZONE', 'MODULE_SHIPPING_USPS_SORT_ORDER', 'MODULE_SHIPPING_USPS_TYPES', 'MODULE_SHIPPING_USPS_DMST_SERVICES', 'MODULE_SHIPPING_USPS_INTL_SERVICES', 'MODULE_SHIPPING_USPS_RATE_TYPE', 'MODULE_SHIPPING_USPS_RATE_SORTER', 'MODULE_SHIPPING_USPS_REGULATIONS');

 

Replace with:

 

//Start Live or test server

// return array('MODULE_SHIPPING_USPS_STATUS', 'MODULE_SHIPPING_USPS_USERID', 'MODULE_SHIPPING_USPS_TAX_CLASS', 'MODULE_SHIPPING_USPS_ZONE', 'MODULE_SHIPPING_USPS_SORT_ORDER', 'MODULE_SHIPPING_USPS_TYPES', 'MODULE_SHIPPING_USPS_DMST_SERVICES', 'MODULE_SHIPPING_USPS_INTL_SERVICES', 'MODULE_SHIPPING_USPS_RATE_TYPE', 'MODULE_SHIPPING_USPS_RATE_SORTER', 'MODULE_SHIPPING_USPS_REGULATIONS');

return array('MODULE_SHIPPING_USPS_STATUS', 'MODULE_SHIPPING_USPS_USERID', 'MODULE_SHIPPING_USPS_SERVER', 'MODULE_SHIPPING_USPS_TAX_CLASS', 'MODULE_SHIPPING_USPS_ZONE', 'MODULE_SHIPPING_USPS_SORT_ORDER', 'MODULE_SHIPPING_USPS_TYPES', 'MODULE_SHIPPING_USPS_DMST_SERVICES', 'MODULE_SHIPPING_USPS_INTL_SERVICES', 'MODULE_SHIPPING_USPS_RATE_TYPE', 'MODULE_SHIPPING_USPS_RATE_SORTER', 'MODULE_SHIPPING_USPS_REGULATIONS');

//End Live or test server

 

For debuging uncomment:

 

//echo "Body = ";

//echo $body;

//echo "<br>";

 

 

Best Regards,

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

×