Beispiel #1
0
 public function getNewChildSelectOptions()
 {
     $conditions = parent::getNewChildSelectOptions();
     foreach ($conditions as $index => $condition) {
         if (isset($condition['value']) && $condition['value'] == 'salesrule/rule_condition_combine') {
             $conditions[$index]['value'] = 'awautorelated/salesrule_rule_condition_combine';
             break;
         }
     }
     return $conditions;
 }
 public function getNewChildSelectOptions()
 {
     $conditions = parent::getNewChildSelectOptions();
     if (Mage::helper('smvendors')->getVendorLogin()) {
         foreach ($conditions as $key => $cond) {
             if (!in_array($cond['value'], $this->_allowConditions)) {
                 unset($conditions[$key]);
             }
         }
     }
     return $conditions;
 }
 public function validate(Varien_Object $object)
 {
     if (!$this->getConditions()) {
         return true;
     }
     $bResult = false;
     $bMeetCond = false;
     foreach ($this->getConditions() as $cond) {
         if ($cond instanceof Aitoc_Aitloyalty_Model_Rule_Condition_Customer_Subselect) {
             $iStoreId = Mage::app()->getStore()->getId();
             $iSiteId = Mage::app()->getWebsite()->getId();
             /* */
             $performer = Aitoc_Aitsys_Abstract_Service::get()->platform()->getModule('Aitoc_Aitloyalty')->getLicense()->getPerformer();
             $ruler = $performer->getRuler();
             if (!($ruler->checkRule('store', $iStoreId, 'store') || $ruler->checkRule('store', $iSiteId, 'website'))) {
                 return false;
             }
             /* */
             $bMeetCond = true;
             if ($this->getValue()) {
                 // If ALL/ANY of these conditions are TRUE
                 $bResult = $cond->validate($object) || false;
             } else {
                 // If ALL/ANY of these conditions are FALSE
                 $bResult = !($cond->validate($object) || false);
             }
         }
     }
     if ($bMeetCond) {
         if ('any' == $this->getAggregator()) {
             return $bResult || parent::validate($object);
         } else {
             return $bResult && parent::validate($object);
         }
     } else {
         return parent::validate($object);
     }
 }
 public function asXml($containerKey = 'conditions', $itemKey = 'condition')
 {
     $xml = '<attribute>' . $this->getAttribute() . '</attribute>' . '<operator>' . $this->getOperator() . '</operator>' . parent::asXml($containerKey, $itemKey);
     return $xml;
 }