I am using this extension for Extra Fees,
I did some override/rewritein this file in magento (app/code/local/Voronoy/ExtraFee/Model/Quote/Address/Total/Fee/Rule.php).
FYI -> The override/rewrite function working.
I just create Observer for this extension :
My observer :
app/etc/modules/Gta_ExtraFeesRemove.xml
<?xml version="1.0"?>
<config>
<modules>
<Gta_ExtraFeesRemove>
<active>true</active>
<codePool>local</codePool>
<depends>
<Voronoy_ExtraFee/>
</depends>
</Gta_ExtraFeesRemove>
</modules>
</config>
app/code/local/Gta/ExtraFeesRemove/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Gta_ExtraFeesRemove>
<version>0.1.0</version>
</Gta_ExtraFeesRemove>
</modules>
<global>
<models>
<voronoy_extrafee>
<rewrite>
<quote_address_total_fee_rule>Gta_ExtraFeesRemove_Model_Quote_AddressTotal_Fee_Rule</quote_address_total_fee_rule>
</rewrite>
</voronoy_extrafee>
</models>
</global>
</config>
app/code/local/Gta/ExtraFeesRemove/Model/Quote/AddressTotal/Fee/Rule.php
<?php
class Gta_ExtraFeesRemove_Model_Quote_AddressTotal_Fee_Rule extends Voronoy_ExtraFee_Model_Quote_Address_Total_Fee_Rule
{
/**
* Discount calculation object
*
* @var Mage_SalesRule_Model_Validator
*/
protected $_calculator;
/**
* Initialize discount collector
*/
public function __construct()
{
$this->_calculator = Mage::getSingleton('voronoy_extrafee/salesRule_validator');
}
/**
* @param Mage_Sales_Model_Quote_Address $address
*
* @return Mage_Sales_Model_Quote_Address_Total_Abstract
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
if (!Mage::helper('voronoy_extrafee')->isRuleExtraFeeEnabled()) {
return $this;
}
parent::collect($address);
$quote = $address->getQuote();
$shipping_method = $quote->getShippingAddress()->getShippingMethod();
$current_website = Mage::app()->getWebsite()->getId();
### log ###
Mage::log("ExtraFeesWebsite -".$current_website." website checking part");
### log ###
/* Flat Rate Condition Start*/
if ($shipping_method != 'flatrate' && $current_website != 2) :
$store = Mage::app()->getStore($quote->getStoreId());
$this->_calculator->reset($address);
$items = $this->_getAddressItems($address);
if (!count($items)) {
return $this;
}
### log ###
Mage::log("FlatRateCondition - ".$items."Flat Rate Condition ");
### log ###
$this->_calculator->init($store->getWebsiteId(), $quote->getCustomerGroupId(), $quote->getCouponCode());
$this->_calculator->initTotals($items, $address);
$items = $this->_calculator->sortItemsByPriority($items);
foreach ($items as $item) {
if ($item->getParentItemId()) {
continue;
}
if ($item->getHasChildren() && $item->isChildrenCalculated()) {
foreach ($item->getChildren() as $child) {
$this->_calculator->process($child);
$this->_addAmount($child->getExtraFeeRuleAmount());
$this->_addBaseAmount($child->getBaseExtraFeeRuleAmount());
}
} else {
$this->_calculator->process($item);
$this->_addAmount($item->getExtraFeeRuleAmount());
$this->_addBaseAmount($item->getBaseExtraFeeRuleAmount());
}
}
$this->_calculator->prepareDescription($address);
### log ###
Mage::log("FlatRateCondition - ".$items."Flat Rate Condition ");
### log ###
endif;
// / Flat Rate Condition End /
}
/**
* Fetch Totals
*
* @param Mage_Sales_Model_Quote_Address $address
*
* @return Voronoy_ExtraFee_Model_Quote_Address_Total_Fee_Rule
*/
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
if (!Mage::helper('voronoy_extrafee')->isRuleExtraFeeEnabled()) {
return $this;
}
$amount = $address->getExtraFeeRuleAmount();
if ($address->getExtraFeeRuleDescription()) {
$discountLabel = Mage::helper('voronoy_extrafee')->__(
'%s (%s)',
Mage::helper('voronoy_extrafee')->getExtraFeeRuleLabel(),
$address->getExtraFeeRuleDescription()
);
} else {
$discountLabel = Mage::helper('voronoy_extrafee')->getExtraFeeRuleLabel();
}
if ($amount > 0) {
$address->addTotal(array(
'code' => $this->getCode(),
'title' => $discountLabel,
'value' => $amount
));
}
return $this;
}
}
The observer for third party module not working.
FYI -> The changes in core working.
<model>Gta_ExtraFeesRemove_Model_Quote_AddressTotal_Fee_Rule</model>
to<rule>Gta_ExtraFeesRemove_Model_Quote_AddressTotal_Fee_Rule</rule>
. After that change please check. I hope it will help you.Voronoy_ExtraFee_Model_Quote_Address_Total_Fee_Rule
successfully override then you showing your die in that page.