/** * 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; }
/** * 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); }
/** * 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); }
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); }