Free Gift Chooser for osCommerce

My fellow developer and good friend Scott over at has come up with an interesting system to allow discounts up to 100% on products when purchasing other products.

For example, you can set up:

Give 100% discount on “The Matrix Reloaded” when purchasing “The Matrix”. In this way, it is like giving a free gift.

Here is the admin interface for setting up these offers:


And here is how the discount shows in the checkout:


And here is a video:

If you are interested in this addon, contact Scott directly.

Installation is super-simple, and you can extend it very easily by having a page or something more cool showing the offers…

Google Adwords Conversion Tracking for osCommerce

Here’s the next script that I need a couple of testers for, a cleanly coded “Header Tags” module for Adwords Conversion Tracking, written for 2.3 series of osCommerce.

This basically installs very easily, like any other header_tags module and allows you to track your adwords conversions on a order by order basis.

What do you need to be a Guinea Pig?

1. You need to be able to install a Header Tag module.
2. You need to be spending on adwords
3. Your site needs to have a “success” page aka checkout_success.php


Email me on oscshops AT gmail DOT com

Lead Time – handmade products

Project for today was to build a system to allow a shopowner to assign a leadtime to products. For example, a hand made product that takes 3 days to produce. Now imagine shopowner sells 50 or 60 such products, some of which can be sent immediately, some take 3 days to produce, some take 5 days. Or another scenario is if shopowner has a supplier who takes a little time to get products to him to resend to customer…you get the idea, I’m sure.

So, shopowner can now set up individual products to have a “lead time” in days;

Of course, products could all have the same amount of lead time, or could have different amounts. I then made logic that grabs the value (in days) of the product being purchased that has the highest leadtime and works out the next available working day based on this;

In this example you can see the matrox has a lead time of 5 days, and the printer has a lead time of 1 day. The message underneath takes the higher amount of days and works out 5 working days from order date. Saturdays and Sundays are not counted as working days, and I have also added the ability for the shopowner to add in bank holidays, vacation time and so on.

In the checkout process, I also show a similar message;


A good way for shopowner to let customers know that some products are not available immediately!

Backport 2.3.1 images to 2.2

There are loads of multiple images contributions for 2.2, I even made one myself years ago. Since 2.3.1 came out I have been quite impressed with the admin functionality and shop funtionality of the multiple image system – I previously blogged about it here.

Last week, a new client (still on osCommerce 2.2) approached me wanting to add up to 12 images per product – easily possible, but I thought it would be good to backport the 2.3.1 system.

The reason I decided to do this is two-fold;

1. I like the 2.3.1 images system.
2. If the client ever upgrades from 2.2 to 2.3.1 it is simple to use the same images table.

Older images systems in 2.2

Most, if not all, of the older ways to add multiple images involve adding new rows to the products table. products_image2, products_image3 and so on. I needed to update a 2.2 shop to 2.3.1, and that shop had multiple rows added like this – which meant more work for me – I had to write a script to take the images from the products table (2.2) and transfer them to the new products_images table (2.3.1).

I’ll bundle it up as a contribution as soon as I have time.

Coming Soon, Links Manager for 2.3.1

There are a couple of add-ons for managing links, I have tried them and I have not been impressed with any of them. Some are bloated, some have redundant code, some are just plain dangerous when it comes to using them for SEO. All are ugly.

My idea is to code up a new system to allow the Shop Owner to add links. And then have page, using tabs, to show the link category and links, a bit like this mockup;

Should be interesting to see what I can come up with.

In my opinion, the point of a links module is to allow the Shop Owner to help customers get to other sites. Reciprocal links (or in other words, you link to me, I’ll link to you) are outdated and should not be used for SEO purposes. What’s your thoughts on links to/from other sites?

Manufacturers in osCommerce

Yesterday, I was asked to quote on making some changes to the Manufacturer system in osCommerce. At the moment it is quite limited as all you can do is add the Manufacturer Name, Logo and URL. These then show in an infoBox, based on the manufacturer of the product that you are looking at;

