Magento currency magento header to increase currency switching options

Source: Internet
Author: User
Tags locale php foreach
Magento currencymagento header to add currency switching options

The default magento Currency Option Switch is displayed on the left. Sometimes we need to display it in the header.

Step 1. Create a new file APP/design/frontend/default/your_theme/template/directory/currency-top.phtml

<?php if($this->getCurrencyCount()>1): ?><div class="block block-currency-top">        <strong><span><?php echo $this->__(‘Select Your Currency‘) ?></span></strong>        <select name="currency" title="<?php echo $this->__(‘Select Your Currency‘) ?>" onchange="setLocation(this.value)">        <?php foreach ($this->getCurrencies() as $_code => $_name): ?>            <option value="<?php echo $this->getSwitchCurrencyUrl($_code) ?>"<?php if($_code==$this->getCurrentCurrencyCode()): ?> selected="selected"<?php endif; ?>>                <?php echo $_name ?> - <?php echo $_code ?>            </option>        <?php endforeach; ?>        </select></div><?php endif; ?>

Step 2. Now add the below given line of code inside header block in APP/design/frontend/default/your_theme/layout/page. xml

<block type="directory/currency" name="currency_top" template="directory/currency-top.phtml"/>

Step 3. Add the below given line in APP/design/frontend/default/your_theme/template/page/html/header. phtml

<?php echo $this->getChildHtml(‘currency_top‘); ?>

Click here for the above Source

Modify the location of the magento and currency symbols
When using magento to build a multi-language store, you often need to add the corresponding currency. Sometimes you want to modify the currency symbol to the desired format. How can you modify it? Here is a simple method:
1. Check what your language environment is in configuration General => locale Options => locale
2. If your locale is the default option "English (United States)", open the EN. xml edit in the LIB/Zend/locale/data/directory.
3. for example, if you want to change the yen to "RMB" (the default value is "¥"), search for "JPY" for about 3245 lines and find the following code, change "¥" to "RMB" and save

<currency type="JPY">                <displayname>Japanese Yen</displayname>                <displayname count="one">Japanese yen</displayname>                <displayname count="other">Japanese yen</displayname>                <symbol>¥</symbol>            </currency>

4. Save the uploaded files and clear the background cache system-> Cache Management.
5. the cache directory/var/cache Under VaR may not be changed yet.
6. Refresh the front-end. OK.
Another problem is that "Limit 25,522.64" is displayed on the front end after modification. How can I modify the symbol after modification? The method is simple. Edit en. xml and search for "" about 2597 lines to find the following code.

<currencyformatlength>                <currencyformat>                    <pattern>¤#,##0.00;(¤#,##0.00)</pattern>                </currencyformat>            </currencyformatlength>

Change Region #, #0.00; (Region #, #0.00) to #, #0.00 region; (#, #0.00 region ).
Currency indicates the currency position.
Click here for the above Source

There are

Change magento currency Layout

Custom magento currency Switcher in Header

How to add currency selector to magento's header

Change the top currency to another image
Then the content of currency. phtml is modified

<?php if($this->getCurrencyCount()>1): ?>    <div class="currency" style="text-align: right; position: relative; top: 26px; right: 18px;">    <?php foreach ($this->getCurrencies() as $_code => $_name): ?>                         <a href="<?php echo $this->getSwitchCurrencyUrl($_code) ?>" onclick="setLocation(this.value);">        .png" title="<?php echo $_name ?> - <?php echo $_code ?>"/>        </a>          <?php endforeach; ?>    </div><?php endif; ?>

From add flag icons to your magento site header to switch currency

Magento currency magento header to increase currency switching options

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.