Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


Guest

Recommended Posts

Hi all. So I installed this, even though I was fully aware of USPS's API changes.

 

I currently am returning no errors but I'm not getting any rates either! I have a few theories, so maybe someone can confirm them for me?

 

My biggest theory is that I applied for the API tools earlier today. The site says it will take up to 24 hours to e-mail the information/confirmation/ect. But in the admin panel, there doesn't seem to be a need for any API related information? Just my USPS user ID? Still, perhaps until the API tools are confirmed it won't display rates on my site. This is my theory.

 

Second, could be that with the changes made to the API terms, it will not properly display the information. Although, I've already used Jim's term changes from above, and there is no change to my shipping page--no errors being displayed either. Plus it seems as though Jim's changes work for others, so I doubt this is the problem.

 

Lastly, the only other thing I think it could be is the following: When I installed the module, I followed the basic numbered instructions at the top. Step 2 calls for the files in the folder Files To Modify to be merged with the existing files if the OSC version being used has been modified (which mine has). I double checked it by going through the Step By Step File Modification instructions and I found that the first change to checkout_shipping.php does not coincide with the file merge I did. The instructions say the following:

 

FIND

function rowOutEffect(object) {
 if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}

 

INSERT AFTER:

// USPS START
function radioSet(el)
{
if(!$('#shownString, #shownStringShow, #shownStringHide', el).is(':visible'))
 {
 $('#shownString, #shownStringInfo, #shownStringShow, #shownStringHide').hide();
 $('#shownString, #shownStringShow', el).show();
 }
}
$(function()
{ 
$('[type=radio]:checked').each(function()
 {
 $('#shownString', $(this).parent().parent()).show();
 });
});
// USPS END

 

Attached is the maker's checkout_shipping.php (renamed to OP_checkout_shipping.php) and mine (name unchanged). Any input is much appreciated. Thank you!

 

~Jan

checkout_shipping.php

OP_checkout_shipping.php

Link to comment
Share on other sites

@@REALGOODEAL

 

Once you have a good working set of module files, all you need is the usps id. however, in the install instructions you should also find a note that usps has to be contacted directly about this being on an oscommerce shop and ask them to switch to a production version. i called them directly as i recall to get this taken care of.

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

I goofed on the International Parcel code. It should have been First-Class Package International ServiceTM**. That's now fixed.The test file has been updated with the correction. Please test this one on your international orders.

 

Regards

Jim

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

Link to comment
Share on other sites

@@REALGOODEAL

 

Once you have a good working set of module files, all you need is the usps id. however, in the install instructions you should also find a note that usps has to be contacted directly about this being on an oscommerce shop and ask them to switch to a production version. i called them directly as i recall to get this taken care of.

 

They just sent me my API info and I called to switch it over, which they did and I have a confirmation e-mail to be sure, but I still don't have rates. Perhaps it takes a while to kick in? Or maybe it's actually one of the other issues? I'm currently testing for domestic anyway, so I don't think the international terms would be an issue, but still?

Link to comment
Share on other sites

What services do you have selected in the module? I suggest that you select all of them for testing purposes, then deselect the ones you don't want once you have verified that it's working.

 

Regards

Jim

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

Link to comment
Share on other sites

What services do you have selected in the module? I suggest that you select all of them for testing purposes, then deselect the ones you don't want once you have verified that it's working.

 

Regards

Jim

 

Wow. Please excuse my stupidity. I had none of them checked. Everything shows up now. Thank you guys! :blush:

Link to comment
Share on other sites

I goofed on the International Parcel code. It should have been First-Class Package International ServiceTM**. That's now fixed.The test file has been updated with the correction. Please test this one on your international orders.

 

Regards

Jim

 

I'm receiving this error when testing international:

Warning: Illegal string offset 'ServiceName' in /homepages/27/d197332112/htdocs/test/catalog/includes/modules/shipping/usps.php on line 103
Link to comment
Share on other sites

