ake a look @ Magento Maximum Allowed Order Amount, you would have to create a custom module to add this feature.
Create an observer for
Create an observer for
sales_quote_save_before
<config> <frontend> <events> <sales_quote_save_before> <observers> <mymodule_custom> <class>
Mymodule
_Custom_Model_Observer</class> <method>LimitOrderqty</method> </
mymodule
_custom> </observers> </sales_quote_save_before> </events> </frontend> </config>
In your observer
<?php
class Mymodule_Custom_Model_Observer {
public function LimitOrderqty(Varien_Event_Observer $observer){
$cart = Mage::getModel('checkout/cart')->getQuote();
$customer = Mage::getSingleton('customer/session')->getCustomer();
$allowQTY = $customer->getLastsaleqty() + (int)($customer->getLastsaleqty()*$customer->getGreaseqty()/100);
if ($cart->getItemsQty() > $allowQTY) {
Mage::getSingleton('checkout/session')->addError('You are not allow to add that QTY in your cart. Your Approved QTY limit '.$allowQTY);
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
Mage::app()->getResponse()->sendResponse();
exit;
}
}
}
No comments:
Post a Comment