override USPS shipping method name

The question:

This is a follow-up of sorts to : shipping method name alias.

The issues I found:
1) the translate.csv works like a charm for UPS shipping. it does NOT work for USPS
2) the change to
escapeHtml($_rate->getMethodTitle()) ?>

works fine, but you have to do it in 14 different locations, thus making maintenance a nightmare.
3) the change suggested in the thread will only affect what is displayed on the screen, not what is in the DB, ergo, not what is emailed to the clients, or exported in reports, etc

what I really want to do is override the value upstream, after the response from USPS is received, before it gets consumed by the application and have that updated value in the database.

I’m wondering if the below, found in app/code/core/Mage/Sales/Model/Quote/Address/Rate.php would be a good place to do it.

public function importShippingRate(Mage_Shipping_Model_Rate_Result_Abstract $rate)
    if ($rate instanceof Mage_Shipping_Model_Rate_Result_Error) {
    } elseif ($rate instanceof Mage_Shipping_Model_Rate_Result_Method) {
    return $this;

Also, I think that once I use a standardized text, then the translate.csv actually does become active, but that’s secondary.

Thanks !

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

Please replace




And add appropriate translations into the Mage_Shipping.csv file.

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment