Php Magento货币开关在页脚显示不正确的货币,但在页眉显示正确的货币
我遇到了一个奇怪的问题,货币下拉开关在Magento。它在页眉中显示并正常工作,但页脚中的显示不正确。它正确地更改了货币,正如我在页脚中切换货币时页眉中的货币会更改一样,但页脚下拉列表显示的货币错误。如果我选择欧元,则显示英镑;如果我选择英镑,则显示欧元 我在/directory(与currency_top.phtml的位置相同)中创建了currency_footer.phtml,并复制了代码,只对其中包含的div类进行了更改。以下是currency_footer.phtml中的代码:Php Magento货币开关在页脚显示不正确的货币,但在页眉显示正确的货币,php,magento,drop-down-menu,currency,Php,Magento,Drop Down Menu,Currency,我遇到了一个奇怪的问题,货币下拉开关在Magento。它在页眉中显示并正常工作,但页脚中的显示不正确。它正确地更改了货币,正如我在页脚中切换货币时页眉中的货币会更改一样,但页脚下拉列表显示的货币错误。如果我选择欧元,则显示英镑;如果我选择英镑,则显示欧元 我在/directory(与currency_top.phtml的位置相同)中创建了currency_footer.phtml,并复制了代码,只对其中包含的div类进行了更改。以下是currency_footer.phtml中的代码: <
<?php
/**
* Currency switcher
*
* @see Mage_Directory_Block_Currency
*/
?>
<?php if($this->getCurrencyCount()>1): ?>
<div class="tm_footer_currency">
<label class="btn"><?php echo $this->__('Currency:') ?></label>
<select name="currency" title="<?php echo $this->__('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 $_code ?>
</option>
<?php endforeach; ?>
</select>
</div>
<?php endif; ?>
<?php echo $this->getChildHtml('currency_end') ?>
您需要将代码放入
标记中,然后在footer.phtml中调用getChildHtml('currency\u end')?>
这里是代码
<reference name="footer">
<block type="directory/currency" name="currency_end" as="currency_end"
template="directory/currency_footer.phtml"/>
</reference>
谢谢你的回复!很抱歉,我不清楚,我已将代码放入引用中,该块正在显示,但它无法正常工作。
<reference name="footer">
<block type="directory/currency" name="currency_end" as="currency_end"
template="directory/currency_footer.phtml"/>
</reference>
<?php echo $this->getLayout()->createBlock('directory/currency')
->setTemplate('directory/currency_footer.phtml')->toHtml(); ?>