Search code examples
phpmagentocoupon

Magento coupon discount


I am setting up magento store which buy stuff from customers. Instead of decreasing Price of the product, I want to increase the price of the product using coupon code. in which file i need to make changes for this.

Update 1:

Thanks Amit. I have another question. I like to change "Discount" to "Promotion" in cart and onepage checkout. However, I can't find any file location. I have turn on the Template Path Hints from Configuration. Can anyone help me out ?


Solution

  • If you need only fixed amount discount, then you can remove the validate for Discount Amount field so that you can add negative value in this field, so when you try to apply this coupon it will automatically add that amount instead to decrease. So you need to override below two classes.

    For more details on Magento override see this Link.

    Mage_Adminhtml_Block_Promo_Quote_Edit_Tab_Actions 
    

    find this code

    $fieldset->addField('discount_amount', 'text', array(
                'name' => 'discount_amount',
                'required' => true,
                'class' => 'validate-not-negative-number',
                'label' => Mage::helper('salesrule')->__('Discount Amount'),
            ));
    

    and change it to

    $fieldset->addField('discount_amount', 'text', array(
                'name' => 'discount_amount',
                'required' => true,
                'label' => Mage::helper('salesrule')->__('Discount Amount'),
            ));
    

    and remove the below code

    if ($this->hasDiscountAmount()) {
                if ((int)$this->getDiscountAmount() < 0) {
                    Mage::throwException(Mage::helper('rule')->__('Invalid discount amount.'));
                }
            }
    

    from

    Mage_Rule_Model_Abstract::_beforeSave()