Here is enough to add a currency dropdown into the product area. I leave the positioning, styling and the language icon (also a module) to you. You will have to remove the currency dropdown on the header from catalog\template\default\layout.tpl or changing the currency will not work.
For your reference, I based the new code on the last 4 lines of catalog\controller\home.php and most of catalog\extension\module\currency.php
You might also like to have a look at this too
http://forum.opencart.com/index.php/top ... ml#msg4997
Make the following changes to catalog\template\default\content\product.tpl are (with extra code shown for placement)...
Note also that the main form tag had to move below the currency stuff so that we do not end up with embedded forms.
Code: Select all
<link rel="stylesheet" type="text/css" href="catalog/template/default/css/product.css">
<script type="text/javascript" src="catalog/javascript/ajax/jquery.js"></script>
<script type="text/javascript" src="catalog/javascript/thickbox/thickbox-compressed.js"></script>
<link rel="stylesheet" type="text/css" href="catalog/javascript/thickbox/thickbox.css" />
<div class="heading">
<?php if ($price) { ?>
<div class="right"><?php echo $price; ?></div>
<?php } ?>
<div class="left"><?php echo $heading_title; ?></div>
</div>
<br class="brclear" />
<br />
<!-- testing new location for Currency -->
<?php if (isset($currency)) { ?>
<?php echo $currency; ?>
<?php } ?>
<!-- testing new location for Currency -->
<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
<div id="product">
add the following to catalog\controller\product.php (extra code shown for positioning)
Code: Select all
foreach ($results as $result) {
$image_data[] = array(
'title' => $result['title'],
'popup' => $image->href($result['filename']),
'thumb' => $image->resize($result['filename'], $config->get('config_image_width'), $config->get('config_image_height')),
);
}
/*
* Start of show currency module in product.tpl
*/
$language->load('extension/module/currency.php');
$c = $this->locator->create('template');
$c->set('options', $option_data);
$c->set('heading_title', $language->get('heading_title'));
$c->set('action', $url->href('home'));
$c->set('text_currency', $language->get('text_currency'));
$c->set('entry_currency', $language->get('entry_currency'));
$c->set('default', $currency->getCode());
$c->set('currencies', $database->cache('currency', "select * from currency order by title"));
$view->set('currency', $c->fetch('module/currency.tpl'));
/*
* End of show currency module in product.tpl
*/
$view->set('images', $image_data);
$template->set($module->fetch());