Post by cabte » Mon Feb 27, 2012 10:01 pm

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
Last edited by cabte on Mon Mar 19, 2012 4:33 pm, edited 1 time in total.

www.firststopdecals.co.uk
www.creativedecals.co.uk
www.jujucats.co.uk


New member

Posts

Joined
Thu Jan 19, 2012 8:41 pm

Post by Icebox » Tue Feb 28, 2012 10:36 pm

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.

Newbie

Posts

Joined
Fri Feb 24, 2012 6:13 pm

Post by Qphoria » Tue Feb 28, 2012 11:11 pm

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

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Icebox » Thu Mar 01, 2012 10:41 am

Thank you very much, Qphoria. I changed my code to that, and it worked perfectly. Much appreciated.

Newbie

Posts

Joined
Fri Feb 24, 2012 6:13 pm

Post by Xellz » Thu Mar 01, 2012 7:13 pm

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 } ?>

Japanese green tea


New member

Posts

Joined
Fri Feb 11, 2011 8:55 pm

Post by cabte » Mon Mar 05, 2012 2:15 am

only just noticed the replies sorry.

Thanks for the info everyone.
carl

www.firststopdecals.co.uk
www.creativedecals.co.uk
www.jujucats.co.uk


New member

Posts

Joined
Thu Jan 19, 2012 8:41 pm

Post by cabte » Mon Mar 05, 2012 2:35 am

Iv tried both codes and it wont work for me im afraid
could it have something to do with the template im using?

www.firststopdecals.co.uk
www.creativedecals.co.uk
www.jujucats.co.uk


New member

Posts

Joined
Thu Jan 19, 2012 8:41 pm

Post by cabte » Mon Mar 05, 2012 2:45 am

Sorry guys its me it would help if i was trying to code the correct theme.plonker
works great

www.firststopdecals.co.uk
www.creativedecals.co.uk
www.jujucats.co.uk


New member

Posts

Joined
Thu Jan 19, 2012 8:41 pm
Who is online

Users browsing this forum: No registered users and 41 guests