imagixx Posted March 21, 2012 Share Posted March 21, 2012 Fixing 2 digit state. Add below //directory where all support files are //Gets the return & billing address two digit state code $shipping_zone_query = tep_db_query("select z.zone_code from " . TABLE_ZONES . " z, " . TABLE_COUNTRIES . " c where zone_name = '" . $order->delivery['state'] . "' AND c.countries_name = '" . $order->delivery['country'] . "' AND c.countries_id = z.zone_country_id"); $shipping_zone = tep_db_fetch_array($shipping_zone_query); $shipping_zone_code = ($shipping_zone['zone_code'] == '' ? $order->delivery['state'] : $shipping_zone['zone_code']); // if the query result was empty, then use the state name if ($order->billing['state'] == $order->delivery['state']) { // if billing and shipping states are the same, then we can save a query $billing_zone_code = $shipping_zone_code; } else { $billing_zone_query = tep_db_query("select z.zone_code from " . TABLE_ZONES . " z, " . TABLE_COUNTRIES . " c where z.zone_name = '" . $order->billing['state'] . "' AND c.countries_name = '" . $order->billing['country'] . "' AND c.countries_id = z.zone_country_id"); $billing_zone = tep_db_fetch_array($billing_zone_query); $billing_zone_code = ($billing_zone['zone_code'] == '' ? $order->billing['state'] : $billing_zone['zone_code']); // if the query result was empty, then use the state name } Replace <input type="hidden" name="form.deliveryState" value= "<?php echo $order->delivery['state'];?>" id="stateTo"> With //State <input type="hidden" name="form.deliveryState" value= "<?php echo $shipping_zone_code;?>" id="stateTo"> I haven't figured out the result if country is not us. But this fixes the immediate problem. Quote Link to comment Share on other sites More sharing options...
imagixx Posted March 21, 2012 Share Posted March 21, 2012 OK, State fixed. (may need changfes for non-US country). new usps_ship.php file is available for download at: http://www.oscommerce.com/community/contributions,1498 It works, but the file should be really cleaned up by someone who really knows whgat they're doing. Quote Link to comment Share on other sites More sharing options...
vjwebb Posted March 21, 2012 Share Posted March 21, 2012 I have it working although it is not picking up my Company Name (it used to). I think the problem may be that my USPS account is personal and not business. I have sent them an email asking how to fix the problem. I can go into edit mode after the fields are filled in and add the name but that is time consuming. At least I don't have to enter the shipping address. I would like to thank everyone for all the hard work. I still can't believe that our tax dollars are being used to change the shipping page into a frilly hard to read page. No wonder the post office is losing money. Quote -- A ship in a harbor is safe, but that is not a ships ultimate purpose. Link to comment Share on other sites More sharing options...
vjwebb Posted March 21, 2012 Share Posted March 21, 2012 Just in case anyone else is having a problem with company name. I fixed the company name. I set up a new account with USPS that is flagged as business and it let me add a Company Name. The old version of usps_php picked up the return address values from the configuration file. The new version is using the info on the USPS account. Quote -- A ship in a harbor is safe, but that is not a ships ultimate purpose. Link to comment Share on other sites More sharing options...
Ghost0 Posted March 22, 2012 Share Posted March 22, 2012 Hello all, new to this forum and had the same issue that the OP had with our OSC site. I had our web developer help us and this is the fix he came up with. We are using zone rates so some of the previous posters may be using a different code. It sure was a PITA no thanks to USPS.USPS Fix for OSCommerce.txt Quote Link to comment Share on other sites More sharing options...
fqstore Posted March 22, 2012 Share Posted March 22, 2012 Wow, I am not live on the web. I was considering using this module but I think I will just use click and ship and Paypal. Easy enough for me. The only drawback to Paypal is the service charge. But it is worth not having the headaches. Quote Link to comment Share on other sites More sharing options...
imagixx Posted March 22, 2012 Share Posted March 22, 2012 Actually, it works like a charm. The change was required by a USPS design change. Quote Link to comment Share on other sites More sharing options...
krdito Posted March 22, 2012 Share Posted March 22, 2012 Thanks to all who worked on this fix! Your efforts are greatly appreciated! Quote Link to comment Share on other sites More sharing options...
apache510 Posted March 22, 2012 Share Posted March 22, 2012 I downloaded the update and everything works except the first and last name in the delivery address is not being populated. At least I have all the other information going through. Anyone have a fix for this? Quote Link to comment Share on other sites More sharing options...
vjwebb Posted March 22, 2012 Share Posted March 22, 2012 I downloaded the update and everything works except the first and last name in the delivery address is not being populated. At least I have all the other information going through. Anyone have a fix for this? around line 149 in usps_ship.php find: $arr = explode(" ", $order->customer['name'], 2); And replace it with this: $arr = explode(" ", $order->delivery['name'], 2); It was using the customer name instead of the delivery name. If they are the same, you don't see the problem. Thanks for the catch. Quote -- A ship in a harbor is safe, but that is not a ships ultimate purpose. Link to comment Share on other sites More sharing options...
apache510 Posted March 22, 2012 Share Posted March 22, 2012 Tried it but still no first or last name sent to the form. Here is what I have in that area: $arr = explode(" ", $order->delivery['name'], 2); $myFirstName = $arr[0]; $myLastName = $arr[1]; $myFirstName = ucfirst(strtolower($myFirstName)); if(strlen($myFirstName) < 3 ){ $myFirstName = substr($order->customer['name'], 0, strrpos( $order->customer['name'], ' ') ); } everything else is exported to the USPS form correctly. Quote Link to comment Share on other sites More sharing options...
apache510 Posted March 22, 2012 Share Posted March 22, 2012 Here is a bit more code where I think the problem is. <? $arr = explode(" ", $order->delivery['name'], 2); $myFirstName = $arr[0]; $myLastName = $arr[1]; $myFirstName = ucfirst(strtolower($myFirstName)); if(strlen($myFirstName) < 3 ){ $myFirstName = substr($order->customer['name'], 0, strrpos( $order->customer['name'], ' ') ); } ?> <input type="hidden" name="form.deliveryFirstName" value="<?php echo $myFirstName; ?>" id="tNameFirstTo"> <input type="hidden" name="form.deliveryLastName" value="<?php echo $myLastName; ?>" id="tNameLastTo"> <input type="hidden" name="form.deliveryCompanyName" value="<?php echo $order->delivery['company']; ?>" id="tCompanyTo"> <input type="hidden" name="form.deliveryAddressOne" value="<?php echo $order->delivery['street_address']; ?>" id="tAddress1To"> <input type="hidden" name="form.deliveryAddressTwo" value="<?php echo $order->delivery['suburb']; ?>" id="tAddress2To"> <input type="hidden" name="form.deliveryCity" value="<?php echo $order->delivery['city']; ?>" id="tCityTo"> Quote Link to comment Share on other sites More sharing options...
apache510 Posted March 22, 2012 Share Posted March 22, 2012 Ignore the above two post from me. The problem is with my test server. It works perfectly with my live site. Not sure why the difference. Quote Link to comment Share on other sites More sharing options...
dkinzer Posted March 28, 2012 Share Posted March 28, 2012 It works perfectly with my live site. Not sure why the difference. For rare cases, you'll also need to make this change, too: // change this $myFirstName = substr($order->customer['name'], 0, strrpos( $order->customer['name'], ' ') ); // to this $myFirstName = substr($order->delivery['name'], 0, strrpos( $order->delivery['name'], ' ') ); Quote Don Portland, OR USA Link to comment Share on other sites More sharing options...
dkinzer Posted March 29, 2012 Share Posted March 29, 2012 I changed the code for handling short first names like "J. Robert Fox". The existing code generated "J. Robert" for the first name and "Robert Fox" for the last name. Around line 158: $arr = explode(" ", $order->delivery['name'], 2); $myFirstName = $arr[0]; $myLastName = $arr[1]; $myFirstName = ucfirst(strtolower($myFirstName)); if (strlen($myFirstName) < 3 ){ // short first name, see if last name has multiple parts $arr = explode(" ", $myLastName, 2); if (strlen($arr[1])) { $myFirstName .= ' ' . $arr[0]; $myLastName = $arr[1]; } } Even this code, however, isn't going to work well with a name like "J. Roberts Jr." but I'm not going to fuss with it any more right now. Quote Don Portland, OR USA Link to comment Share on other sites More sharing options...
IWAS Posted January 27, 2014 Share Posted January 27, 2014 (edited) USPS click and ship changed their site again now no values are getting passed to the shipping form on their site, are there any updates to this add-on known? http://addons.oscommerce.com/info/1498 Edited January 27, 2014 by IWAS Quote Link to comment Share on other sites More sharing options...
WESK Posted January 27, 2014 Share Posted January 27, 2014 Im so tired of them "updating" their site and having everything break!!! Ahhh!! They really changed this form this time...Solutions? Quote Link to comment Share on other sites More sharing options...
IWAS Posted January 28, 2014 Share Posted January 28, 2014 This was in the email they sent. https://www.usps.com/business/web-tools-apis/2014-january-webtools-release-notes.pdf Quote Link to comment Share on other sites More sharing options...
getflocked Posted January 28, 2014 Share Posted January 28, 2014 Ah, just when I thought that all was okay with the latest USPS update... Labels export is not working so I'm back to copy/paste of customer/shipping information. We ship international packages a lot and the USPS has now created dropdown lists for foreign postal codes and many codes are missing. The only way around this is now to create the label selecting an incorrect postal code and then edit the label on the USPS website. While in the edit screen, the pulldown postal code field becomes a text field so I can enter the correct postal code. Why oh why is it that the USPS can never make things easier?? I hope someone comes up with a fix for the USPS label module soon. Quote Link to comment Share on other sites More sharing options...
IWAS Posted January 28, 2014 Share Posted January 28, 2014 I import my orders into paypal multi-order shipping on days when I have a bunch (doesn't work for international orders) but the days I only have a few priority mail shippables this was the perfect solution. Maybe when I get back from vacation I'll take a look at it, but someone that is more fluent in this module could probably do it better and definitely faster. Quote Link to comment Share on other sites More sharing options...
WESK Posted January 28, 2014 Share Posted January 28, 2014 Since Autofill is not working I have been using the MultiCopy addon available for FireFox....Great tool Saves a lot of copy paste time! https://addons.mozilla.org/en-US/firefox/addon/multicopy/ Quote Link to comment Share on other sites More sharing options...
IWAS Posted January 28, 2014 Share Posted January 28, 2014 I tried using the new USPS page just typing an address in and it would not let me go to the next page, WTF. Maybe it was just firefox will try another browser later. Quote Link to comment Share on other sites More sharing options...
Soundman01 Posted January 30, 2014 Share Posted January 30, 2014 That new postal page is terrible, I emailed USPS to complain, but that is long shot. I've been fiddling with this contribution trying to get it going again (I made the last change last year) but USPS made some drastic changes this time. Hopefully someone with more experience will jump on this and help all of us out. Quote Link to comment Share on other sites More sharing options...
IWAS Posted January 30, 2014 Share Posted January 30, 2014 I shot them an email too. Typical government, trying to make it easier for consumers (which they didn't) screw their business customers that provide more revenue. :D Quote Link to comment Share on other sites More sharing options...
Roaddoctor Posted February 12, 2014 Share Posted February 12, 2014 USPS never sanctioned POSTing to their site as this addon did, they simply no longer accept POST'd data. Unfortunately a different solution will need to be created. Quote -Dave Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.