更改Magento中货币选择器的位置

Tia*_* Bo 1 html php xml magento

目前,货币选择器位于顶部,这是我的开发网站:

http://nordschleife.metaforix.net/118/118/index.php/kyocera.html

但是,我想将货币选择器切换到表格的"价格"标题下.

我试过了

echo $this->getCurrency();
Run Code Online (Sandbox Code Playgroud)

但没什么.我想我需要一些方法getCurrencyHtml(),但似乎没有这样的方法.

或者我必须编辑布局文件,我该怎么做呢?

Man*_*kis 5

我可以告诉你一种方法,但是为了理解发生了什么,你需要至少掌握Magento的布局文件是如何工作的.对于你应该阅读设计师的指导在这里和这一切是如何工作的基本解释这里.

现在有几种处理方法,但我认为最简单的方法是简单地使用现有的货币区块.看到你将把它放在那个小小的牢房中,我假设你不需要"选择你的货币"标题.所以我们需要一个新模板.

Magento中的一个块由两个文件组成,一个块类完成生成动态内容的所有工作,一个模板文件使用块类的方法和一些html来创建最终结果.获取货币选项的繁重工作已经由块类完成,因此如果我们可以使用与新模板文件配对的那么我们将被设置.

布局文件中的现有声明,特别是directory.xml

<block type="directory/currency" name="currency" before="catalog.leftnav" template="directory/currency.phtml"/>
Run Code Online (Sandbox Code Playgroud)

所以模板文件是app\design\frontend [interface] [theme]\template\directory\currency.phtml

将其复制到currency2.phtml并在那里删除标题.

现在创建一个名为"currency2"的新块,它由旧块类和我们编写的新模板文件组成

<block type="directory/currency" name="currency2" as="currency2" template="directory/currency2.phtml"/>
Run Code Online (Sandbox Code Playgroud)

我们将在/template/catalog/product/list.phtml中使用它,所以打开catalog.xml并将新的块声明放在

<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
Run Code Online (Sandbox Code Playgroud)

在适当的部分(我假设catalog_category_default).

最后打开/template/catalog/product/list.phtml并添加

<?php echo $this->getChildHtml('currency2'); ?>
Run Code Online (Sandbox Code Playgroud)

您希望块出现的位置.