/** * Check if this Item validates a condition * * @param DiscountCondition * @return bool */ public function isValidCondition(DiscountCondition $condition) { switch ($condition->getSourceEntityField()) { case 'price': $condition->setSourceValue($this->getPrice()); break; case 'weight': $condition->setSourceValue($this->getWeight()); break; case 'sku': $condition->setSourceValue($this->getSku()); break; case 'qty': $condition->setSourceValue($this->getQty()); break; case 'category_ids_csv': $condition->setSourceValue($this->getCategoryIdsCsv()); break; } return $condition->isValid(); }
/** * Check whether this shipment validates a discount condition * * @param DiscountCondition * @return bool */ public function isValidCondition(DiscountCondition $condition) { switch ($condition->getSourceEntityField()) { case 'code': $condition->setSourceValue($this->getCode()); break; case 'price': $condition->setSourceValue($this->getPrice()); break; default: //no-op break; } return $condition->isValid(); }