Reputation:
On the review order page in onepage checkout in magento I want to shorten the "Shipping & Handling (Flat Rate - Fixed)" text (see http://d.pr/AAlb). I want it to just read "Shipping & Handling" and remove the carrier/delivery type written in brackets
How can I do that? It's rendered with $this->renderTotals(null, $_colspan);
, which gives me shipping cost+sub total. I don't know where to start from here.
Upvotes: 0
Views: 2484
Reputation: 4321
Here is an implementation that I have done. This is a standard override (http://inchoo.net/ecommerce/magento/how_to_override_magento_model_classes/). I did it this way so as to not get too deep into the overriding system.
class Your_Company_Model_Address_Total_Shipping extends Mage_Sales_Model_Quote_Address_Total_Shipping
{
/**
* Collect totals information about shipping
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_Sales_Model_Quote_Address_Total_Shipping
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
parent::collect($address);
$method = $address->getShippingMethod();
if ($method) {
foreach ($address->getAllShippingRates() as $rate) {
if ($rate->getCode()==$method) {
$shippingDescription = $rate->getMethodTitle();
if (stripos($shippingDescription, ",") > -1)
$shippingDescription = substr($shippingDescription, 0, stripos($shippingDescription, ","));
$address->setShippingDescription(trim($shippingDescription, ' -'));
break;
}
}
}
return $this;
}
}
Upvotes: 1