[ic] Options and Inventory

Jamie Neil interchange-users@icdevgroup.org
Sat Apr 19 17:24:00 2003


I'm working on a site that requires inventory tracking for product options
and am running into problems with selection of products which are out of
stock.

Product inventories are all recorded against the corresponding product
option sku in the inventory table, and I'm setting the inventory level for
the _base_ sku to the sum of all the individual products.

What I want to do is display the base sku inventory (or just "In Stock" if
>0) on the search results page (i.e. we _do_ have widgets in stock), but
when the flypage is displayed I need to show which widgets are in stock and
which are not (i.e. we have green and blue widgets but no red).

I have thought of two ways of doing this:

1) Use a single widget options select box which either marks items as out of
stock or leaves them off the list entirely. This allows the customer to see
what is in stock easily without having to step through all the options one
by one.

2) Display an availability table (either in line or as a popup window) which
shows which products are out of stock. The product selection is then done
from either a single or separate widget options selection.

Up to now I've been trying to do option 1 by modifying the Matrix options
code (Matrix.pm) to add an inventory option to the tag. Looking at the code
there seems to be the remains of something similar already there
($inv_func), but I don't think it's complete.

Has anyone got any working code to achieve this or maybe a suggestion for a
better solution?

Also, I've noticed that when you purchase an item that uses matrix options,
the inventory for the option is decremented, but the base sku inventory
remains the same. Although this makes some kind of sense (the base sku is
not a real product), is there any reason why the base sku inventory should
not be reduced too?

Jamie Neil
Versado I.T. Services Ltd.