0

I have requirement like this.

there are two types of customer groups (retailer,distributor). If retailer want to buy any products he need to pay.

Where as distributor contain some credit for example $100.

So he can place the order with in that limit.

My thinking for this : Step1:create custom attribute credit_limit to customer account.

step2:create custom payment method called distributor credit payment.

step3:Validate the credit limit through override following method in Mage_Payment_Model_Method_Abstract class

public function canOrder()
    {
        return $this->_canOrder;
    }

or

 public function isAvailable($quote = null)
    {
        $checkResult = new StdClass;
        $isActive = (bool)(int)$this->getConfigData('active', $quote ? $quote->getStoreId() : null);
        $checkResult->isAvailable = $isActive;
        $checkResult->isDeniedInConfig = !$isActive; // for future use in observers
        Mage::dispatchEvent('payment_method_is_active', array(
            'result'          => $checkResult,
            'method_instance' => $this,
            'quote'           => $quote,
        ));

        if ($checkResult->isAvailable && $quote) {
            $checkResult->isAvailable = $this->isApplicableToQuote($quote, self::CHECK_RECURRING_PROFILES);
        }
        return $checkResult->isAvailable;
    }

step4:after placing the order update credit_limit for customer by observer.

Is it right direction? step3 which method i need to override? any simple way is there? Thanks in advance.

  • Are there any other methods allowed for the distributor to checkout if he is over $100? – Detzler Oct 25 '14 at 11:08
  • yes allowed like credit card etc. – sivakumar Oct 25 '14 at 11:08
1

This solution sounds good (isAvailable). But don't forget to implement step5. After raising the ordered value in the credit limit attribute, you need to reset it periodicaly. I guess once per month?

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.