That's a test to see if the offset exists, so logically it shouldn't generate a warning when it evaluates to false. Sometimes I hate PHP. I suggest that you just ignore the error for now. If you find something that isn't working, then I'll be able to find out what the real error is.

 

Regards

Jim

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

Link to comment
Share on other sites

I am just comparing your code to our and I notice your code does not have the following code as part of the function usps

 

function usps()

{

if ( !function_exists('htmlspecialchars_decode') )

{

function htmlspecialchars_decode($text)

{

return strtr($text, array_flip(get_html_translation_table(HTML_SPECIALCHARS)));

}

}

global $order;

Link to comment
Share on other sites

htmlspecialchars_decode is included in PHP starting with version 5.1. You only need that code if you're running on a really old version of PHP. That's the wrong place to put that code anyway; it needs to be outside the usps class.

 

Regards

Jim

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

Link to comment
Share on other sites

OK, mine is now working. Just three changes needed for my module:

 

From this: elseif ($request_type == 'Parcel PostRM') $service = 'PARCEL';

To this: elseif ($request_type == 'Standard PostRM') $service = 'PARCEL';

 

Then go to this paragraph:

 

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 ('Shipping Methods (Domestic and International)', 'MODULE_SHIPPING_USPS_TYPES', '0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00', '<b><u>Checkbox:</u></b> Select the services to be offered<br><b><u>Minimum Weight (lbs)</u></b>first input field<br><b><u>Maximum Weight (lbs):</u></b>second input field<br><br>USPS returns methods based on cart weights. These settings will allow further control (particularly helpful for flat rate methods) but will not override USPS limits', '6', '0', 'tep_cfg_usps_services(array(\'First-Class MailRM Large Envelope\', \'First-Class MailRM Parcel\', \'Media MailRM\', \'Parcel PostRM\', \'Priority MailRM\', \'Priority MailRM Flat Rate Envelope\', \'Priority MailRM Legal Flat Rate Envelope\', \'Priority MailRM Padded Flat Rate Envelope\', \'Priority MailRM Small Flat Rate Box\', \'Priority MailRM Medium Flat Rate Box\', \'Priority MailRM Large Flat Rate Box\', \'Priority MailRM Regional Rate Box A\', \'Priority MailRM Regional Rate Box B\', \'Priority MailRM Regional Rate Box C\', \'Express MailRM\', \'Express MailRM Flat Rate Envelope\', \'Express MailRM Legal Flat Rate Envelope\', \'Express MailRM Flat Rate Boxes\', \'First-Class MailRM International Large Envelope**\', \'First-Class MailRM International Parcel**\', \'Priority MailRM International\', \'Priority MailRM International Flat Rate Envelope**\', \'Priority MailRM International Small Flat Rate Box\', \'Priority MailRM International Medium Flat Rate Box\', \'Priority MailRM International Large Flat Rate Box\', \'Express MailRM International\', \'Express MailRM International Flat Rate Envelope\', \'Express MailRM International Flat Rate Boxes\', \'USPS GXGTM Envelopes**\', \'Global Express GuaranteedRM (GXG)**\'), ', now())");

 

Change this: \'Parcel PostRM\',

To this: \'Standard PostRM\',

 

And this: \'First-Class MailRM International Parcel**\',

To this: \'First-Class Package International ServiceTM**\',

 

That's it. It is now showing Parcel Post rates as Standard Post rates and International Package rates, which are quite a bit higher.

 

Thanks everyone for all your input.

 

Shopgrl

Link to comment
Share on other sites

I goofed on the International Parcel code. It should have been First-Class Package International ServiceTM**. That's now fixed.The test file has been updated with the correction. Please test this one on your international orders.

 

Regards

Jim

 

Jim, testing First-Class Package International ServiceTM**......that with an international account

 

it works. Thanks for your help on this.

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

I think what is also missing from this module is a note to the customer about "flat rate" selections. The customer cannot really decide which package (envelope, small box, medium box or large box) as that would be up to the store to determine what the product fits in. So if a customer picks small box and the product doesn't fit, then what? There should be a note field as part of the shipping selections under the admin panel for the store to add notes which appear in BOLD RED , with a default description of - Shipper determines actual shipping method for flat rate containers, additional fees may be charged. The shipper then would need a way to either charge the customer the difference (negative or positive amounts). Cancelling the order and re-doing it just isn't a good way to handle a shipping container issue. If you look at other merchants, you select USPS, UPS, FedX and whether you want it next day, same day or standard delivery and then the shipper determines the best method based on the customers request and charges made to their account. I think this module could be simplified a lot, have less to check (in the admin screen) and leave the actual shipping container selections to the store.

Link to comment
Share on other sites

If we choose the later in the above to make the selections fewer and store determine shipping containers, I still would like a note field to add to the customer for situations like if a storm is interfering with shipping and there may be delays, we can state that in the shipping screens so the customer is aware of potential delays due to weather or other factors.

Link to comment
Share on other sites

If we choose the later in the above to make the selections fewer and store determine shipping containers, I still would like a note field to add to the customer for situations like if a storm is interfering with shipping and there may be delays, we can state that in the shipping screens so the customer is aware of potential delays due to weather or other factors.

 

you could add something like this on the checkout_shipping.php page. (catalog/checkout_shipping.php or such depending where your shop is installed)

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

That's a test to see if the offset exists, so logically it shouldn't generate a warning when it evaluates to false. Sometimes I hate PHP. I suggest that you just ignore the error for now. If you find something that isn't working, then I'll be able to find out what the real error is.

 

Regards

Jim

 

I haven't particularly found that something wasn't working, but I'm a bit OCD and the warning is repeated several times so that I have to scroll a page and a half to get to the actual page... it unsettles me. As I understand it from here, the issue is that $val['ServiceName'] or $iExtras[$val['ServiceName']] is undefined somewhere? So the code isn't quite sure what to do with it?

 

Shouldn't there be a way to simply check that it's defined and, if it isn't define it?

 

Has anyone else ever gotten this?

Link to comment
Share on other sites

I haven't particularly found that something wasn't working, but I'm a bit OCD and the warning is repeated several times so that I have to scroll a page and a half to get to the actual page... it unsettles me. As I understand it from here, the issue is that $val['ServiceName'] or $iExtras[$val['ServiceName']] is undefined somewhere? So the code isn't quite sure what to do with it?

 

Shouldn't there be a way to simply check that it's defined and, if it isn't define it?

 

Has anyone else ever gotten this?

 

Spoke too soon.

 

Still testing Int'l rates; wanted to make sure Ground rates were available for Canada. I selected a USPS method and when I clicked to confirm and go to the payment page, I received an additional error message:

 

Warning: Cannot modify header information - headers already sent by (output started at catalog/includes/modules/shipping/usps.php:103) in /catalog/includes/functions/general.php on line 49

 

And it won't show my page at all.

Link to comment
Share on other sites

Hi all,

 

I am new to Oscommerce.

 

I am unable to get the USPS Priority mail international small flat rate box. I am Getting it for domestic shipping. I am using this module in my client store.

 

Remaining all are working fine.

 

Please any one can point me to right direction.

 

Please Please It's Very urgent.

 

Iam also attached the Image of shipping.post-319308-0-23408500-1359564108_thumb.png

 

Thank you.

Edited by rajkumaralma
Link to comment
Share on other sites

@@REALGOODEAL We are checking that the value is set -- PHP is objecting to the check. Try changing that line in usps.php to this:

 

 if (@ isset($iExtras[$val['ServiceName']]) && tep_not_null($iExtras[$val['ServiceName']]) && ((MODULE_SHIPPING_USPS_RATE_TYPE == 'Online' && $val['AvailableOnline'] == 'True') || (MODULE_SHIPPING_USPS_RATE_TYPE == 'Retail' && $val['Available'] == 'True')))

 

The second error you are getting is a result of the first error.

 

@@rajkumaralma Do you have that service selected in the module setup? Is your product weight lees than the USPS maximum?

 

Regards

Jim

Edited by kymation

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

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