Reputation: 1869
Here's the scenario.
For first time order, the minimum amount needs to be more that $1000 in order to check out.
When customer wants to reorder, the minimum amount needs to be more than $500 in order to checkout.
In each time, it allowed order which have more than $1000 only
How can I fix this?
Thanks
Upvotes: 0
Views: 271
Reputation: 17656
You could also disable How to set minimum purchase order amount.
Then implement your own logic see Magento Maximum Allowed Order Amount
class Inchoo_MaxOrderAmount_Model_Observer
{
private $_helper;
public function __construct()
{
$this->_helper = Mage::helper('inchoo_maxorderamount');
}
public function enforceSingleOrderLimit($observer)
{
if (!$this->_helper->isModuleEnabled()) {
return;
}
$quote = $observer->getEvent()->getQuote();
/*
check to see if order greater than minimum amount
or has a previous and current amount > 500
*/
if ((float)$quote->getGrandTotal() < (float)$this->_helper->getSingleOrderMinAmount() || (has Previous Order && $quote->getGrandTotal() > 500)) {
$formattedPrice = Mage::helper('core')->currency($this->_helper->getSingleOrderTopAmount(), true, false);
Mage::getSingleton('checkout/session')->addError(
$this->_helper->__($this->_helper->getSingleOrderTopAmountMsg(), $formattedPrice));
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
Mage::app()->getResponse()->sendResponse();
exit;
}
}
}
Upvotes: 0
Reputation: 17656
To accomplish this you could rewrite Mage_Sales_Model_Quote
/app/code/core/Mage/Sales/Model/Quote.php
public function validateMinimumAmount($multishipping = false)
{
$storeId = $this->getStoreId();
$minOrderActive = Mage::getStoreConfigFlag('sales/minimum_order/active', $storeId);
$minOrderMulti = Mage::getStoreConfigFlag('sales/minimum_order/multi_address', $storeId);
$minAmount = Mage::getStoreConfig('sales/minimum_order/amount', $storeId);
if (!$minOrderActive) {
return true;
}
if(previous order exist and $baseTotal > 500){
return true;
}
....
Upvotes: 1