Example #1
0
 /**
  * validate
  *
  * @param Varien_Object $object Quote
  * @return boolean
  */
 public function validate(Varien_Object $object)
 {
     if (!$this->getConditions()) {
         return false;
     }
     $attr = $this->getAttribute();
     $total = 0;
     if ($object->getAllItems()) {
         $validIds = array();
         foreach ($object->getAllItems() as $item) {
             if ($item->getProduct()->getTypeId() == 'configurable') {
                 $item->getProduct()->setTypeId('skip');
             }
             //can't use parent here
             if (Mage_SalesRule_Model_Rule_Condition_Product_Combine::validate($item)) {
                 $itemParentId = $item->getParentItemId();
                 if (is_null($itemParentId)) {
                     $validIds[] = $item->getItemId();
                 } else {
                     if (in_array($itemParentId, $validIds)) {
                         continue;
                     } else {
                         $validIds[] = $itemParentId;
                     }
                 }
                 $total += $item->getData($attr);
             }
             if ($item->getProduct()->getTypeId() === 'skip') {
                 $item->getProduct()->setTypeId('configurable');
             }
         }
     }
     return $this->validateAttribute($total);
 }
Example #2
0
 /**
  * validate
  *
  * @param Varien_Object $object Quote
  * @return boolean
  */
 public function validate(Varien_Object $object)
 {
     if (!$this->getConditions()) {
         return false;
     }
     #var_dump($object->getAllItems()); die();
     $attr = $this->getAttribute();
     $total = 0;
     foreach ($object->getAllItems() as $item) {
         if (parent::validate($item)) {
             $total += $item->getData($attr);
         }
     }
     #var_dump($attr, $total); die();
     return $this->validateAttribute($total);
 }
Example #3
0
 public function validate(Varien_Object $object)
 {
     if ($vendorId = $this->getRule()->getData('vendor_id')) {
         $product = false;
         if ($object->getProduct() instanceof Mage_Catalog_Model_Product) {
             $product = $object->getProduct();
             if (!$product || !$product->getData('sm_product_vendor_id')) {
                 $product = Mage::getModel('catalog/product')->load($object->getProductId());
             }
             if ($product->getData('sm_product_vendor_id') != $vendorId) {
                 return false;
             }
         }
     }
     return parent::validate($object);
 }
Example #4
0
 /**
  * validate
  *
  * @param Varien_Object $object Quote
  * @return boolean
  */
 public function validate(Varien_Object $object)
 {
     if (!$this->getConditions()) {
         return false;
     }
     $attr = $this->getAttribute();
     $total = 0;
     if ($object->getItemsToValidateRestrictions()) {
         foreach ($object->getItemsToValidateRestrictions() as $item) {
             //can't use parent here
             if (Mage_SalesRule_Model_Rule_Condition_Product_Combine::validate($item)) {
                 $total += $item->getData($attr);
             }
         }
     }
     return $this->validateAttribute($total);
 }
Example #5
0
 /**
  * validate
  *
  * @param Varien_Object $object Quote
  * @return boolean
  */
 public function validate(Varien_Object $object)
 {
     if (!$this->getConditions()) {
         return false;
     }
     // Fix a bug with the underlying combine condition check
     $value = $this->getValue();
     $this->setValue(true);
     $total = 0;
     foreach ($object->getQuote()->getAllVisibleItems() as $item) {
         if (Mage_SalesRule_Model_Rule_Condition_Product_Combine::validate($item)) {
             $total += $item->getData($this->getAttribute());
         }
     }
     // Fix a bug with the underlying combine condition check
     $this->setValue($value);
     return $this->validateAttribute($total);
 }
Example #6
0
 public function __construct()
 {
     parent::__construct();
     $this->setType('Mage_SalesRule_Model_Rule_Condition_Product_Found');
 }
Example #7
0
 public function __construct()
 {
     parent::__construct();
     $this->setType('salesrule/rule_condition_product_found');
 }
 /**
  * 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()->getAllVisibleItems() as $item) {
         if (parent::validate($item)) {
             $total += $item->getData($attr);
         }
     }
     //        $this->setAggregator(join('/', $aggregatorArr))->setValue($value);
     return $this->validateAttribute($total);
 }
Example #9
0
 /**
  * Initialize model
  */
 public function __construct()
 {
     parent::__construct();
     $this->setType('amlanding/filter_condition_combine');
 }
 public function __construct()
 {
     parent::__construct();
     $this->setType('mageworx_multifees/fee_condition_product_combine');
 }
Example #11
0
 public function __construct()
 {
     parent::__construct();
     $this->setType('followupemail/followupemailrule_rule_condition_product_found');
 }