簡體   English   中英

Magento如何在貨幣下拉列表中顯示國家標志?

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

我想在magento的貨幣更改下拉列表中添加所有國家標志?

我如何在magento 1.4.2中做到這一點?

標志的很好的例子。 它可能會幫助其他人http://www.phptechi.com/magento-show-country-flags-selector-in-header.html

如該帖子所述:

步驟1:確保提供多種語言存儲。 現在打開位於app / design / frontend / default / theme / template / page / switch / flags.html的flags.phhml文件(如果不存在的話)創建它並替換現有代碼/在文件中添加以下代碼。

注意:請在以下代碼中修改href&src。

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

步驟2:現在將條目添加到page.xml文件和文件標題塊中,即“ html_header”。 如果要在頁腳部分添加標志,請搜索頁腳塊,然后在頁腳中添加以下行,並做一些小的CSS使其正確對齊。

步驟3:將標志圖像上傳到“ skin / frontend / currentTheme / images /”目錄中,並確保標志文件名具有商店名稱是標志名的一部分。 (即,圖像名稱為“ flagEnglish.gif”,“ flagGerman.gif”。因此商店名稱為“ English”,“ German”等)

現在清理magento緩存並重新加載主頁,您就完成了!!

magento中帶有標志的貨幣選擇器

  1. 您需要准備一個標記列表(圖像)。
  2. 將標志列表上傳到根/媒體/標志目錄
  3. 將標志重命名為貨幣代碼(例如:美元-> usd-flag.jpg,歐元-> eur-flag.jpg,港元-> hkd-flag.jpg ...)
  4. 在模板文件: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