Green Template Problems, Green to osCommerce

Francis asks

Hi there!  I just downloaded your template and installed it on my newly created oscommerce site.  I’m pretty new to this, so please be patient.  But now when I visit the site, it’s blank???  Everything is fine on the admin side.  Not sure what to do.  Any suggestions?

As you are installing on a brand new osCommerce, simply start over – that’s always the easy way to check that what you have done is correct.  Usually balnk pages are symptomatic of corrupted uploads.  I know the Green design is OK as lots and lots of shops are presently using it.

However, I want to also bring two more things up whilst answering…

1.  Do you really want to use a template that lots of other shops also use.  I know for a fact that there has been over 650 downloads of that template directly from this site, with another few thousand directly from the osCommerce site.  If even 10% of those downloaders are using it, that’s over 300 sites using the exact same design.

2.  You are new to osCommerce! Instead of using a solution (in this case a template) to make things easy, my suggestion for you is to dig into the codebase a little bit yourself.  Re-install a new osCommerce and make some design changes – maybe move some stuff from the sidebars into the header area – then give the whole thing a bit of a design change.

Both these points can be solved very easily by having a look at two products that I offer.  First one is the “osCommerce on localhost package” and the second one is the “Designing osCommerce” eBook – if you use both these in conjunction with each other you’ll learn enough to create yourself a really nice looking design that no-one else is using, and you’ll be able to do it on your Home Computer so you can see the changes you are making instantly rather than have to download and upload via FTP!

I hope this helps. Gary

osCommerce on localhost Tutorial

I just finished up the “osCommerce on localhost” package and it has been tested by a handful of people.  So I’d like to introduce the “osCommerce on localhost” tutorial over at

This package auto installs the following onto your windows computer:

  • PHP, MySQL and PHPMyAdmin
  • osCommerce
  • osCommerce with STS

Already got an osCommerce Store online?

The tutorial shows how to take a “live shop” (let’s say one that’s been running for a few months or years) and mirror it exactly on “localhost” – what this does is give you your own store on which you can make as many changes as you like safe in the knowledge that your “live shop” is not going to break because of your coding errors.  Or maybe you want to try to install a contribution but don’t want your site showing errors whilst you are doing it?  Or maybe a re-design is in order?  Do it on your home computer, then MIRROR it onto your live site!

Or are you a “newbie” to osCommerce?

Well now you can test out osCommerce as much as you like without having to purchase a domain name or hosting.  Once you are happy with it, it’s simple to mirror image the “localhost” site to a “live” site by simply following my directions.

I would post more, but you might just as well go to the oscbooks site and have a read of exactly what is contained in the package.


Version 2 of Gift Vouchers and Discount Coupons (MS2, RC1, RC2)

STOP PRESS: This contribution is now updated to Version 5 and has all sorts of cool extras. Please see the latest post about this.

I wanted to give an update on where the GV DC contribution presently stands.  It’s been updated to Version 2.

Version 2 works with;

  • osCommerce MS2
  • osCommerce MS2 (060817)
  • osCommerce RC1
  • osCommerce RC2
  • osCommerce RC2a

Version 2 also deal with Tax properly, which was problematic with Version 1.x

Due to the number of problems that people had installing Version 1.x – I haver decided at the moment to offer this contribution only as an installable service.  The cost of an install is a usually about $50 and my guarantee is that it will work as it is intended to, or you receive a full refund.

So, if you want to have a Discount Coupon system in YOUR osCommerce store that DOES work with Tax calculations and is coded very cleanly, please contact me on and we can go from there.  Install can be made on ANY osCommerce store, whether it is a Template Monster templated store, a highly modified store or even a brand new install.

If you do not want to pay me too install

That’s not a problem – the older version is readily available at the osCommerce Contributions area.  And you can install it yourself, make any changes to it etc.

Vouchers, Tax and Open Source

My discount contribution is a great success – it’s been downloaded thousands of times and I’ve installed it on at least 20 live shops.  But it has/had a glaring ommission – TAX – and for a good reason…

However, people like to say things such as;

I was just wondering why the tax calculation has been left out again and was upset about it as it seems most coupon/voucher script coders forget about it.

Well, it wasn’t forgotten about – it’s just that us coders who make FREE contributions like to get them out of the door in the hope that someone would take up the challenge and make it work for their particular situation.  After all, if every Open Source coder waited until the product was absolutely perfect, there would be no Open Source, at all, ever.

So, I decided to make it happen.

The Voucher system has been updated and now reflects the proper tax settings within your Live Shop…here’s an example:

In the example, you can see the Total Cart amount is $90, with a coupon amount of 10%, making a deduction of $9.  Leaving $81 to pay.  Florida Tax is 7.0%, so 7.0% of $81 is $5.67.  Shipping costs $5 – so the total to pay is $91.67.

Before the updated codebase, the contribution would have worked like this:

Sub Total: $90.00
Coupon:  -$9.00
Shipping:  $5.00
FL Tax 7.0%: $6.30 (that’s 7.0% of $90, it was disregarding the coupon reduction)
Total (to pay): $92.30

