views:

2700

answers:

1

Currently, the currency selector is at the top, here’s my development site:

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

However, I would like to switch the currency selector to just under “Price” heading of the table.

I tried

getCurrency() ?>

but there’s nothing. I guess I need some method like getCurrencyHtml(), but it seems that there’s no such a method.

Or must I edit layout files, and how should I go about doing this?

+3  A: 

I can show you a way to do this, but in order to understand what's going on, you'll need to have at least a basic grasp of how Magento's layout files work. For that you should read the designer's guide here and a basic explanation of how it all works here.

Now there are several way of handling this, but I think the easiest way is to simply use the existing currency block. Seeing as you'll be putting it in that tiny cell I assume you wont be needing the "Select your Currency" headline. So we'll need a new template.

A block in Magento consists of two files, a block class that does all the work of generating dynamic content and a template file which uses the block class' methods along with some html to create the final result. The heavy lifting of getting the currency options is already done by the block class so if we can use that paired with a new template file we'll be set.

The existing declaration in the layout files and specifically directory.xml is

<block type="directory/currency" name="currency" before="catalog.leftnav" template="directory/currency.phtml"/>

So the template file is app\design\frontend[interface][theme]\template\directory\currency.phtml

Copy that to currency2.phtml and in there remove the heading.

Now to create a new block named "currency2" consisting of the old block class and the new template file we write

<block type="directory/currency" name="currency2" as="currency2" template="directory/currency2.phtml"/>

We'll be using that in /template/catalog/product/list.phtml so open catalog.xml and put the new block declaration under

<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">

in the appropriate section (I assume catalog_category_default).

Finally open /template/catalog/product/list.phtml and add

<?php echo $this->getChildHtml('currency2'); ?>

where you want the block to appear.

Manos Dilaverakis
Thanks, that worked for me.
Tian Bo