Attributes, Options, osCommerce

By | December 27, 2008

In standard osCommerce, the product options system (aka attributes) is almost completely useless. The reason for this is obvious – attributes cannot be linked together to make a meaningful “sub-product”.


T-shirt – 12 in stock, of which:
3 are blue, large, round neck
4 are red, large, v-neck
2 are blue, small, round-neck
3 are blue, xxl, round-neck

In that example, you have only 1 product, but you need to set up “colour” (red and blue), “size” (s, l, xxl) and “style” (round neck, v-neck). In the standard attribute system, this will give you three dropdown menu’s showing the available options. Follow me so far?

What it means is that a potential buyer could choose a bunch of options that are simply not available – example: xxl, red, round-neck. And they would be able to check out. When they check out, overall stock is reduced by 1 bringing your number of available shirts down to 11.

But you have just sold something that does not exist…are you with me?

OK, so there are some steps you can take to combat this:

1. Install something called “QT Pro” – which is PITA to install and has many bugs.
2. Install “Master and Slave Products” – which is easier to install, but also has problems – it’s ubnwieldy in real life use.

Here’s my idea for a rework of the attribute system…

1. Allow the store owner to insert options as per normal.
2. Have an extra “options” page which will allow the store owner to make “attribute sets” (explanation below)
3. Assign these “attribute sets” to products.

What is an attribute set?

In the example above, this:

blue, large, round neck

is an attribute set. The store owner would link 3 options together and be able to insert the quantity available. He would also be able to give the “set” a SKU.

Then, in the product_info page, SKU’s would be shown, like this:

Description, blah blah
In stock:
( ) blue, large, round neck [SKU: qwerty123] – 3 in stock
( ) red, large, v-neck [SKU: qwerty124] – 4 in stock
( ) blue, small, round-neck [SKU: qwerty125] – 2 in stock
( ) blue, xxl, round-neck [SKU: qwerty126] – 3 in stock

Now, the next part of this modification, would be subtracting stock, this would be done in two stages. Let’s say the buyer purchases 1 of “qwerty123”. The overall stock of t-shirts would decrease from 12 to 11 and the stock of “qwerty123” would decrease from 3 to 2.

How does that sound? Can any of you see any flaws in my thinking? Anyone got any ideas to add to this?

17 thoughts on “Attributes, Options, osCommerce

  1. James Robertson

    Hi Gary,

    This is exactly the problem we have with our stock. Is this something you have started or just in your thoughts at the moment? The only way round it at the moemnt is to create multiple products so customers cannot order colours/sizes not in stock.

    Do you know of a cleaner (i.e not contribs that are a PITA or have “issues”) that do the second part of your explaination

    I have 1 product in 6 colours, of which I have 6 of each in stock. I want to list 1 product with 6 colour options with a stock level for each sub product as above – is there a more sinple contrib to handle this yet or do you have something in developement?


    James Robertson
    (happy user of the clubosc coupon contrib)

  2. Gary Post author


    This is something I have in my head at this moment. I know that it would be a good way to do things. It’s a case of finding the time to code it up.

    There are NO good contributions that can keep track of attribute stock in a simple, yet workable way.

  3. Gary Post author

    I think my idea is not a great deal of work, but it’s going to take a lot of thinking about as it’s basically a whole new way of subtracting stock (which obviously needs to be right!). I guess it would take a few days of coding and testing, which I never have, other than in patches of an hour here and an hour there.

  4. Jase

    I installed QTPro on my dev site and, while it works, its a real bugger to install – also it doesnt give a new SKU to the combination which is an issue for me as my suppliers have seperate skus for every combination so when I come to order its a very manual process! This sounds like the business though!

  5. Gary Post author

    A start has been made on this, but as with all my ideas, they took a backseat to work that puts food on the table.

    So, I guesstimate this might be available in some form or other sometime soon. Hows that for non-commitment 😉

  6. smoky

    I think the best way would be to treat all the different options as individual products. This way quantity for all “options” can be kept track of. The trick would be getting multiple products in a drop down menu on the product page and getting it to post correctly to the shopping cart page. Perhaps an extra field could be added to the product info database column to indicate weather or not the product has mutiple options. This way the drop down menu could be correctly populated in the product info page.

  7. Gary Post author

    Forget drop down menus 😉

    How this would work is by Radio Buttons based on SKU, with the quantity decreasing on each successful sale.

    This way you are not populating your database with “false” products and you are keeping the customer interface nice and clean and easy to understand.

  8. enigma1

    I believe you could do this with the extra fields contribution. You can setup a couple of extra columns to specify a model or sku and another for the stock qty, then setup the stock accordingly to be subtracted for each sale in the checkout_process.php.

    The real issue comes up if you need to have nested fields so the customer can select the product options quickly. Radio buttons can be useful for few options but for many I would deploy drop-down lists. I had real problems setting this up on some stores, because of the complexity in terms of hierarchy to develop modules that could accommodate the product options linking properly when nesting was necessary. Then I had different requests for stock numbers, images, jscripts on the product info page and so forth that makes this kind of integration difficult especially because I am trying to support both script and noscript cases.

    If you have just few options per product and no nested options are necessary then the product extra fields contribution can easily modified to do that.


    PS: You can see screenshots of an implementation if you search my site for “multi level” or “group fields”

  9. Gary Post author

    EN; it would be a simple matter to not use radios if the number of SKU’s was a large amount. I still haven’t really got past the theory stage of this mod yet – I have a flowchart of what I envisage, and changing from radio to dropdown is an extra couple of lines of code – good idea though, cheers.

  10. Michael

    hi gary
    did you ever finish this and have it lying in a drawer for sale? 🙂


  11. Gary Post author

    Hi Michael – never really got much past the theory stage. I did ask a very well known osCommerce coder to quote on it for me, but he never got back to me. I would like to get it done, but it’s finding the time to do it. If I ever did get it done, I know it would be very popular.

  12. Mayda

    I would second that, Gary. I have a client now that has a shoe store and needs to link the attribute of color with size since some sizes are not available in all colors. She is having to enter separate products. If someone had the time to develop this I am sure there would be plenty of customers lining up to buy it. Email me if an when you do.


  13. Gary Post author

    Hi Mayda

    It’s such a departure from normal osCommerce so it would take too long to code and test. It would most liely sell very well though.

  14. Luca

    The last version of master products adapted to 2.3.1 works fine for me. Much better than using attributes. Attributes are one of the biggest flaws in oscommerce.

Leave a Reply

Your email address will not be published.