Results 1 to 10 of 10

Thread: convert currency selection box to a drop down manu

  1. #1
    Join Date
    Dec 2008
    Posts
    29
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default convert currency selection box to a drop down manu

    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
    Last edited by jackson; 12-22-2008 at 01:29 AM.

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    I still don't see what you really want, can you please be a little bit more descriptive?
    Jeremy | jfein.net

  3. #3
    Join Date
    Dec 2008
    Posts
    29
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Nile View Post
    I still don't see what you really want, can you please be a little bit more descriptive?

    Sorry, I don't know how I can post a picture here.
    The script that I posted above is for a currency selection box. Please see: http://www.prestashop.com/demo/. On the top of the page that has the currency selection boxes. I would like to change the codes to a drop down menu. Please see this link: http://osc3.template-help.com/osc_22304/index.php. I saw somebody did it, so I know it can be done. Thank you very much for your help.

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Yes, very very possible, but is http://www.prestashop.com/demo/ your website? B/c I don't know how your changing the currency on your site(unless that is your site).
    Jeremy | jfein.net

  5. #5
    Join Date
    Dec 2008
    Posts
    29
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Nile View Post
    Yes, very very possible, but is http://www.prestashop.com/demo/ your website? B/c I don't know how your changing the currency on your site(unless that is your site).
    My site is still work in progress. It is www.blossomcart.com. Thank you very much for your help.

  6. #6
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Did you copy that other site or something? Anyways here's the menu:
    Code:
    <select>
    <optgroup label="Select a currency">
    <option onClick="javascript:setCurrency(2);">USD, $</option>
    <option onClick="javascript:setCurrency(1);">Euro,  €</option>
    <option onClick="javascript:setCurrency(3);">Pound, £</option>
    </optgroup>
    </select>
    Jeremy | jfein.net

  7. #7
    Join Date
    Dec 2008
    Posts
    29
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Nile View Post
    Did you copy that other site or something? Anyways here's the menu:
    Code:
    <select>
    <optgroup label="Select a currency">
    <option onClick="javascript:setCurrency(2);">USD, $</option>
    <option onClick="javascript:setCurrency(1);">Euro,  €</option>
    <option onClick="javascript:setCurrency(3);">Pound, £</option>
    </optgroup>
    </select>
    Where do I put the script? Do I need to delete any codes? Or replace any codes? Or do I replace these codes with the JS file?

    Thanks a lot of ryour help.

  8. #8
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Replace your current currency code with that. Also did you copy that other site?
    Jeremy | jfein.net

  9. #9
    Join Date
    Dec 2008
    Posts
    29
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Nile View Post
    Replace your current currency code with that. Also did you copy that other site?
    Sorry, my English is not that good. What do you mean by copy that other site? Which site?

  10. #10
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    I mean, your code is the exact same code as: http://www.prestashop.com/demo/
    Also did my code work?
    Jeremy | jfein.net

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •