Jump to content



Latest News: (loading..)

USPS Shipping Module help

usps shipping module

  • Please log in to reply
14 replies to this topic

#1   jpettyc

jpettyc
  • Members
  • 6 posts
  • Real Name:Jason Petty
  • Gender:Male

Posted 02 April 2013 - 09:24 PM

I am new to OSCommerce and am trying to set up a simple web site with just a few products.  The ONLY thing I have tried is to enable the USPS Shipping module.  I am on OSC 2.3.3 and noticed that this module must be out of date based on what I have read out there.  I have read many forum posts and was directed to use the following addons without any success:
USPS Rate V4 Intl Rate V2
USPS Rate V4 Intl Rate V2 - v.1.7
USPS Rate V4 Intl Rate V2 - v.1.7_1
USPS Rate V4 Intl Rate V2 - 01-27-13 Update

No matter what I do, I still don't see any shipping options at checkout (see screenshot) Any ideas?

Thanks in advance
Screenshot:
http://hobbycache.com/images/USPSCapture.PNG

#2   a.forever

a.forever
  • Members
  • 199 posts
  • Real Name:Kevin
  • Gender:Male

Posted 03 April 2013 - 05:53 AM

Alright. I just successfully added a USPS module to osC 2.3.x and I think I got all the kinks. I'm assuming you're starting with a fresh install, but it's not necessary. The following instructions should give you a functional USPS shipping module on a 2.3.x store. It won't fix Parcel Post, First-Class Package International Service, and other small things. I'm sure there are functional edits for those, but I haven't researched any.
  • Login to your admin and uninstall your current USPS module

  • Log out of your admin

  • Download this: http://addons.oscommerce.com/info/8327
    You'll be after the USPS Rate V4 Intl Rate V2 - v.1.7 - FIX by fulluvscents on Feb 11, 2012

  • Install the two files found in the New_Files folder (overwrite the existing files and install in correct folder paths)

  • Within admin/includes/functions/general.php
    FIND:
    ?>
    ADD ABOVE:

    // 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;">&nbsp;</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('', '', 'Int\'l', '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;">S</div><div style="width:20px;float:left;text-align:center;">H</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" onclick="if($(this).is(\':checked\')) $(\'#C, #S, #H\', $(\'#' . $key . $i . '\')).removeAttr(\'checked\'); if($(\':checkbox:checked\', $(\'#' . $key . $i . '\')).size() == 0) $(this).attr(\'checked\', \'checked\');"></div>';
    $string .= '<div style="width:20px;float:left;text-align:center;"><input type="checkbox" name="' . $name . '" value="S" ' . (current($key_values) == 'S' ? 'CHECKED' : '') . ' id="S" onclick="if($(this).is(\':checked\')) $(\'#N, #C, #H\', $(\'#' . $key . $i . '\')).removeAttr(\'checked\'); if($(\':checkbox:checked\', $(\'#' . $key . $i . '\')).size() == 0) $(\'#N\', $(\'#' . $key . $i . '\')).attr(\'checked\', \'checked\');"></div>';
    $string .= '<div style="width:20px;float:left;text-align:center;"><input type="checkbox" name="' . $name . '" value="H" ' . (current($key_values) == 'H' ? 'CHECKED' : '') . ' id="H" onclick="if($(this).is(\':checked\')) $(\'#N, #C, #S\', $(\'#' . $key . $i . '\')).removeAttr(\'checked\'); if($(\':checkbox:checked\', $(\'#' . $key . $i . '\')).size() == 0) $(\'#N\', $(\'#' . $key . $i . '\')).attr(\'checked\', \'checked\');"></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


  • Within admin/modules.php
    FIND:

      if (tep_not_null($action)) {
    	switch ($action) {
    	  case 'save':
    		reset($HTTP_POST_VARS['configuration']);		while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) {
    ADD BELOW:

    // USPS START
    if( is_array( $value ) ) $value = implode( ', ', $value);// USPS END


  • Within admin/modules.php (same file)
    FIND:
     $contents[] = array('text' => '<br />' . $keys);
    REPLACE WITH:

    // USPS START
    //		$contents[] = array('text' => '<br />' . $keys);
    		$contents[] = array('text' => '<br />' . preg_replace(array('/RM/', '/TM/', '/International/', '/Envelope/'), array('&reg;', '&trade;', 'Int\'l', 'Env'), $keys));// USPS END


  • Within catalog/checkout_shipping.php
    FIND:

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

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


  • Within catalog/checkout_shipping.php (same file)
    FIND:

    			  echo '	  <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
    			} else {
    			  echo '	  <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
    			}
    ?>
    		<td width="75%" style="padding-left: 15px;"><?php echo $quotes[$i]['methods'][$j]['title']; ?></td>
    REPLACE WITH:

    // USPS START
    //			  echo '	  <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
    			  echo '	  <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ');radioSet(this);">' . "\n";
    			} else {
    //			  echo '	  <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
    			  echo '	  <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ');radioSet(this);">' . "\n";
    			}
    ?>
    
    <!--
    		<td width="75%" style="padding-left: 15px;"><?php echo $quotes[$i]['methods'][$j]['title']; ?></td>
    -->
    		<td width="75%" style="padding-left: 15px;"><?php echo $quotes[$i]['methods'][$j]['title'] . $quotes[$i]['methods'][$j]['shownString']; ?></td><!-- USPS END -->


  • Login to your admin and install your new USPS module

  • Edit the module with your USPS user ID, whether to tax shipping, whether to restrict shipping to a specific shipping zone, preferred sort order, and choice of methods, etc.

  • Save.
You should be done. Hope this helps.

Edited by a.forever, 03 April 2013 - 05:53 AM.


#3   jpettyc

jpettyc
  • Members
  • 6 posts
  • Real Name:Jason Petty
  • Gender:Male

Posted 03 April 2013 - 01:54 PM

Kevin,  Thank you for your post.  I followed these instructions (they look similar to what I had followed in the readme) and still not working.  Sorry.  I was hoping.  :)  The module is available in the admin and I can set settings but on checkout, there is nothing.  Maybe I will do a fresh install and follow again.

#4   live

live
  • Members
  • 9 posts
  • Real Name:gc1
  • Gender:Male

Posted 05 April 2013 - 12:31 AM

Fresh install didn't display shipping options on checkout either.  Addon looks great in admin console, but no shipping options show on checkout.   2 other store owners had same results (no shipping options show on checkout), from fresh 2.3.3 install.

#5   a.forever

a.forever
  • Members
  • 199 posts
  • Real Name:Kevin
  • Gender:Male

Posted 06 April 2013 - 10:40 AM

View Postjpettyc, on 03 April 2013 - 01:54 PM, said:

Kevin,  Thank you for your post.  I followed these instructions (they look similar to what I had followed in the readme) and still not working.  Sorry.  I was hoping.  :)  The module is available in the admin and I can set settings but on checkout, there is nothing.  Maybe I will do a fresh install and follow again.

I'm also assuming that:

Modules -> Shipping -> United States Postal Service:
Do you want to offer USPS shipping? = True
Enter the USPS User ID -- activated on live production server
Shipping Zone = ---none---
Min/Max = defined weight in pounds

Configuration -> Shipping/Packaging:
Country of Origin and Postal Code is set

PHP Version:
5.3 or greater

Product Weight:
Greater than 0

Shipping Address:
Country is a location where shipping method can deliver
ex. Priority MailĀ® = United States, but Priority MailĀ® International = outside United States

#6   jpettyc

jpettyc
  • Members
  • 6 posts
  • Real Name:Jason Petty
  • Gender:Male

Posted 06 April 2013 - 12:24 PM

Kevin, yes on all of those items you just posted.  I have them all set correctly.

#7   jpettyc

jpettyc
  • Members
  • 6 posts
  • Real Name:Jason Petty
  • Gender:Male

Posted 07 April 2013 - 01:27 PM

Kevin,  I found out that my account has not been switched to access the USPS production APIs so I have requested this and will try after that.  Thanks for your posts!

