public function getSettingsHTML($params = array()) { $currencies = waCurrency::getAll(); foreach ($currencies as $k => $v) { $currencies[$k] = $v . ' (' . $k . ')'; } $params['options']['currency'] = $currencies; return parent::getSettingsHTML($params); }
public static function settingCurrencySelect() { $options = array(); $options[''] = '-'; $app_config = wa()->getConfig(); if (method_exists($app_config, 'getCurrencies')) { $currencies = $app_config->getCurrencies(); foreach ($currencies as $code => $currency) { $options[$code] = array('value' => $code, 'title' => $currency['title'] . ' (' . $code . ')', 'description' => $currency['code']); } } else { $currencies = waCurrency::getAll(); foreach ($currencies as $code => $currency_name) { $options[$code] = array('value' => $code, 'title' => $currency_name . ' (' . $code . ')', 'description' => $code); } } return $options; }
public function add($code) { $code = $this->escape($code); if ($this->getById($code)) { return false; } $currencies = waCurrency::getAll(true); if (!isset($currencies[$code])) { return false; } $sort = $this->query("SELECT MAX(sort) sort FROM `{$this->table}`")->fetchField('sort') + 1; $result = $this->insert(array('code' => $code, 'sort' => $sort)); $cache = new waRuntimeCache('shop_currencies'); $cache->delete(); if ($cache = wa('shop')->getCache()) { $cache->delete('currencies'); } return $result; }
public function getSystemCurrencies() { $system_currencies = waCurrency::getAll(true); ksort($system_currencies); return $system_currencies; }