예제 #1
0
 /**
  * Validate
  *
  * @param \Magento\Framework\Object $object Quote
  * @return bool
  */
 public function validate(\Magento\Framework\Object $object)
 {
     if (!$this->getConditions()) {
         return false;
     }
     $attr = $this->getAttribute();
     $total = 0;
     foreach ($object->getQuote()->getAllVisibleItems() as $item) {
         if (parent::validate($item)) {
             $total += $item->getData($attr);
         }
     }
     return $this->validateAttribute($total);
 }
예제 #2
0
 /**
  * @param \Magento\Rule\Model\Condition\Context $context
  * @param \Magento\SalesRule\Model\Rule\Condition\Product $ruleConditionProduct
  * @param array $data
  */
 public function __construct(\Magento\Rule\Model\Condition\Context $context, \Magento\SalesRule\Model\Rule\Condition\Product $ruleConditionProduct, array $data = [])
 {
     parent::__construct($context, $ruleConditionProduct, $data);
     $this->setType('Magento\\SalesRule\\Model\\Rule\\Condition\\Product\\Found');
 }