Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Sorting USPS by price in Shipping Estimator

Sorting USPS by price in Shipping Estimator

Views: 1,105

Results 1 to 5 of 5
17 Dec 2011, 12:10 AM
#1
craig_hairston avatar

craig_hairston

New Zenner

Join Date:
Aug 2011
Posts:
46
Plugin Contributions:
0

Sorting USPS by price in Shipping Estimator

ZC 1.3.9h
First installed in June 2011
https://www.scplaceonline.com

While reading the sticky thread about USPS and UPS Beta, Ajeh provided a simple mod to sort UPS and USPS displayed rates by price. I entered the respective two line fixes into UPS.php and USPS.php respectively.

Cleared cashe and while testing on IE and Mozilla, UPS works fine, however, the order of the USPS available options has changed but are not sorted by price. Since other users have confirmed that the mod works, It seems I have something afoul. I'm a bit stumped since it was only two lines of code added into USPS.php. I've cleared, edited, and reloaded USPS.php three times in case there was a typing error. No change.

The shipping estimator with the sort by price mod displays the USPS options in this order.

United States Postal Service (1 x 0.30lbs)
$5.10
Parcel Post (4 - 7 days)

$5.10
Priority Mail (2 - 3 days)

$2.05
First-Class Mail (2 - 5 days)

$13.25
Express Mail (1 - 2 days)

Any thoughts as to what I might have set up goofy?

17 Dec 2011, 12:58 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Sorting USPS by price in Shipping Estimator

Only change I made to USPS around line 701 is:

//    return ((sizeof($rates) > 0) ? $rates : false);
    $result = array_reverse($rates);
    $rates = $result;
    return ((sizeof($rates) > 0) ? $rates : false);
20 Dec 2011, 8:23 PM
#3
craig_hairston avatar

craig_hairston

New Zenner

Join Date:
Aug 2011
Posts:
46
Plugin Contributions:
0

Re: Sorting USPS by price in Shipping Estimator

I could not find my sorting issue with the simple mod that works for everyone else so i went ahead and decided to bite the bullet and upgrade to Marco's
ZenCart USPS Shipping Module (RateV4 and IntlRateV2 API) because I need to optimize the shipping quotes to include size not just weight and thought it would kill two birds with one stone.

The install* seemed *to go fine. Deleted the usps jan2,2011C (usps.php), added the new usps.php(Marco's RateV4), added the new modules.php in admin, uninstalled the usps module in shipping modules, reinstalled it, loaded up the parameters including my USPS ID...no warning flags. In fact all the new options while editing the USPS module seem to indicate that the new files are working (all the new options appear).

The problem is - when running the Shipping Estimator, USPS does not show up.

I know to follow the instructions accurately, thought I did. Any clues as to why USPS does not appear as a shipping option?

20 Dec 2011, 11:07 PM
#4
craig_hairston avatar

craig_hairston

New Zenner

Join Date:
Aug 2011
Posts:
46
Plugin Contributions:
0

Re: Sorting USPS by price in Shipping Estimator

Got it working fine! If only this newbie would type with something other than my forehead. :frusty:

When reinstalling the USPS module, apparently it's important to type in your USPS ID code properly. :oops:

This mod works great and will allow us to tune the USPS shipping rates accurately to reflect the odd sizes and weights we have for our various products.

The USPS makes airline reservations look like childs play by comparison. And people wonder why they're on the verge of bankruptcy.

Thanks Ajeh for all your great work in sorting out one of the most complex and continuing issues presented by USPS. :clap:

20 Dec 2011, 11:25 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Sorting USPS by price in Shipping Estimator

Thanks for the update that you got this working properly ... :smile: