/** * Checks for requirements. * * @param MShop_Order_Item_Base_Interface $base Basic order of the customer * @return boolean True if the requirements are met, false if not */ public function isAvailable(MShop_Order_Item_Base_Interface $base) { if (($prodcode = $this->_getConfigValue('required.productcode')) !== null) { foreach ($base->getProducts() as $product) { if ($product->getProductCode() == $prodcode) { return parent::isAvailable($base); } } return false; } return true; }
/** * Checks for the min/max order value. * * @param MShop_Order_Item_Base_Interface $base Basic order of the customer * @return boolean True if the basket matches the constraints, false if not */ public function isAvailable(MShop_Order_Item_Base_Interface $base) { $price = $base->getPrice(); $currency = $price->getCurrencyId(); $value = $price->getValue() + $price->getRebate(); $minvalue = $this->_getConfigValue('basketvalues.total-value-min', array()); if (isset($minvalue[$currency]) && $minvalue[$currency] > $value) { return false; } $maxvalue = $this->_getConfigValue('basketvalues.total-value-max', array()); if (isset($maxvalue[$currency]) && $maxvalue[$currency] < $value) { return false; } return parent::isAvailable($base); }