I have integrated an extension which rewards some Credit Points to the customer when they return any product. These points are only assigned from backend.

Now, the customer can use this Credit Points during any purchase. But in case if the Order Grand Total exceeds the Credit Limit, then the customer is forced to choose some other mode of payment.

But instead, I want to convert these Credit Points into Discount Coupon and allow the customer to place the order. How can I implement this??

Any help will be appreciated. I am using the following extension: http://www.magentocommerce.com/magento-connect/credit-point-payment-4321.html

1 Answer 1


I think you are creating your module and you have to give discount as a coupons code.

find in your module NameSpace/ModuleName/Model/Quote/Address/Total/Discount.php File or you can find this file in Mage/core Folder.Find the below method in that.

public function collect(Mage_Sales_Model_Quote_Address $address)
     parent :: collect($address);
     $items = $this->_getAddressItems($address);
     if (!count($items)) {
        return $this;
     $quote= $address->getQuote();

     //amount definition
     You have to give discount as a coupons so you have to create one method in your 
     data.php file and called as below.in that file you have to create the logic for 
     the coupen and assign hear it will add to your Total. 
     $discountAmount =  Mage::helper('creditpoints')->calculateDiscount();

     //amount definition
     $discountAmount = $quote -> getStore() -> roundPrice($discountAmount);
     $this -> _setAmount($discountAmount) -> _setBaseAmount($discountAmount);

     return $this;
  • Alright.. thanks that was helpful. 1 step ahead!! :)
    – Helly
    Dec 16, 2013 at 13:33
  • my pleasure :) :)
    – Keyul Shah
    Dec 16, 2013 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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