2

I'm looking for an extension or customization that allows me to cap a particular customer from ordering over a given amount. For example, a customer cannot checkout if their Order Total is beyond $500.

2

Magento have revered logic for minimum order amount for order place.

magento have managed from validateMinimumAmount function at class of Mage_Sales_Model_Quote_Address of object of sales address object.

If you have add here some logic then it would be fill you require.

so,Rewrite class of Mage_Sales_Model_Quote_Address using below signtex:

<sales>
    <rewrite>
        <quote_address>MymoduleNameSpace_Mymodelname_Model_Sales_Quote_Address</quote_address>
    </rewrite>
</sales>

rewrite class is MymoduleNameSpace_Mymodelname_Model_Sales_Quote_Address

<?php
class MymoduleNameSpace_Mymodelname_Model_Sales_Quote_Address extends Mage_Sales_Model_Quote_Address
{
    public function validateMinimumAmount()
    {

    $parentCheck=true;
    /* call default magento  validateMinimumAmount class */
    $parentCheck=parent::validateMinimumAmount();
    /*   i have put static amount */
    $amount=100000;
    if($parentCheck==true){
    /* check here you total cart  base subtotal amont is less then your $amout then you canot checkout */ 
        if ($this->getBaseSubtotalWithDiscount() < $amount) {
        return false;
        }
    }
    return $parentCheck;
    }
  • Thanks for your response. Can this be used to set a maximum order amount by customer? Or is it for all customers? – bonannju Oct 15 '14 at 17:35
  • 1
    It is for all customers. – Fabian Blechschmidt Jul 17 '15 at 6:53
  • Yes,Fabian.I got mistake. I will update it today.Thanks for your feedbackup – Amit Bera Jul 17 '15 at 6:55
1

Amit has a good start. To have it only for one customer, you need to get the amount from a customer, so here is the way:

  1. create a new customer attribute
  2. use this instead of a hard coded amount:

    $amount=$this->getOrder()->getCustomer()->getMaxAmount();
    

should work for a new attribute max_amount

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.