Stock Tracking via Options and Attributes

This is a follow up article to

Today we are talking about an extension to the attributes and options system which we call “attribute sets”. What we have set out to do is to better utilize the built-in attribute system of osCommerce.

Something that many shop owners deal with is that they need to not just keep an overall stock count for an item but they also need to keep a stock count for different options for the product.

Let’s say you have an item (T-shirt) and that item has a colour attribute and a size attribute. Normally you would end up with two drop down menus, one being for colour (red, blue) and one being for size (medium, large) which the customer would then use to choose the options they needed for the item.


However, what you have in stock is this:

2 x Red Large
2 x Blue Medium

Using the usual options/attributes dropdowns, a customer could easily select “Red and Medium” which you don’t have in stock. Ends up being a waste of time for you and a very annoyed customer who will probably want a refund, an apology and won’t shop with you again. That’s a bad thing…

With some radical (yet well coded) changes to the options system, Matt and I have enabled a system that allows the Shopowner to show options in a different way and keep track of stock. It looks like this:


As you can see, the options are shown in a different format, including the SKU and Stock. Now a buyer can only order exactly what you have in stock. Stock is reduced not only on the overall product (the Tshirt) but also on the available SKU (of the options). If I check out by purchasing a “Blue Medium” I will show what I mean (note that we presently have 2 Blue Medium in stock, and overall quantity of 4 Tshirts). After the purchase:


Stock has reduced to 1, and overall stock of the T-shirt has reduced to 3:


So, in this way stock can be maintained using the usual osCommerce attributes and options (with our extension). In addition to this, in the admin orders page and invoice page the “model” is made up of the model number of the overall product along with the SKU of the chosen option:


Forget about master and slave products.
Forget about QTPro.
Attribute sets are a non-invasive way to control inventory at the attribute level.

And a video to illustrate the system from start to finish…

Should you wish to enquire about this new system, please feel free to contact me on or Matt via