简体   繁体   English

Magento如何在货币下拉列表中显示国家标志?

[英]Magento how to display country flag in currency drop down?

I am trying to add all country flag in currency change dropdown in magento? 我想在magento的货币更改下拉列表中添加所有国家标志?

how may i do this in magento 1.4.2 ? 我如何在magento 1.4.2中做到这一点?

Very good example for flags. 标志的很好的例子。 It may help others http://www.phptechi.com/magento-show-country-flags-selector-in-header.html 它可能会帮助其他人http://www.phptechi.com/magento-show-country-flags-selector-in-header.html

As stated in that post: 如该帖子所述:

Step 1: Make sure multiple language stores are available. 步骤1:确保提供多种语言存储。 Now open flags.phhml file located at app/design/frontend/default/theme/template/page/switch/flags.html If in case it does not exists then create it and replace existing code/ add following code into file. 现在打开位于app / design / frontend / default / theme / template / page / switch / flags.html的flags.phhml文件(如果不存在的话)创建它并替换现有代码/在文件中添加以下代码。

Note: Please modify href & src in following code. 注意:请在以下代码中修改href&src。

 < ?php if(count($this->getGroups())>1): ?> < ?php foreach ($this->getGroups() as $_group): ?> < ?php echo $this->htmlEscape($_group->getName()) ?> < ?php endforeach; ?> < ?php endif; ?> 

Step 2: Now add entry into page.xml file and file header block ie “html_header”. 步骤2:现在将条目添加到page.xml文件和文件标题块中,即“ html_header”。 In case if you want to add flags in footer section then search for footer block and add following line in footer and do little css to align it correctly. 如果要在页脚部分添加标志,请搜索页脚块,然后在页脚中添加以下行,并做一些小的CSS使其正确对齐。

Step 3: Upload flag images into “skin/frontend/currentTheme/images/” directory and make sure the flag file names are having store name is part of flag name. 步骤3:将标志图像上传到“ skin / frontend / currentTheme / images /”目录中,并确保标志文件名具有商店名称是标志名的一部分。 (ie Image name is “flagEnglish.gif”, “flagGerman.gif”. So store names are “English”, “German”, etc) (即,图像名称为“ flagEnglish.gif”,“ flagGerman.gif”。因此商店名称为“ English”,“ German”等)

Now clean the magento cache and reload the home page and you are done!!. 现在清理magento缓存并重新加载主页,您就完成了!!

Currency selector with flag in magento magento中带有标志的货币选择器

  1. You need to prepare a flag list (images). 您需要准备一个标记列表(图像)。
  2. Upload flag list to root/media/flag directory 将标志列表上传到根/媒体/标志目录
  3. Rename flags to currency's code (EX: US Dollar -> usd-flag.jpg, Euro -> eur-flag.jpg, Hong Kong Dollar -> hkd-flag.jpg...) 将标志重命名为货币代码(例如:美元-> usd-flag.jpg,欧元-> eur-flag.jpg,港元-> hkd-flag.jpg ...)
  4. In the template file: app/design/frontend/default/your_theme/template/directory/currency.phtml (or app/design/frontend/base/default/template/directory/currency.phtml), change code to: 在模板文件:app / design / frontend / default / your_theme / template / directory / currency.phtml(或app / design / frontend / base / default / template / directory / currency.phtml)中,将代码更改为:

     <?php foreach ($this->getCurrencies() as $_code => $_name): ?> <a href="<?php echo $this->getSwitchCurrencyUrl($_code) ?>" onclick="setLocation(this.value);"> <img src="<?php echo Mage::getBaseUrl('media').'flag/'.$_code.'.jpg'; ?>" title="<?php echo $_name ?> - <?php echo $_code ?>" alt="<?php echo $_name ?> - <?php echo $_code ?>" width="20" height="20" /> </a> <?php endforeach; ?> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM