Post by wackyracer8 » Mon Apr 09, 2012 10:15 pm

Hi Guys,

I'd like to first have the currency symbols in a particular order and then I'd then like to replace the symbol with their flag instead. What would be the best way to do this?

Active Member

Posts

Joined
Fri May 13, 2011 1:15 am

Post by wackyracer8 » Tue Apr 10, 2012 12:06 am

Would I need to edit currency.php with something like below;

Code: Select all

'symbol_left'   => $result<img src="['symbol_left']" />,
The above code does not work but is going in the right direction? I then add the image url into the symbol left box from the admin side?

Active Member

Posts

Joined
Fri May 13, 2011 1:15 am

Post by wackyracer8 » Tue Apr 10, 2012 6:07 am

Ok so after spending ages on this I have now worked out its all done within the currency.tbl file, the code inside this is as follows;

Code: Select all

<?php if (count($currencies) > 1) { ?>
<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>
<?php } ?>
What do I need to change to enable to use an image rather than the symbol. Someone please help me.

Active Member

Posts

Joined
Fri May 13, 2011 1:15 am

Post by wackyracer8 » Tue Apr 10, 2012 8:12 am

Right for anyone who wants to change the currency symbol to flags this is what I done...

for each currency title I put the url of the flags image, eg domain.com/image/uk.png
I then edited the currency.tbl file to the following...

Code: Select all

<?php if (count($currencies) > 1) { ?>
<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><img src="<?php echo $currency['title']; ?>"/></b></a>
    <?php } else { ?>
    <a title="<?php echo $currency['title']; ?>"><b><img src="<?php echo $currency['title']; ?>"/></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();"><img src="<?php echo $currency['title']; ?>"/>	</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();"><img src="<?php echo $currency['title']; ?>"/></a>
    <?php } ?>
    <?php } ?>
    <?php } ?>
    <input type="hidden" name="currency_code" value="" />
    <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
  </div>
</form>
<?php } ?>

All I need to do now is work out how to order them, which I'm finding pretty difficult, any ideas? I don't understand why the currencies doesn't have a standard sort order like most of the choices on here!

Active Member

Posts

Joined
Fri May 13, 2011 1:15 am

Post by barryman » Mon Sep 24, 2012 3:09 pm

I think I sorted out the order of currencies by renaming them ie. 1-British Pound 2-US Dollars etc etc. That put them displaying in the ight order. Haven't tested to check functionality yet but it should be OK

Newbie

Posts

Joined
Sun Sep 16, 2012 12:35 am

Post by sachinjariyal » Thu Apr 04, 2013 2:47 pm

my url is to big so (admin panel) is saying characters under 3 or 32 so plz help me as soon as possible

Newbie

Posts

Joined
Thu Apr 04, 2013 2:44 pm

Post by tora0515 » Wed Jul 17, 2013 1:26 pm

Thanks a bunch for the post, just what I was looking for.

Thought I would throw my 2 cents in to improve it a bit:

Change all 4

Code: Select all

<a title="<?php echo $currency['title']; ?>
to

Code: Select all

 <a title="<?php echo $currency['code']; ?>
Do this so that when the images are hovered over they don't show the link to the image, instead you will get the ISO code, so instead of "domain.com/image/uk.png" you would get "GBP" when the mouse hovers the image.

Active Member

Posts

Joined
Fri Jun 15, 2012 3:05 pm
Who is online

Users browsing this forum: No registered users and 22 guests