I hope that this is now suitable for all those who wanted Tax Calculations inbuilt but did not have the opportunity to take the code and make it themselves!

Of course, I still have to do some more testing, but I think that it works quite solidly as it is.  Once I have tested it to my satisfaction, I will make it available.  If you want/need it urgently in the meantime, please contact me.

osCommerce and PHP 5

Loretta asks;

I hope you can give a piece of advice regarding whether osCommerce v2.2 ms2 will work with PHP 5.2.5? I new to osCommerce and my client’s shop is v2.2 ms2 – live for 4 years. The hosting company will be moving all their servers to this newer version of PHP by December, January 2009 (the latest they say) and will no longer support any PHP 4.x versions. So can ms2 work with PHP 5.2.5 and if so what needs to be done? Should we put off undertaking a major redesign of her existing osC shop till this is figured out?

I’ve been searching the osCommerce forums and can’t seem to find a post directly addressing this question – some only hint that it’s possible, but I need to know for sure. Can you advise and maybe point me in the right direction?  Your help is greatly appreciated!

Ok, osCommerce does work in PHP5 – but it is problematic if you are running an older version such as MS2. You will need to make a lot of code changes in order to keep using it, as I have no doubt that whilst upgrading to PHP5, they will also turn register globals off (which is a good thing) and make other changes such as upgrading MySQL to v5. So you will get lots of errors due to the way that osCommerce is coded – all of which are solvable with a bit of work.

I’ve been updating osCommerce stores to php5/sql5 and it’s a total pain to do it.

More recent versions of osCommerce should work with php5/sql5 without any problems – so my advice to you is to update your clients shop to the latest available version (which at this moment is RC2a). Obvioulsy this means that you will need to migrate your customers database (retaining the products, customer lists, orders etc) and re-install all the contributions she presently has – bear in mind that some contributions which work in MS2 will not work in RC2a.

By the time you do make the upgrade, osCommerce Version 3 might be out (don’t hold your breath though!).

Hope this helps, Gary

osCommerce Breadcrumb Tips

Breadcrumbs or breadcrumb trails are a navigation technique used in user interfaces. Its purpose is to give users a way to keep track of their location within programs or documents. The term is taken from the trail of breadcrumbs left by Hansel and Gretel in the popular fairytale.

In osCommerce, the breadcrumb is made up of;

Link to Domain Name > Link to Catalog Install > Link to Category > Link to Product Model

Which isn’t too useful in my opinion.  In fact, I’d go further and say that Breadcrumbs are vurtually useless in almost all ecommerce shops – why have a breadrcumb when there is already a “category” menu and “back” button in a persons browser.

Many years ago, when I was part of a small design team, we actually had shoppers in the office watching how they used site.  As I recall, maybe 1 in 20 actually used the breadcrumb feature of a standard osCommerce installation.

Anyway, if you do have a Breadcrumb, here’s a few tips

If you want to remove the link to your Domain Name, open up /includes/application_top.php and remove this line of code:

[php]$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);[/php]

If you simply want to change the word “Top”, open up /includes/languages/english.php and change this line of code:

[php]define(‘HEADER_TITLE_TOP’, ‘Top’);[/php]

If you want to remove the link to your Catalog install, open up /includes/application_top.php and remove this line of code:

[php]$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));[/php]

If you simply want to change the word “Home”, open up /includes/languages/english.php and change this line of code:

[php]define(‘HEADER_TITLE_CATALOG’, ‘Home’);[/php]

If you do not use the “Product Model” field in your product specs, then you might as well use something else in the breadcrumb – I think that using Product Model is dumb anyway – it’s hardly helpful to the customer…so open up /includes/application_top.php and find this:

