MSP Cash On Delivery charges not add in the grand total Magento
Go to app\code\community\MSP\CashOnDelivery\Model\Quote\Total.php and overwrite the below two function...
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$_helper = Mage::helper('msp_cashondelivery');
if (!$_helper->getSession()->getQuoteId()) return $this;
parent::collect($address);
$_model = Mage::getModel('msp_cashondelivery/cashondelivery');
$quote = $address->getQuote();
$baseAmount = $_model->getBaseExtraFee();
$amount = $_model->getExtraFee();
$baseAmountInclTax = $_model->getBaseExtraFeeInclTax();
$amountInclTax = $_model->getExtraFeeInclTax();
$data = Mage::app()->getRequest()->getPost('payment', array());
if (
($data['method'] == $_model->getCode()) &&
($address->getAddressType() == Mage_Sales_Model_Quote_Address::TYPE_SHIPPING)
) {
$address->setGrandTotal($address->getGrandTotal() + $amount);
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $baseAmount);
$address->setMspCashondelivery($amount);
$address->setMspBaseCashondelivery($baseAmount);
$address->setMspCashondeliveryInclTax($amountInclTax);
$address->setMspBaseCashondeliveryInclTax($baseAmountInclTax);
$quote->setMspCashondelivery($amount);
$quote->setMspBaseCashondelivery($baseAmount);
$quote->setMspCashondeliveryInclTax($amountInclTax);
$quote->setMspBaseCashondeliveryInclTax($baseAmountInclTax);
}
return $this;
}
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$_helper = Mage::helper('msp_cashondelivery');
if (!$_helper->getSession()->getQuoteId()) return $this;
parent::fetch($address);
$_model = Mage::getModel('msp_cashondelivery/cashondelivery');
$amount = $_model->getExtraFeeForTotal();
$data = Mage::app()->getRequest()->getPost('payment', array());
if ($amount > 0 &&
($data['method'] == $_model->getCode()) &&
($address->getAddressType() == Mage_Sales_Model_Quote_Address::TYPE_SHIPPING)
) {
$address->addTotal(array(
'code' => $_model->getCode(),
'title' => $_helper->__('Cash On Delivery'),
'value' => $amount,
));
}
return $this;
}