/** * Returns if this method can be used with the current cart. * * @param EventgalleryLibraryLineitemcontainer $cart * * @return bool */ public function isEligible($cart) { foreach ($cart->getLineItems() as $imagelineitem) { /** * @var EventgalleryLibraryImagelineitem $imagelineitem */ // if at least one item in the cart is not digital return true; if (!$imagelineitem->getImageType()->isDigital()) { return true; } } return false; }
/** * Returns if this method can be used with the current cart. * * @param EventgalleryLibraryLineitemcontainer $cart * * @return bool */ public function isEligible($cart) { // if there is no rule, this method is valued if (!isset($this->getData()->rules)) { return true; } $itemCountBased = isset($this->getData()->rules->type) && $this->getData()->rules->type == 'itemcount'; if ($itemCountBased) { // if the minimum amount is not defined skip this if (isset($this->getData()->rules->minAmount)) { // if the item count is not high enough if ($cart->getLineItemsTotalCount() < $this->getData()->rules->minAmount) { return false; } } // if the maximum amount is not defined skip this if (isset($this->getData()->rules->maxAmount) && $this->getData()->rules->maxAmount > 0) { // if the item count is too high if ($cart->getLineItemsTotalCount() > $this->getData()->rules->maxAmount) { return false; } } } else { // if the minimum amount is not defined skip this if (isset($this->getData()->rules->minAmount)) { // if the subtotal is not high enough if ($cart->getSubTotal()->getAmount() < $this->getData()->rules->minAmount) { return false; } } // if the maximum amount is not defined skip this if (isset($this->getData()->rules->maxAmount) && $this->getData()->rules->maxAmount > 0) { // if the subtotal is too high if ($cart->getSubTotal()->getAmount() > $this->getData()->rules->maxAmount) { return false; } } } return true; }
public function __construct($orderid) { $this->_lineitemcontainer_id = $orderid; $this->_loadLineItemContainer(); parent::__construct(); }
public function __construct($user_id) { $this->_user_id = $user_id; $this->_loadLineItemContainer(); parent::__construct(); }