Exemplo n.º 1
0
 /**
  * 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);
 }
Exemplo n.º 2
0
 public function asStringRecursive($level = 0)
 {
     $str = parent::asStringRecursive($level);
     foreach ($this->getConditions() as $cond) {
         $str .= "\n" . $cond->asStringRecursive($level + 1);
     }
     return $str;
 }