Page 1 of 1

[Solved] Dropbox currency option

Posted: Mon Feb 27, 2012 10:01 pm
by cabte
Has anyone got a dropbox currency option.

I use multiple currencies and hate the look of them all over the top .
Would like to make it look neeter with a dropbox.

Thanks in advance.

http://www.creativedecals.co.uk

Re: Dropbox currency option

Posted: Tue Feb 28, 2012 10:36 pm
by Icebox
I was about to post the same question. I was wondering what the code would be to alter it to a standard <select><option></select> or whatever type thing. Don't really know which file to edit or where to place the tags in the php.

Re: Dropbox currency option

Posted: Tue Feb 28, 2012 11:11 pm
by Qphoria
1. EDIT: catalog/view/theme/default/template/common/header.tpl

2. FIND:

Code: Select all

<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
    <div id="currency"><?php echo $text_currency; ?><br />
      <?php foreach ($currencies as $currency) { ?>
      <?php if ($currency['code'] == $currency_code) { ?>
      <?php if ($currency['symbol_left']) { ?>
      <a title="<?php echo $currency['title']; ?>"><b><?php echo $currency['symbol_left']; ?></b></a>
      <?php } else { ?>
      <a title="<?php echo $currency['title']; ?>"><b><?php echo $currency['symbol_right']; ?></b></a>
      <?php } ?>
      <?php } else { ?>
      <?php if ($currency['symbol_left']) { ?>
      <a title="<?php echo $currency['title']; ?>" onclick="$('input[name=\'currency_code\']').attr('value', '<?php echo $currency['code']; ?>').submit(); $(this).parent().parent().submit();"><?php echo $currency['symbol_left']; ?></a>
      <?php } else { ?>
      <a title="<?php echo $currency['title']; ?>" onclick="$('input[name=\'currency_code\']').attr('value', '<?php echo $currency['code']; ?>').submit(); $(this).parent().parent().submit();"><?php echo $currency['symbol_right']; ?></a>
      <?php } ?>
      <?php } ?>
      <?php } ?>
      <input type="hidden" name="currency_code" value="" />
      <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
    </div>
  </form>
3. REPLACE WITH:

Code: Select all

<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
    <div id="currency"><?php echo $text_currency; ?><br />
      <select onchange="$('input[name=\'currency_code\']').attr('value', this.value); $(this).parent().parent().submit();">
      <?php foreach ($currencies as $currency) { ?>
      <?php if ($currency['code'] == $currency_code) { ?>
      <option value="<?php echo $currency['code']; ?>" selected="selected"><?php echo $currency['title']; ?></option>
      <?php } else { ?>
      <option value="<?php echo $currency['code']; ?>"><?php echo $currency['title']; ?></option>
      <?php } ?>
      <?php } ?>
      </select>
      <input type="hidden" name="currency_code" value="<?php echo $currency_code; ?>" />
      <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
    </div>
  </form>
Image

Re: Dropbox currency option

Posted: Thu Mar 01, 2012 10:41 am
by Icebox
Thank you very much, Qphoria. I changed my code to that, and it worked perfectly. Much appreciated.

Re: Dropbox currency option

Posted: Thu Mar 01, 2012 7:13 pm
by Xellz
Icebox wrote:Thank you very much, Qphoria. I changed my code to that, and it worked perfectly. Much appreciated.
You can also make it as list, which will allow for far more option, on how it will appear. With CSS there are plenty ready options for menus that you can alter any way. I've just completed my own, you can check how it looks here - http://www.japantea.org/shop

And code to make a working list, here i'm also adding flags to each currency:

Code: Select all

  <?php if (count($currencies) > 1) { ?>
  				<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="currency_form">
					<div id="currency">
					
					
					<?php foreach ($currencies as $currency) { ?>
					<?php if ($currency['code'] == $currency_code) { ?>
					<?php } ?>
					<?php } ?>
					<ul id="cswitch"><li><a><?php echo $text_currency; ?></a><ul>
						<?php foreach ($currencies as $currency) { ?>
							<li><a onclick="$('input[name=\'currency_code\']').attr('value', '<?php echo $currency['code']; ?>'); $('#currency_form').submit();"><img class="csswitch_image" src="catalog/view/theme/...../....../flags/<?php echo $currency['code']; ?>.png" title="<?php echo $currency['title']; ?>"/><?php echo $currency['code']; ?></a></li>
						<?php } ?>
					</ul></li></ul>
					</div>
						<input type="hidden" name="currency_code" value="" />
						<input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
				</form>
  <?php } ?>

Re: Dropbox currency option

Posted: Mon Mar 05, 2012 2:15 am
by cabte
only just noticed the replies sorry.

Thanks for the info everyone.
carl

Re: Dropbox currency option

Posted: Mon Mar 05, 2012 2:35 am
by cabte
Iv tried both codes and it wont work for me im afraid
could it have something to do with the template im using?

Re: Dropbox currency option

Posted: Mon Mar 05, 2012 2:45 am
by cabte
Sorry guys its me it would help if i was trying to code the correct theme.plonker
works great