Please forgive me if I am asking stupid questions here. I am taking a baby step in learning programming. My question here is: I want to convert a currency selection box to a drop down box. (links provided) It involves JS and PHP. They are way over my head. Can somebody take a look and direct me what I should do?
selection box: http://www.prestashop.com/demo/
drop down box: http://osc3.template-help.com/osc_22304/index.php
My tpl file is as follow:
<!-- Block currencies module -->
<script type="text/javascript" src="{$module_dir}blockcurrencies.js"></script>
<div id="currencies_block_top">
<form id="setCurrency" action="{$request_uri}" method="post">
<ul>
{foreach from=$currencies key=k item=f_currency}
<li {if $id_currency_cookie == $f_currency.id_currency}class="selected"{/if}>
<a href="javascript:setCurrency({$f_currency.id_currency});" title="{$f_currency.name}">{$f_currency.sign}</a>
</li>
{/foreach}
</ul>
<p>
<input type="hidden" name="id_currency" id="id_currency" value=""/>
<input type="hidden" name="SubmitCurrency" value="" />
{l s='Currency' mod='blockcurrencies'}
</p>
</form>
</div>
<!-- /Block currencies module -->
My php file is as follow:
<?php
class BlockCurrencies extends Module
{
function __construct()
{
$this->name = 'blockcurrencies';
$this->tab = 'Blocks';
$this->version = 0.1;
parent::__construct(); // The parent construct is required for translations
$this->page = basename(__FILE__, '.php');
$this->displayName = $this->l('Currency block');
$this->description = $this->l('Adds a block for selecting a currency');
}
function install()
{
if (!parent::install())
return false;
if (!$this->registerHook('top'))
return false;
return true;
}
/**
* Returns module content for header
*
* @param array $params Parameters
* @return string Content
*/
function hookTop($params)
{
global $smarty;
$currencies = Currency::getCurrencies();
if (!sizeof($currencies))
return '';
$smarty->assign('currencies', $currencies);
return $this->display(__FILE__, 'blockcurrencies.tpl');
}
}
?>
My JS file is as follow:
function setCurrency(id)
{
$('form#setCurrency input#id_currency').val(id);
$('form#setCurrency').submit();
}
Thanks in advance for all of your help.
Jackson_h is offline Reply With Quote



Reply With Quote


Bookmarks