Re: Multi-part product stock control
Posted: Fri Jun 04, 2010 5:38 pm
Ok... I've got most of the code written now, but I'm very aware that testing this on a live site is a seriously bad idea...
I may just have to go ahead with a backup of the store database and pray! but if someone has a test account setup with 5.0.6 or even the latest 5.5.4 that I can modify and debug on that'd be useful.
Anyway, progress... After a few false starts, rewriting of the structure, adding then removing functions, I've pretty much thrashed out the core code...
As it stands it will now:
(Note: stock/inventory will be referred to as "stock" throughout for ease as it's the same thing)
Still to write (immediate):
I may just have to go ahead with a backup of the store database and pray! but if someone has a test account setup with 5.0.6 or even the latest 5.5.4 that I can modify and debug on that'd be useful.
Anyway, progress... After a few false starts, rewriting of the structure, adding then removing functions, I've pretty much thrashed out the core code...
As it stands it will now:
(Note: stock/inventory will be referred to as "stock" throughout for ease as it's the same thing)
- Accept the "Parts" custom field as a string of component product SKU's
- The sting includes a quantity variable so your "set" can consist of say 10 units of one component (eg: 20xFoo)
..or a combination of different products in multiples or singles (eg: 10xFoo + 2xFii + (1)Fum = 1 x fooSet) - Sanity checking of the string so that the field can't be used to pollute or inject code
- Update a product "set" listing stock level according to the availability of component parts
- Update the component products stock when changes are made to a "set" product (ie: purchase, stock change, etc..)
- Identify and update stock levels for product listings with the same SKU (clones)
- Identify "clone" products that have different stock levels (as a further sanity check) and standardise the stock level according to the lowest value. This function also:
- Adds an error to the stores system log
- Fires off an email to the inventory manager email address describing the inconsistency, products concerned and the original stock levels
Still to write (immediate):
- Check for component status (ie: is a product a component of a set)
- Update related set product(s) stock when a component product is purchased
- Sanity check of a "set" parts field to ensure that all SKU's have been entered properly before allowing the "set" product to be saved
- Mod code to hook into system (relatively simple or should be)
- Mod code to hide custom field if it is labelled "Parts"
- Update set listings whenever an SKU is altered for a component part
- Provide a neat GUI from which to select the products you wish to include as components (I don't need one but if anyone wants to write one be much guest)
- Make tea/coffee/breakfast/love-to-your-significant-other... etc...