keenanj Posted April 4, 2012 Share Posted April 4, 2012 Is anyone working on modifying the usps.php to work with rate v4 on OCS 2.2? I tried the USPS methods contrib and its a no go. I just need basic usps shipping for priority and express and like many i have a highly modified v2.2 over 10 years of tweaks Quote Link to comment Share on other sites More sharing options...
Guest Posted April 5, 2012 Share Posted April 5, 2012 http://addons.oscommerce.com/info/8327 The contrib found here will work on a 2.2 shop. There's just a few little differences between the 2.2 and 2.3.1 code that you'll need to catch to get it working right (admin/modules.php comes to mind). The simplest version is at the bottom, with added features as you go higher up. If you choose one with most of the features, then skip the modifications to the checkout_shipping file and it's associated language file, unless you have jquery installed in your shop (which is a standard part of 2.3.1). Quote Link to comment Share on other sites More sharing options...
keenanj Posted April 5, 2012 Author Share Posted April 5, 2012 (edited) I i try to enable the module I get the following error in the admin Warning: call_user_func(tep_get_zone_class_title) [function.call-user-func]: First argument is expected to be a valid callback in /home/content/k/e/e/keenanj/html/store/catalog/admin/includes/functions/general.php on line 1229 and this one in the user interface Fatal error: Cannot instantiate non-existent class: httpclient in /home/content/k/e/e/keenanj/html/store/catalog/includes/modules/shipping/usps.php on line 303 Edited April 5, 2012 by keenanj Quote Link to comment Share on other sites More sharing options...
keenanj Posted April 5, 2012 Author Share Posted April 5, 2012 all i really need to do is modify _usps.php section for the new api function getPrice() { $str = '<RateRequest USERID="' . $this->user . '" PASSWORD="' . $this->pass . '">'; $str .= '<Package ID="0">'; $str .= '<Service>' . $this->service . '</Service>'; $str .= '<ZipOrigination>' . $this->orig_zip . '</ZipOrigination>'; $str .= '<ZipDestination>' . $this->dest_zip . '</ZipDestination>'; $str .= '<Pounds>' . $this->pounds . '</Pounds>'; $str .= '<Ounces>' . $this->ounces . '</Ounces>'; $str .= '<Container>' . $this->container . '</Container>'; $str .= '<Size>' . $this->size . '</Size>'; $str .= '<Machinable>' . $this->machinable . '</Machinable>'; $str .= '</Package>'; $str .= '</RateRequest>'; $str = $this->server . '?API=Rate&XML=' . urlencode($str); Quote Link to comment Share on other sites More sharing options...
keenanj Posted April 5, 2012 Author Share Posted April 5, 2012 (edited) I got usps module for OCS2.2 working with postal service v4 API This took me 2 days of work. all you need to do is modify the catalog/includes/classes/_usps.php with this section of code function getPrice() { $str = '<RateV4Request USERID="' . $this->user . '">'; $str .= '<Revision/>'; $str .= '<Package ID="0">'; $str .= '<Service>' . $this->service . '</Service>'; $str .= '<ZipOrigination>' . $this->orig_zip . '</ZipOrigination>'; $str .= '<ZipDestination>' . $this->dest_zip . '</ZipDestination>'; $str .= '<Pounds>' . $this->pounds . '</Pounds>'; $str .= '<Ounces>' . $this->ounces . '</Ounces>'; $str .= '<Container/>'; $str .= '<Size>' . $this->size . '</Size>'; $str .= '<Machinable>' . $this->machinable . '</Machinable>'; $str .= '</Package>'; $str .= '</RateV4Request>'; $str = $this->server . '?API=RateV4&XML=' . urlencode($str); $fp = fopen($str, "r"); if (!$fp) { $body = 'Connection Failed'; } else { while(!feof($fp)){ $result = fgets($fp, 500); $body.=$result; } fclose($fp); } if (ereg("<Rate>", $body)) { $split = split("<Rate>", $body); $body = split("</Rate>", $split[1]); $price = $body[0]; return($price); } else { return($body); } Edited May 11, 2012 by Jan Zonjee Quote Link to comment Share on other sites More sharing options...
NoelCat Posted April 13, 2012 Share Posted April 13, 2012 Hi Jeff : Am I ADDING the above code somewhere, or replacing some that is already there ? I've been using OSC for over 10 years and almost never have to do any programming; so I'm not so good at it. For those of us who only need a very simplistic checkout system, OSC really fits the bill ! I see in my original usps.php file (from OSC2.2) that there is some similar language about halfway down so I'm guessing I might start replacing there; but cannot see a similar place to end the new code. Thanks for any input you could provide. Quote Link to comment Share on other sites More sharing options...
pfilias Posted April 24, 2012 Share Posted April 24, 2012 (edited) @@fulluvscents How do I update the language? My client needs USPS to show up as USPS Parcel Post in their orders, for example. I tried to edit the usps.php file and reinstall. I tried to edit just the db entries. Neither of those worked, rendering the entire module broken and not showing up when checking out. Any help would be appreciated. Edited April 24, 2012 by pfilias Quote Link to comment Share on other sites More sharing options...
pfilias Posted April 25, 2012 Share Posted April 25, 2012 No help?? Quote Link to comment Share on other sites More sharing options...
Guest Posted April 26, 2012 Share Posted April 26, 2012 @@pfilias You modify the languages in the language files. You CANNOT modify the names of the shipping methods. They have to match USPS names. Quote Link to comment Share on other sites More sharing options...
geomilli Posted May 10, 2012 Share Posted May 10, 2012 Here's the debate... Use http://addons.oscommerce.com/info/8327 or http://addons.oscommerce.com/info/8403? I personally tried 8403 to the letter and all I get a blank page for checkout_shipping... However, the weight of the product displays when I moved up into the other upgrades. Curious... The min/max/handing dialog goes wacky, perhaps a database issue? I check one of the shipping methods and return to check it, and all I get is a minimum "Parcel Post" and the 70lbs. max jumps to the handling. Any ideas? Quote Link to comment Share on other sites More sharing options...
geomilli Posted May 10, 2012 Share Posted May 10, 2012 OK, maybe Jetta can help here... I use Uniform Server to beta test my site before going live. I used http://addons.oscommerce.com/info/8403 to update the USPS functions and the above occurred in my last post. So, I figured I would go with a live swap out of the files and test it from there (what the heck!)... It works. Don't know why, other than that's a good thing. My provider actually has a older version of PHP running than my version in Uniform Server and MySQL is only a fraction of a version out from each other. I don't see that being the issue. Just thought I would post this little tip to help those that might be trying to resolve their install. Quote Link to comment Share on other sites More sharing options...
jondaley Posted May 11, 2012 Share Posted May 11, 2012 I had the same problem as some others here, with the httpclient class not being found. I got the error when getting the postback from paypal to the express.php file. I added in an include line, following the advice from: http://www.oscommercecoders.com/fatal-error-class-httpclient-not-found-in-homexxxxxxxpublic_htmlmyshopincludesmodulesshippingups-php-on-line-265/ and now things seem to be happy. Quote Link to comment Share on other sites More sharing options...
hostricity Posted May 16, 2012 Share Posted May 16, 2012 Your module installed beautifully with no problems. Thank You! Now, I do have a couple of questions: 1. Priority Mail International Flat Rate SMALL BOX does not display. It works fine with Domestic Priority Mail Flat Rate small box. I also tested to verify it is not dependent on country to make sure it wasn't a problem with a particular country. It may have displayed and stopped working when I switched between Retail and Online. Are there any configuration fields in the database that may have gotten screwed up or corrupted by changing between Retail and Online and back? I also played with product dimensions and weights, but that has no effect. I did uninstall usps.php and redid the configuration, but that did not help. - Which is why I am wondering about configuration fields in the database. NOTE: The module installed WITHOUT any changes, so it isn't a typo in the module itself unless it's in the distribution. 2. Is there any provision in this module for handling product / shipping dimensions? If not, any clever ways to handle them? 3. It appears that the estimated delivery time is returned and I just need to modify my site to display the time estimate. Is that correct? 4. If you want to place a test order to see what I am talking about, feel free to do so. You will see the problem before you are asked to pay. https://xeonixinc.com Thanks in advance for any guidance you might offer. Quote Link to comment Share on other sites More sharing options...
hostricity Posted May 16, 2012 Share Posted May 16, 2012 OOPs - I typed the domain name incorrectly in my post about Priority Mail International Small Flat Rate Box: https://www.xeonixinc.com/ (I know, there's a configuration error that makes it not work without www. I'm taking care of it! Quote Link to comment Share on other sites More sharing options...
beuki Posted October 25, 2012 Share Posted October 25, 2012 (edited) First off, Thank you - I could not dream of writing such an amazing module, and the fact I'm having a problem installing it has no bearing on my gratitude for the hard work that went into developing it. I am running osc 2.3 , and have installed : USPS Rates ServerV4 (for osc2.2) I didn't realize I was running 2.3 and not 2.2 at the time of install. I followed all the instructions, modified the required files, then added the new ones. I've received my User ID and Password from USPS -- turned around and emailed them back asking to move me to production, which they did. I verified the url they sent me, and it matches yours. Problem is - I go into the admin screen, edit the module, select the services, place min and max values, click save -- and nothing is saved. as a result, obviously, no shipping methods are displayed. Any chance someone knows how to fix this problem? Thank you in advance for any suggestions. **as an added note, i do not have a /includes/classes/_usps.php file - If I need it, where do I get it from - it wasn't included in the download that I can see. - Thank you again. Edited October 25, 2012 by beuki Quote 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.