#8   live

live
  • Members
  • 9 posts
  • Real Name:gc1
  • Gender:Male

Posted 07 April 2013 - 05:58 PM

My account is switched to access the USPS production APIs, re-verified through usps, and worked with the core usps modules prior to the usps code update January, then only showed Library Mail (wrong), and no other usps options on checkout .  Since the core usps module is broken, I am hoping USPS Rate V4 Intl Rate V2 add-on will work, but after installing it, from fresh osc 2.3.3 install. the module is available in the admin and I can set settings but on checkout I still don't see any shipping options at checkout

#9   live

live
  • Members
  • 9 posts
  • Real Name:gc1
  • Gender:Male

Posted 07 April 2013 - 07:04 PM

Just for the record, the usps api code update January, is what broke the osc core usps module.  Until the osc core usps shipping module gets fixed, this USPS Rate V4 Intl Rate V2 add-on hopefully will restore usps shipping to osc?    Here in the US, usps, Fed-Ex, UPS, DHL are all Standard Shipping (osc storeowners wishlist), the e-shipper add-on is only supported for Canada.   In the meantime, I don't know what other osc e-storeowners are doing, I have had to shut down my e-store (disabled paypal), until I can resume providing upfront shipping costs during checkout.  Regardless, future api updates will most-likely periodically  keep breaking osc code (since api coders fail to adhere to standards) and will require periodic maintenance from osc php coders/developers, or repeatedly risk losing usps shipping functionality ...   Any help is appreciated.

#10   a.forever

a.forever
  • Members
  • 199 posts
  • Real Name:Kevin
  • Gender:Male

Posted 09 April 2013 - 03:44 AM

View Postjpettyc, on 07 April 2013 - 01:27 PM, said:

Kevin,  I found out that my account has not been switched to access the USPS production APIs so I have requested this and will try after that.  Thanks for your posts!

Good to know. I figured one of the assumptions wasn't true. Hopefully it'll get the basics of the add-on working. Hunt down the mods for the January 27, 2013 changes if you need Standard Post and First-Class Package International Service. It shouldn't be too hard.

View Postlive, on 07 April 2013 - 05:58 PM, said:

My account is switched to access the USPS production APIs, re-verified through usps, and worked with the core usps modules prior to the usps code update January, then only showed Library Mail (wrong), and no other usps options on checkout .  Since the core usps module is broken, I am hoping USPS Rate V4 Intl Rate V2 add-on will work, but after installing it, from fresh osc 2.3.3 install. the module is available in the admin and I can set settings but on checkout I still don't see any shipping options at checkout

The USPS module that comes with osC v2.3.3 has been outdated for months. I wouldn't even bother with it since it's probably too cumbersome to fix. I personally deleted its module files prior to even logging into my admin on a fresh osC 2.3.3 install. I would imagine that present osC users invoking USPS services are either on USPS Rate V4 Intl Rate V2 - v.1.0 by fulluvscents or USPS Methods by Bearclaw.

View Postlive, on 07 April 2013 - 07:04 PM, said:

Just for the record, the usps api code update January, is what broke the osc core usps module.  Until the osc core usps shipping module gets fixed, this USPS Rate V4 Intl Rate V2 add-on hopefully will restore usps shipping to osc?    Here in the US, usps, Fed-Ex, UPS, DHL are all Standard Shipping (osc storeowners wishlist), the e-shipper add-on is only supported for Canada.   In the meantime, I don't know what other osc e-storeowners are doing, I have had to shut down my e-store (disabled paypal), until I can resume providing upfront shipping costs during checkout.  Regardless, future api updates will most-likely periodically  keep breaking osc code (since api coders fail to adhere to standards) and will require periodic maintenance from osc php coders/developers, or repeatedly risk losing usps shipping functionality ...   Any help is appreciated.

