/** * validate * * @param Varien_Object $object Quote * @return boolean */ public function validate(Varien_Object $object) { if (!$this->getConditions()) { return false; } // $value = $this->getValue(); // $aggregatorArr = explode('/', $this->getAggregator()); // $this->setValue((int)$aggregatorArr[0])->setAggregator($aggregatorArr[1]); $attr = $this->getAttribute(); $total = 0; foreach ($object->getQuote()->getAllItems() as $item) { if (parent::validate($item)) { $total += $item->getData($attr); } } // $this->setAggregator(join('/', $aggregatorArr))->setValue($value); return $this->validateAttribute($total); }
public function __construct() { parent::__construct(); $this->setType('hipay/rule_condition_product_found'); }