I was asked to quote on adding a PDF per manufacturer and a system for adding “sales info” and a “manufacturer description” per language for each manufacturer. All this to then be shown in the individual manufacturer page (per language) in the osCommerce shop.

A normal manufacturer page looks like this.

I needed to change this quite a bit, as so;

Basically displaying the two blocks of text, the homepage link, the PDF and the Manufacturer Name (instead of “Let’s See What We Have Here”).

Pretty straightforward, I cooked up my own solution for all of it, and the code as it stands is rough but workable – it’s what is known as “proof of concept” code. Once this client make a buying decision then I will clean it up and make it available for all.

Here’s the new Admin manufacturer page;

Voucher Module for Burts Coupon System

Well, I have had more than a handful of requests for this, so it’s time to think about getting it coded. It was always my intention to do this, but other work of course gets in the way.

In order to raise the necessary funds for coding to be started, I’m going to raise the price of the coupons system to $99. The price includes installation and support, and ongoing free updates.

However, for the next 20 coupon system buyers the price will remain at $50, then the next 10 will pay $75. After this $99 will be charged.

I have no release date set for the vouchers module of the coupons system, but everyone who has already purchased my coupons system will get the update free of charge, just as soon as it is coded and beta tested.

So…if you were umming and ahhing about my coupon system, either because of price or because it doesn’t have vouchers, now is the time for you to stop prevaricating and get an install done.

As another client has it installed, I will update this thread with the number of spots remaining at the lower prices.

To go forward with an instal discussion, please email me on

Half Kilos in osCommerce shipping

Yesterday I was asked by a client to create quite a complicated shipping module. The module (now it’s completed) is a mash up of zones (but by states not countries), by weight per kilo and half kilo, via two separate couriers. It basically covers 3 different zones, in zones 1 and 2 are a number of states – these are charged by the kilo at $x and the first 3 kilos are charged at $y.


Zone 1:
First 3 kilos (or part thereof): $10
Extra Kilos above 3: $2.50 per kilo

Similar for Zone 2. Zone 3 is different in that the first 3 kilos are charged at $20, and each HALF kilo (or part thereof) thereafter is charged at $3. This brought a difficulty to the codebase – as if the total weight was say 5.8kgs, the charge should be:

First 3 kilos: $20
Next 3 kilos: $3 per half kilo
Total: $38

What was actually being charged was:

First 3 kilos: $20
Next 2.8 kilos: $3 per half kilo
Total: $36.80 [being $20 + ((2.8 * 3)*2)]

