Currencies as Icons in 2.3.x

By | March 26, 2013

Almost exactly 5 years ago I posted about using icons for currency selection. The question still comes up fairly regularly in the osCommerce forum.

So, here’s how to do it in 2.3.x – you’re going to end up with something like this:


You need to make a “currency” icon for each currency that you have. In a standard installation of osCommerce, this is EURO’s [ EUR ] and US Dollars [ USD ]. Save them into the /images/icons/ directory as .png files like so; EUR.png USD.png

Next up open up /includes/modules/boxes/bm_currencies.php

Step 1: create a variable holder

$currencies_string = NULL;

this line of code needs to be placed in the execute() function, right underneath the line that starts global $PHP_SELF …

Step 2: create the variable

Here we need to loop through the available currencies and output them as an image. Code;

This should be added underneath this line of code: reset($currencies->currencies);

Step 3: Change the $data to output the $currencies_string

Done. Refresh your page and you should see your currencies box as images. Of course, I could make this into a better addon allowing you to associate an image with a currency from within the admin area, but that’s for another day if someone wants it badly enough.

In action

3 thoughts on “Currencies as Icons in 2.3.x

  1. arlisabijoux

    I definitely want to try this, it looks awesome! ok, dumb question, but do all the code changes take place in just 1 file: /includes/modules/boxes/bm_categories.php ?

  2. oscbooks

    All the code changes in the one file; bm_currencies.php (I fixed my mistake in the post as I put bm_categories !). And of course the icon files that you’ll need to create.

Leave a Reply

Your email address will not be published. Required fields are marked *