예제 #1
0
 /**
  * Load from array
  * 
  * @see Mage_Rule_Model_Condition_Abstract::loadArray()
  * @param array $arr
  * @return Mzax_Emarketing_Model_SalesRule_Condition_Emarketing
  */
 public function loadArray($arr)
 {
     $this->setCampaign($arr['campaign']);
     $this->setUnit($arr['unit']);
     parent::loadArray($arr);
     return $this;
 }
예제 #2
0
 /**
  * Overwrite parent method to add new operators
  *
  * @param array $arr
  *
  * @return MatheusGontijo_EasyShippingRules_Model_Rule_Condition_Product|Mage_CatalogRule_Model_Rule_Condition_Product
  */
 public function loadArray($arr)
 {
     $isBetweenOperator = isset($arr['operator']) && in_array($arr['operator'], array('><', '<>'));
     if (isset($arr['value']) && $isBetweenOperator) {
         $valueExploded = explode('-', $arr['value']);
         if (isset($valueExploded[0]) && isset($valueExploded[1])) {
             $arr['value'] = Mage::app()->getLocale()->getNumber($valueExploded[0]) . '-' . Mage::app()->getLocale()->getNumber($valueExploded[1]);
             return Mage_Rule_Model_Condition_Abstract::loadArray($arr);
         } else {
             $arr['value'] = '';
         }
     }
     return parent::loadArray($arr);
 }
예제 #3
0
파일: Abstract.php 프로젝트: quyip8818/Mag
 /**
  * Load array
  *
  * @param array $arr
  * @return Mage_CatalogRule_Model_Rule_Condition_Product
  */
 public function loadArray($arr)
 {
     $this->setAttribute(isset($arr['attribute']) ? $arr['attribute'] : false);
     $attribute = $this->getAttributeObject();
     $isContainsOperator = !empty($arr['operator']) && in_array($arr['operator'], array('{}', '!{}'));
     if ($attribute && $attribute->getBackendType() == 'decimal' && !$isContainsOperator) {
         if (isset($arr['value'])) {
             if (!empty($arr['operator']) && in_array($arr['operator'], array('!()', '()')) && false !== strpos($arr['value'], ',')) {
                 $tmp = array();
                 foreach (explode(',', $arr['value']) as $value) {
                     $tmp[] = Mage::app()->getLocale()->getNumber($value);
                 }
                 $arr['value'] = implode(',', $tmp);
             } else {
                 $arr['value'] = Mage::app()->getLocale()->getNumber($arr['value']);
             }
         } else {
             $arr['value'] = false;
         }
         $arr['is_value_parsed'] = isset($arr['is_value_parsed']) ? Mage::app()->getLocale()->getNumber($arr['is_value_parsed']) : false;
     }
     return parent::loadArray($arr);
 }
예제 #4
0
 public function loadArray($arr)
 {
     $this->setAttribute(isset($arr['attribute']) ? $arr['attribute'] : false);
     $attribute = $this->getAttributeObject();
     if ($attribute && $attribute->getBackendType() == 'decimal') {
         $arr['value'] = isset($arr['value']) ? Mage::app()->getLocale()->getNumber($arr['value']) : false;
         $arr['is_value_parsed'] = isset($arr['is_value_parsed']) ? Mage::app()->getLocale()->getNumber($arr['is_value_parsed']) : false;
     }
     return parent::loadArray($arr);
 }