While I can't say for the USPS Methods contribution since I have never used it, the USPS Rate V4 Intl Rate V2 - v.1.0 contribution is well-coded and only takes a few modifications to adjust it to the API updates made on January 27. The major change made was the renamed products for Parcel Post and First-Class Mail International Parcel. The only trick is that installing the currently available add-ons will invoke the old names AND writes those old names into your database. So you'll need to change the USPS products' names in both the module file and the database to the proper current USPS product names.

I'm pretty sure someone here mentions what fixes must be made: http://forums.oscommerce.com/topic/383307-usps-rate-v4-intl-rate-v2-official-support-thread/
It's just never been uploaded as a new/updated add-on.

I know these posts are in an osC 3.x forum for a osC 2.x add-on issue, but I sure hope this proves useful.

#11   kymation

kymation

    Believers

  • Community Sponsor
  • 6,694 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 09 April 2013 - 04:35 AM

The updated version of USPS Rate V4 Intl Rate V2 - v.1.0 is here. Despite what it says, it works just fine with the 2.3x versions of osC.

Regards
Jim
My Addons

Banners Box 2.3.x  Support
Categories Accordion Box 2.3.x  Support
Categories Images Box 2.2x  2.3.x  Support
Closest Shipper 2.2x  Support
Document Manager 2.2x  Support
Generic Box 2.3.x  Support
Get 1 Free 2.2x  Support
jQuery Banner Rotator 2.2x  2.3.x  Support
Modular Front Page 2.3.x  Support
Modular SEO Header Tags 2.3.x  Support
MVS 2.2x  Support
PDF Datasheet 2.3.x  Support
Price Updater 2.2x
Products Specifications 2.2x  2.3.x  Development Version  Support  Bugs/Suggestions
Request a Review 2.2x - 2.3.x  Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Theme Switcher 2.3.x  Support

#12   live

live
  • Members
  • 9 posts
  • Real Name:gc1
  • Gender:Male

Posted 09 April 2013 - 07:01 AM

I really like the drop-on-top USPS Rate V4 Intl Rate V2 add-on, please keep us posted, I will keep trying to Hunt down the mods for the January 27, 2013 changes, through the above forum link, ..., and try to figure out how to change the USPS products' names in both the module file and the database to the proper current USPS product names, while hoping these details and.or fix(es), surface here..  Although USPS Rate V4 Intl Rate V2 looks robust, I may have to settle for the usps methods add-on if, (if I can get it to work).  I am on 2.3.1 (which has security issue) and have to start fresh anyway (would prefer going forward 2.3.3 vs backward), since v3 is out of the question...But if necessary,  Jim says 2.3x works fine with USPS Rate V4 Intl Rate V2 - v.1.0.  My e-store is still down (manual invoices, yuck) This is just the beginning, wishlist is still usps, UPS, Fed-Ex, DHL, Less-stock Template with editable header, non-redirect home, super-dload,  Thx for all your help, replies and ideas.

#13   live

live
  • Members
  • 9 posts
  • Real Name:gc1
  • Gender:Male

Posted 09 April 2013 - 10:36 AM

All shipping options now show on checkout, selected all methods in shipping admin, then turned-off  un-needed methods.  ... USPS Rate V4 Intl Rate V2 works fine in 2.3.3, ... drop-on-top, as-is ... Jims posts with the api changes (mods for the January 27, 2013 changes, fixed), are also here:: http://www.kymation.com/pub/usps_1.7.1.tar.gz and lots of other great info: http://forums.oscommerce.com/topic/383307-usps-rate-v4-intl-rate-v2-official-support-thread/page__st__340#entry1661912, thx for all your great work and help

#14   live

live
  • Members
  • 9 posts
  • Real Name:gc1
  • Gender:Male

Posted 09 April 2013 - 01:20 PM

Also make sure usps acct is switched from test to production and is valid:
    Telephone:  1-800-344-7779 (7:00AM to 11:00PM ET) Email:  uspstechsupport@esecurecare.net

#15   jpettyc

jpettyc
  • Members
  • 6 posts
  • Real Name:Jason Petty
  • Gender:Male

Posted 09 April 2013 - 04:21 PM

It is working now that I have activated my user account to the production server for USPS.  Thanks Kevin!