[php]// add the products model to the breadcrumb trail
if (isset($HTTP_GET_VARS[‘products_id’])) {
$model_query = tep_db_query(“select products_model from ” . TABLE_PRODUCTS . ” where products_id = ‘” . (int)$HTTP_GET_VARS[‘products_id’] . “‘”);
if (tep_db_num_rows($model_query)) {
$model = tep_db_fetch_array($model_query);
$breadcrumb->add($model[‘products_model’], tep_href_link(FILENAME_PRODUCT_INFO, ‘cPath=’ . $cPath . ‘&products_id=’ . $HTTP_GET_VARS[‘products_id’]));

and change it to this:

[php]// add the products NAME to the breadcrumb trail
if (isset($HTTP_GET_VARS[‘products_id’])) {
$model_query = tep_db_query(“select products_name from ” . TABLE_PRODUCTS_DESCRIPTION . ” where products_id = ‘” . (int)$HTTP_GET_VARS[‘products_id’] . “‘”);
if (tep_db_num_rows($model_query)) {
$model = tep_db_fetch_array($model_query);
$breadcrumb->add($model[‘products_name’], tep_href_link(FILENAME_PRODUCT_INFO, ‘cPath=’ . $cPath . ‘&products_id=’ . $HTTP_GET_VARS[‘products_id’]));

If you want to change the “seperator” in your breadcrumb from > to something else, open up /includes/header.php and find this code:

[php]$breadcrumb->trail(‘ » ‘)[/php]

and change it to whatever symbol you wish to use.  I think I’ll use a forward slash, so I would change it to this:

[php]$breadcrumb->trail(‘ / ‘)[/php]

If you don’t want the breadcrumb at all, open up /includes/header.php and remove this portion of code:

[php]<td class=”headerNavigation”>&nbsp;&nbsp;<?php echo $breadcrumb->trail(‘ &raquo; ‘); ?></td>[/php]

There you have it, an intro to using the breadcrumb.  Nice and easy, ain’t it?

Changing the Logo

Changing the Logo of a standard install of osCommerce is really easy – all you need to do is upload a new file to overwrite the exisitng file called store-logo.png

In this example, I have added a stripey green background to the area where the logo resides – in order to demonstrate what I mean;

As you can see, because the existing osCommerce logo has a white background, it looks bad.  What I need to do is make a new logo that has a transparent background.  Easy enough – I just open Photoshop and make a quick logo – I save it as a png24 file, and overwrite the old logo…

Now the logo area looks like this:

This is now looking much better, as the green stripes show through the transparent areas of the logo that I made.  Much better!

However, some older browsers just cannot handle PNG files at all well – a prime example of which is Internet Explorer 6 – which a lot of people still use.  In IE6, that same logo looks like this:

As you can see, this is very ugly – so we have two options;

  • Change from PNG to GIF (gif files have transparency available)
  • Use Javascript to remove the grey background and make it transparent

I’ll explain these two options more in-depth in my next blog post.

Top 100 Update

Haven’t had an update for a good few weeks, so let’s do that – the Top 100 osCommerce sites;

The Top 5 as at 9am on 3rd may 2008 are;

  1. TexereSilk
  2. Prodotti Tipici e vini piemontesi
  3. Click A Deal
  4. Breast Pumps Store
  5. Arabella Miller

These are the 5 Hottest Stores right now, according to the votes 😉  What do you think?  Agree or Disagree – make your vote now at the osCommerce HOT 100.

New Additions

  1. Custom Fit

Those that didn’t make it

I’m still getting sites submitted that are absolutely crap – please don’t bother submitting if your site has the look of a typical osCommerce site.  If all you have done is made the infoBoxes a different colour or removed a column then your site will not be authorised.  You need to have at least one EXCEPTIONAL design feature…

If you don’t know how to make a good looking site, then use a template!  Anything is better than standard osCommerce!  See here for a design tutorial – I’m tired of having to look at horrible osCommerce sites 🙁

Change Header Background Colour Per Category

Interesting questions posed at the osCommerce Forum;

i want to make the header color change when the visitor selects a main category. each main category should have it’s own color.

My reply;

Use a switch on $current_category_id with a stylesheet named the same number.

In depth;

  • We know that $current_category_id gives the ID of the category that is currrently active. We therefore are able to create lots of different stylesheets in order to make each category look different.
  • We know that index.php is the only file that controls Categories – so the code change needs to go in this file.
  • We know that CSS allows us to cascade the style – in other words, css is overridden by later css of the same name.

So, we are able to use a PHP function called “switch” to show a 2nd stylesheet! Like this:

case 2:
echo ‘‘;
case 3:
echo ‘‘;

This code would be added to index.php right underneath the existing line of code;


Contained in each .css file would be css code for background colours to OVER-RIDE what you have already defined in the usual stylesheet.css – I’m not going to go into css on this blog post, as I only want to give a brief overview of how I would enable a different theme per category – once I have made a “purple.css” this would then be automatically used for Category ID 2.

Hopefully this blog post will give you some ideas for your own site.

How to know what Version of osCommerce you are using…

A question that gets asked almost daily in the osCommerce forum is;

What version of osCommerce am I using?

I can understand why this is so difficult for users to know…with osCommerce being an open source product, it’s possible to get osCommerce from lots of different “vendors” (free or otherwise). I’ve seen osCommerce packages on eBay, at other forums, on osCommerce “expert” sites etc etc.

The easy way to find out what version you are using is to open /includes/application_top.php and find this piece of code;


After this you will see the version of osCommerce that you are using. In the example I am looking at right now, it says;

[php]define(‘PROJECT_VERSION’, ‘osCommerce Online Merchant v2.2 RC2’);[/php]

Incarnations of osCommerce include;

  • osCommerce 2.1
  • osCommerce 2.2
  • osCommerce 2.2 MS1
  • osCommerce 2.2 MS2
  • osCommerce 2.2 MS2 060817 (is MS2 with a few bug fixes and other updates)
  • osCommerce 2.2 RC1 (is 060817 with a whole load of new stuff, including new database entries etc)
  • osCommerce 2.2 RC2 (is RC1 with a few bug fixes)
  • osCommerce 2.2 RC2a (is RC2 with a couple of bug fixes)

The RC releases are (hopefully!) eventually building up to a release of osCommerce v3 -in the meantime, osCommerce has changed it’s name to “osCommerce Online Merchant” rather than just osCommerce – but everyone still knows it as osCommerce.

So, are you more confused than ever?  Me too 😉