I try to change the shipping total title in the checkout review table. I have found where the label text is constructed,Mage_Sales_Model_Quote_Address_Total_Shipping::fetch()
method is where I want to override the text, the method looks like this:
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$amount = $address->getShippingAmount();
if ($amount != 0 || $address->getShippingDescription()) {
$title = Mage::helper('sales')->__('Shipping & Handling');
/** the following if block is what I want to remove as I don't want
* extra text in the parenthesis
*/
if ($address->getShippingDescription()) {
$title .= ' (' . $address->getShippingDescription() . ')';
}
$address->addTotal(array(
'code' => $this->getCode(),
'title' => $title,
'value' => $address->getShippingAmount()
));
}
return $this;
}
Please notice my comment in above code, I try to do it by overriding the class in my local directory, I have done it many times to other model classes, never had a problem, but I am stuck at this one...
My module config.xml (app/code/local/MyCompany/Sales/etc/config.xml
)
<?xml version="1.0"?>
<config>
<modules>
<MyCompany_Sales>
<version>0.1</version>
</MyCompany_Sales>
</modules>
<global>
<models>
<sales>
<rewrite>
<quote_address_total_shipping>MyCompany_Sales_Model_Quote_Address_Total_Shipping</quote_address_total_shipping>
</rewrite>
</sales>
</models>
</global>
</config>
app/etc/modules/MyCompany_Sales.xml
<?xml version="1.0"?>
<config>
<modules>
<MyCompany_Sales>
<active>true</active>
<codepool>local</codepool>
</MyCompany_Sales>
</modules>
</config>
My own model class file: (app/code/local/MyCompany/Sales/Model/Quote/Address/Total/Shipping.php
)
class MyCompany_Sales_Model_Quote_Address_Total_Shipping extends Mage_Sales_Model_Quote_Address_Total_Shipping
{
/**
* Override to get rid of text between parenthesis
*/
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$amount = $address->getShippingAmount();
if ($amount != 0 || $address->getShippingDescription()) {
$title = Mage::helper('sales')->__('Shipping & Handling');
$address->addTotal(array(
'code' => $this->getCode(),
'title' => $title,
'value' => $address->getShippingAmount()
));
}
return $this;
}
}
Please help! I am running out of ideas. I reaaaly don't want to make changes to core files.
Many thanks!