So what I had to do was find a way to round up any weight to the next nearest 1/2 kilo (unless of course the total weight is already a full kilo or a half kilo. So, for example:

3.0 stays at 3 kilos
3.1 is increased to 3.5 kilos
3.2, 3.3, 3.4 all increased to 3.5 kilos
3.5 stays at 3.5 kilos
and so on

This proved more difficult than I thought, but after a bit of lateral thinking I came up with:

[php]$num = 3.2;
$down = $num/0.5;
echo ceil($down)*0.5;[/php]

In the code, we are doing the following…

Assuming that we are looking to round 3.2, we divide 3.2 by 0.5. This gives us 6.40. Then we use the ceil function of PHP to automatically increase this to the next nearest integer which is 7. Then we multiply 7 by 0.5 to get the end result which is 3.5.

Sounds more complicated than it is! What this enabled me to do was set up zones differently for charging the correct amounts. Here is some of the codebase of the new shipping module that I created;

[php]// dest zone = 1 or 2
$shipping_cost = (($shipping) * (ceil($shipping_weight)-3)) + $handling;

// dest zone = not 1 and not 2
if ($dest_zone == 0) {
$the_weight = $shipping_weight-3;
$down = $the_weight/0.5;
$up = ceil($down)*0.5;
$shipping_cost = (($shipping) * (($up)*2)) + $handling;

$shipping_method = MODULE_SHIPPING_ZONES_ZCBK_TWO_TEXT_WAY . ‘ ‘ . tep_get_zone_name($order->delivery[‘country’][‘id’], $order->delivery[‘zone_id’], ”) . ‘: ‘ . $shipping_weight . ‘ ‘ . MODULE_SHIPPING_ZONES_ZCBK_TWO_TEXT_UNITS . ‘ (‘ . $way . ‘)’;[/php]

The above won’t mean much to non-coders, but it’s possible to see that I am doing a number of things within this module that are completely non-standard osCommerce. Shipping Modules are quite straightforward to code from scratch – I suppose that it’s one of my specialities!

So, if you need some complicated method of shipping coded up, feel free to contact me.

SEO Urls 5 by FWR Media & HT SEO 3 by Jack MCS

Today I had a client who needed HT SEO installed on a site – no real problems as it’s a nice contribution that is well maintained by Jack MCS. However this client is running a Template Monster template, which, as we all know, is the epitome of crap coding…

However, the installation was made. To find that it did not work. After some bug-hunting, I was 100% sure that the error lay with the FWR Media’s SEO Urls 5. So I turned it off. And HT SEO started working flawlessly. Turn it back on and it stopped working…

So, more investigations…led me to see that HT SEO depends greatly upon this: [php]basename($_SERVER[‘PHP_SELF’])[/php] to ascertain which page is being shown in the browser and hence which “tags” to load up and show. My thought was that SEO Urls was in some way blocking this from happening, which was causing the tags not to load, particularly on product_info.php.

So, I opened up /includes/header_tags.php and found this piece of code; [php]require_once(DIR_WS_FUNCTIONS . ‘clean_html_comments.php’); // Clean out HTML comments from ALT tags etc.[/php] Right below it, I added this: [php]echo basename($_SERVER[‘PHP_SELF’]);
exit;[/php] – then I reloaded the page.

With SEO Urls turned OFF, the resulting info was;


And with SEO Urls turned on, the result was something like;


Now, I absolutely knew that the error was as I thought. I then went hunting and found a similar story on the old “Chemo” version of SEO Urls and so I took that code and inserted it in the header_tags.php file in place of the PRODUCT_INFO case.

And it worked! With SEO Urls turned on. I then emailed Jack MCS to see if this would impact on HT SEO. All well.

Anyway, Jack came up with some nicer code as follows;

1. open up /includes/header_tags.php
2. find EVERY occurence of basename($_SERVER[‘PHP_SELF’]) and replace this with $page
3. add this: [php]$pos = strripos($_SERVER[‘PHP_SELF’], “/”);
$page = ($pos !== FALSE) ? basename(substr($_SERVER[‘PHP_SELF’], 0, $pos)) : basename($_SERVER[‘PHP_SELF’]);[/php] right before [php]switch (true) {[/php]
4. save and upload

SEO Urls 5 and HT SEO now play nicely together.

Contribution Talk: SPPC 716

The second in my series of getting to know existing contributions.

Separate Pricing Per Customer

This contribution gives the shopowner the ability to set up “groups” of customers, who have a better price than a normal customer. A typical exampe would be “retail customers” and “wholesale customers”. Wholesale customers would probably have a lower price than retail customers. There are also other options whereby the shopowner can activate and deactivate postage, payment methods etc.

This is a quite large and quite complex modification to make, especially on a store that may already have had lots of modifications. I spent over half a day installing this on a highly modified store (which included testing time). I did have a few difficulties, but got it working in the end.


Ease of Install: 5/10
Ease of Use: 5/10
How it looks: 10/10 (it does not make any major changes to how oscommerce looks)

Changes I would like to see

I felt that the customers_group page in the admin could do with a little tweak to actually show the customers that are in each group. A little like this:

You can see a list of clients (blanked out for privacy) who are part of the “trade” group. Although I have not coded this up, I have done almost the same thing on a different contribution, which is where the screenshot comes from.