Upgrade to 2.3.1 – scared? Database problems?

I know that a lot of people are considering upgrading to 2.3.1 version of osCommerce as 2.3.1 is a lot better coded than the older versions.

The one thing holding people back from upgrading appears to be the database changes. It is quite straightforward to make the changes if you are patient enough to sit down and work through your existing database, changing and editing it to reflect the changes that 2.3.1 requires.

If you do not want to do that, then I have a solution for you. Send me a dump of your existing database, I will make the changes then send back to you a new DB dump suitbale for use on 2.3.1 (including all your existing data).

For this, I would charge a beer fee, so if it’s of interest contact me on oscshops@gmail.com to discuss.

Admin Create Customer Account

Someone at the osCommerce forum posted for a way to manually create a customer account in osCommerce 2.3.1. A similar addon does already exist for older versions of osCommerce, but the code leaves a bit to be desired.

Step 1. Create the “Add A Customer” form to the admin

– copied the create_account.php page from the shop side and made a few changes to suit the differences in code between “shop” and “admin” files. Also ported over any included files (such as form_check.js)
– removed some of the un-needed code from the file
– amended other files to suit (filenames.php, language files and so on)

Step 2. Add the link to the new page into the customers infobox

And here it is in action;

This will be released into the osCommerce App Store when it opens to the public, until then it is available directly from me as a commercial addon, priced to suit your site (including installation).

Change the Image System

I had a few emails recently to tell me that the product images on my own osCommerce site left a lot to be desired. I agreed, especially as my products are mainly about “how they look”. I was using the standard multiple images in 2.3.1 – so, I set out to find a new way to present the product images.

One I found which I really liked the look of is Soh Tanaka’s Image Rotator of which the “how to” is here.

As 2.3.1 now has it’s own image system, it was straightforward to amend. The thumbnail image is still in the PRODUCTS table of the database and the extra images are in the PRODUCTS_IMAGES table. So, this made it easy to make the whole thing work.

Step 1 – change of use for the admin/categories.php
– to allow me to add HTML descriptions to each image. Actually no code change needed for this, I simply utilised the “HTML Content (for popup)” input box;

Step 2 – recode the product page
– to output the extra images in a list and show the larger image. Fairly straightforward, simply following the instructions in the “how to” whilst realising that the output needs to come from the Database.

Step 3 – add the javascript
– easy enough just copy and paste from the “how to” into the template_top.php file

That’s it. All done, looks good. Presents the images a little better for my needs, and should help with sales.


Hopefully you can see that making any change in osCommerce is quite possible with a little bit of work.

Add Customer Reviews in Admin

A fellow osCommerce professional asked if I had heard of an add-on that allows the Shop Owner to add a customer review. I was sure that I had created something similar in the recent past, but could not find it, so I set out to code it up.

Step 1: add a “add a new review button”.

When clicked, this leads to;

Step 2: the “adding a new review” form.

Here the Shop Owner can choose the product being reviewed, chosoe the customer doing the review, insert the review text and the review rating. Obviously, sometimes customers will send Shop Owner email about the product they purchased, and this makes it easy to add the review…without having to ask the customer to sign and recreate the email sent to Shop Owner.

As you can see, fairly straightforward. No bells and whistles, just does what it needs to do. Let me know if you have any ideas to make it better?

960 grid system overlay

Just came across a tweet from Nathan Smith (creator of 960 grid system), which directed me to a new Chrome plugin called 960 Grid System Overlay. With this installed it is very easy to see how a site is coded using the 960 grid.

Installation is super simple, just visit that page in Chrome and press “install”. When you then browse (using Chrome browser obviously) onto a site that is using the 960 system, a 960 icon appears in the right hand side of the URL bar in the browser;

If you then click the 960 icon, a grid appears showing you the layout (columns and gutters) of the site you are looking at;

It’s a useful extension that I can see myself using very often! Hat tip to Nathan Smith for the tweet and to Bruno Rino for the actual extension – nice work.

Turn off Payment method based on currency used

Had an email overnight from an osCommerce user who needs to turn on and off payment methods based on what currency is being used in the checkout. I thought I had covered this already in the blog, but could not find it. So here we go;

1. Add an extra input to each payment method used

This allows us to add a list of currencies supported by the payment method.

As you can see in the example above, I have set the currencies to GBP (British Pounds) and EUR (European Euros).

Code changes (taking cod.php as the example):

function install() {

Add an extra line of code, as so:
tep_db_query(“insert into ” . TABLE_CONFIGURATION . ” (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values (‘Currencies available for this payment method.’, ‘MODULE_PAYMENT_COD_CURRENCIES_ACCEPTED’, ”, ‘Comma separated list of accepted Currencies.’, ‘6’, ‘0’, now())”);

function keys() {



Turn off the COD module if you already have it turned on. Turn it on again to reset it. You now have the necessary input box to allow you to add the currencies acceptable.

2. Turn the module off if an unacceptable currency is used

Still working on cod.php ….

// disable the module if the order only contains virtual products

Above this, add:
[php]// disable the module based on available currencies
$good_currencies = explode(‘,’, MODULE_PAYMENT_COD_CURRENCIES_ACCEPTED);
if (!in_array($order->info[‘currency’], $good_currencies)) {
$this->enabled = false;

Here, we create an array of acceptable currencies using explode. We then compare the currency being used to those acceptable currencies. If the currency being used is NOT found in the list, then the module is turned off.

Easy as 123.

You would need to do similar for every payment module that you use. Make sure to change this: _COD_ to reflect the name of the module you are amending.

Adding the Google +1 button

The +1 button is shorthand for “this is pretty cool” or “you should check this out.”

Click +1 to publicly give something your stamp of approval. Your +1’s can help friends, contacts, and others on the web find the best stuff when they search.

So, I thought why not give it a go. At the moment it’s available only on .com version of Google, which I never use, but I expect it to be rolled out to all google sites soon. So let’s get ready for that.

There appears to be two ways in which a user can +1 a site;

1. Via the google.com search interface

You can see the +1 button. When clicked it turns blue.

2. Via your own site. To enable this we need to add some code to osCommerce. The code can be found at http://www.google.com/webmasters/+1/button/index.html

Simply decide which button you want to show, and copy/paste the code! What could be simpler?

Code Changes

Step 1. Open up /includes/template_top.php and add this line of code just before the </head>

<script type=”text/javascript” src=”http://apis.google.com/js/plusone.js”></script>

Step 2. Open up whichever file you want to add the +1 to. In my case, I chose to put it only on the product pages, hence product_info.php

Notice the extra line of code at line 76? That’s it! Now, the +1 button is active and ready to go.

If you are on an older version of osCommerce you would be changing /includes/header.php rather than includes/template_top.php and placing the +1 button in a table somewhere in product_info – the basis of the change is exactly the same whether you use 2.3.1 or 2.2.

Got Fork? Make sure you know enough…

The other day I was contacted via email by a member of the osCommerce forum asking a very basic question about how osCommerce displays categories.

This person offers a fork of osCommerce…in my opinion anyone who forks needs to have enough knowledge to not ask ANY questions in the osCommerce forum, or make sure that they have a team around them who can deal with these situations.

Am I being unreasonable?