I’d like to blame the turkey, but no, it’s just my non-programmer’s mind.
Our website uses a system of parent and child items. The children are packed in different quantities:
11-401 parent
11-401 full pack
11-401 half pack
11-401 tube
At any given time, the items will either show a status of “In Stock” or “Out of Stock”. The parent item should show “In Stock” as long as any of the children are in stock. Unfortunately, the website software is dumb and doesn’t keep track of the parent stock status in relation to the children. So if we sell out of an item completely, the parent might still display “In Stock” when it should flip over to out of stock. Likewise the opposite. A shipment comes in and the children all regain “In Stock” status, but the parent continues to display “Out of Stock” until we manually correct it.
So. I’m trying to think of a way (perhaps with arrayloop?) to check each item grouping and correct as needed.
Example One:
ItemNum Type StockStatus:
11-401 parent Out of Stock
11-401 full pack Out of Stock
11-401 half pack In Stock
11-401 tube In Stock
So the code would need to recognize that the parent is showing out of stock but this is incorrect because one or more of the child items has stock.
Example Two shows the opposite situation. The parent shows “In Stock” but all of the children are sold out, so the parent needs to be corrected.
ItemNum Type StockStatus:
11-401 parent In Stock
11-401 full pack Out of Stock
11-401 half pack Out of Stock
11-401 tube Out of Stock
FYI there are about 7,000 items to check, so roughly 28,000 records. Ideally the output from this procedure would be a neat list of parent items that need updating, displaying current StockStatus and revised status.
Any suggestions most welcome!
b
PS I don’t think it matters, but on the website each of the child items has its own modified item number. Tubes for example, have a “TB” prefix, so 11-401 packed in a tube is listed as “TB-11-401”. All items on the website have a unique ID number so when uploading corrections of this sort only the ID and the correct field header(s) are required.