/** * @return array */ private function getAsOptionArray() { if (!isset($this->_asOptionArray)) { /** @var array $optionCurrenciesAll */ $optionCurrenciesAll = Mage::app()->getLocale()->getOptionCurrencies(); df_assert_array($optionCurrenciesAll); /** @var array $optionCurrencyMap */ $optionCurrencyMap = array_combine(df_column($optionCurrenciesAll, 'value'), df_column($optionCurrenciesAll, 'label')); df_assert_array($optionCurrencyMap); /** @var array $result */ $result = array(); foreach (self::getAllowedCurrencies() as $currencyCode) { /** @var string $currencyCode */ /** @var string|null $label */ $label = df_a($optionCurrencyMap, $currencyCode); if (!is_null($label)) { $result[] = array('value' => $currencyCode, 'label' => $label); } } df_assert_array($result); $this->_asOptionArray = $result; } df_result_array($this->_asOptionArray); return $this->_asOptionArray; }
/** * @param string $url * @return string */ public function preprocessUrl($url) { /** @var string $result */ $result = !df_is_it_my_local_pc() ? $url : str_replace($this->getStoreProcessed()->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB), self::URL_BASE_TEST, $url); $schemeAndOther = explode('//', $result); $result = implode('//', array(df_a($schemeAndOther, 0), implode('/', array_map('urlencode', explode('/', df_a($schemeAndOther, 1)))))); df_result_string($result); return $result; }
/** * @overide * @return Df_YandexMarket_Model_System_Config_Backend_Conditions */ protected function _beforeSave() { try { if ($this->validate()) { $this->getRule()->loadPost(array('conditions' => df_a(df_a($this->getPost(), 'rule'), 'conditions'), 'website_ids' => $this->getWebsiteIds())); $this->getRule()->setDataChanges(true); $this->getRule()->save(); df_assert_between($this->getRule()->getId(), 1); $this->setValue($this->getRule()->getId()); } } catch (Exception $e) { df_log_exception($e); rm_session()->addError($e->getMessage()); } parent::_beforeSave(); return $this; }