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); //$minAmountGroup = Mage::getStoreConfig('sales/min_amount_per_customer_group/min_amount_group', $storeId); $minAmountGroupId = Mage::getStoreConfig('sales/minimum_order/customer_group', $storeId); $CustomerStatus = Mage::getSingleton('customer/session')->isLoggedIn(); $group = Mage::getSingleton('customer/session')->getCustomerGroupId(); if (!$minOrderActive) { return true; } else{ if($minAmountGroupId!=""&&!($CustomerStatus&&$group==$minAmountGroupId)){ if(!($CustomerStatus&&$group==$minAmountGroupId)){ return true; } } } $addresses = $this->getAllAddresses(); if ($multishipping) { if ($minOrderMulti) { foreach ($addresses as $address) { foreach ($address->getQuote()->getItemsCollection() as $item) { $amount = $item->getBaseRowTotal() - $item->getBaseDiscountAmount(); if ($amount < $minAmount) { return false; } } } } else { $baseTotal = 0; foreach ($addresses as $address) { /* @var $address Mage_Sales_Model_Quote_Address */ $baseTotal += $address->getBaseSubtotalWithDiscount(); } if ($baseTotal < $minAmount) { return false; } } } else { foreach ($addresses as $address) { /* @var $address Mage_Sales_Model_Quote_Address */ if (!$address->validateMinimumAmount()) { return false; } } } return true; } }