感谢您的阅读,我是新的magento。我正在研究api应用程序,所以如果我有网站ID,如何获得本网站的所有可用货币和同样的东西,如果我有商店编号 任何想法将不胜感激获取所有货币可用于网站/商店在magento
回答
你可以试试这个获得允许货币:
$CurrencyCode = Mage::getStoreConfig('currency/options/allow');
请让我知道如果你需要更多的帮助。
请尝试下面,没有测试过它。
$currencies = array();
$codes = Mage::app()->getStore()->getAvailableCurrencyCodes(true);
if (is_array($codes) && count($codes) > 1) {
$rates = Mage::getModel('directory/currency')->getCurrencyRates(
Mage::app()->getStore()->getBaseCurrency(),
$codes
);
foreach ($codes as $code) {
if (isset($rates[$code])) {
$currencies[$code] = Mage::app()->getLocale()
->getTranslation($code, 'nametocurrency');
}
}
}
echo "<pre>";
print_r($currencies);
谢谢,Mage :: app() - > getStore() - > getAvailableCurrencyCodes(true)返回默认货币,所以用Mage :: app() - > getStore() - > getAvailableCurrencyCodes(true)如果我们打开系统 - >配置 - >货币设置,这个配置适用于所有可用的货币系统中的国家名称,但仍然无法获得指定网站或商店的货币(我有想要的网站和商店的ID) – rramiii
(((((((( – rramiii
)我使用代码来获得magento货币汇率($汇率变量)从所选的网站或商店货币不同,所以我认为有一些方法可以通过网站或商店获得货币。 – electroid
试试这个:
$CurrencyCode = Mage::getModel('core/config_data')
->getCollection()
->addFieldToFilter('path','currency/options/allow')
->addFieldToFilter('scope_id',<you store id>)
->getData();
$currencies_array = explode(',',$CurrencyCode[0]['value']);
if($currencies_array[0] == '')
{
$currencies_array[]= Mage::app()->getStore($site_id)->getCurrentCurrencyCode();
}
echo "<pre>";print_r($currencies_array);echo "</pre>";
哪里应该由店铺标识所取代。请记住,如果您尚未为特定商店设置值,则需要传递0(默认商店作用域ID)。
我需要一些货币在自定义网格上的下拉菜单。要得到所有门店使用的货币种类并呈现下拉,这个工作对我来说在Grid.php
$stores = Mage::app()->getStores();
foreach($stores as $store) {
$currency = Mage::getStoreConfig('currency/options/allow', $store);
$currencies[$currency] = $currency;
}
$currencies = array_unique($currencies);
对于网格列:
$this->addColumn('currency', array(
'header' => Mage::helper('erp')->__('Currency'),
'align' => 'left',
'width' => '100px',
'index' => 'currency',
'type' => 'options',
'options' => $currencies,
));
我并不需要在选项标签长格式的货币名称,只有三个字母代码。
- 1. 如何获得Magento商店货币
- 2. Magento多货币w /多个商店
- 3. magento apis用于创建网站,商店和商店视图
- 4. Magento - 多网站,多种货币
- 5. 根据货币链接到magento网站
- 6. Magento - 使用指定货币的商店链接
- 7. Magento商店视图 - 显示的货币不正确
- 8. Magento:不同的商店查看不同的货币
- 9. Magento - 按名称获取商店,网站,组对象
- 10. Magento:获取当前商店/网站的父类别
- 11. 获取magento商店列表
- 12. 商店货币代码以及价格
- 13. Magento - 如果货币等于
- 14. 网站magento默认商店ID
- 15. Magento的多商店网站问题
- 16. 从其他网站提取货币值
- 17. Magento网站,商店和商店视图之间有什么区别?
- 18. 基于网站在Magento如何获得基于网站在Magento
- 19. Magento显示两种货币(获得货币汇率)
- 20. 为什么加载网站的所有商店取决于当前加载的商店?
- 21. 货币符号在Magento
- 22. 货币在不同的网站
- 23. 从网站获取的货币,并返回一个字典
- 24. MATLAB:从网站货币转换器获取信息(XE.com)
- 25. Magento 1.7如何删除现有的多余网站和商店
- 26. 更改商店网站上的商品价格(Magento)
- 27. 获取在商店
- 28. Magento:如何从另一个网站/商店在同一商店指向主网站
- 29. 多种货币电子商务网站的价格表结构
- 30. 如何获得magento商店?
在文档中说什么? –
发布一些你已经试过的代码 – Johnny000
文档说变量是website_id的网站货币和store_id的商店货币 – rramiii