0

I want to add some Cash on delivery charges in my magento 1.9.3.2 website. Which can be automatically added in bill in onepage checkout page and also in invoice. I do not want to add any extension.

Kindly help me out form this.

Than in advance.

0

Magento default dont support this feature..... you can try this github code :

https://github.com/yvoronoy/magento-extension-extra-fee

here is sample code

class Voronoy_ExtraFee_Block_Sales_Order_Totals_Rule extends Mage_Core_Block_Abstract
{
    /**
     * Get Source Model
     *
     * @return mixed
     */
    public function getSource()
    {
        return $this->getParentBlock()->getSource();
    }

    /**
     * Add this total to parent
     */
    public function initTotals()
    {
        if ((float) $this->getSource()->getExtraFeeRuleAmount() <= 0) {
            return $this;
        }
        if ($this->getSource()->getExtraFeeRuleDescription()) {
            $discountLabel = $this->__('%s (%s)', Mage::helper('voronoy_extrafee')->getExtraFeeRuleLabel(),
                $this->getSource()->getExtraFeeRuleDescription());
        } else {
            $discountLabel = Mage::helper('voronoy_extrafee')->getExtraFeeRuleLabel();
        }
        $total = new Varien_Object(array(
            'code'  => 'extra_fee_rule',
            'field' => 'extra_fee_rule_amount',
            'value' => $this->getSource()->getExtraFeeRuleAmount(),
            'label' => $discountLabel
        ));
        $this->getParentBlock()->addTotalBefore($total, 'grand_total');
        return $this;
    }
}
  • i am unable to put this code because it has used many other classes which i have not used in my magento. can you please tell me only those code which can exactly add the charges in the COD – Gauri Shankar Prajapati Aug 18 '17 at 17:32
  • @GauriShankarPrajapati sorry, i dont know.... – Baby in Magento Aug 21 '17 at 5:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.