Changes to attributes on a product can leave zombie entries in the stock table with no way to edit or remove them. (Applicable if the uc_stock module is enabled. [EDIT] And you'll need the uc_reports module enabled to see the stock report.)
Remove an option from an attribute
- Create a product (e.g., "Shirt") with an attribute (e.g., "Size") with multiple options (e.g., "Large", "Medium", "Small", "Tiny").
- In the Options tab, checkmark to make them all active for this product.
- In the Adjustments tab, create unique SKUs for each option.
- In the Stock tab, create some stock quantities for each SKU.
- Go back and edit the attribute (at admin/store/products/attributes), edit the option (OPTIONS dropbutton), and remove one of the options (e.g., "Tiny").
- Now go to the stock report at admin/store/reports/stock. You will see the SKU for the removed attribute option, but there is no way to edit the stock values. On the Stock tab for the product (at node/NNN/edit/stock), it's no longer listed with a checkbox.
In principle, this situation could be avoided if store managers were scrupulous about deactivating SKUs from the stock table before removing the corresponding attribute option, but if they delete the option first, then they're hosed and they have to beg the webmaster to manually edit the stock table in the db.
This can happen more easily for attributes that are shared by multiple products; for example, if "Size" is used for both Shirts and Pants products, and then the store manager decides to no longer carry Tiny of anything, but forgets all the products that it's used for and only deactivates some of the SKUs.
One possible solution would be for the stock module to check and delete stock table values for any affected SKUs when an attribute option is deleted, but that seems like it could be dangerous by resulting in unintended deletion of stock information. So perhaps a better solution would be to add validation to the attribute option edit page and fail validation if there are active SKUs that used that option, requiring the store manager to explicitly deactivate each SKU (and therefore giving him/her a chance to say "oops, I forgot that we still need "Tiny" for socks, guess I won't entirely remove it").
Since there are other ways of creating zombie SKUs in the stock table (see next issue), it might also be useful for the stock report to check for and flag zombies.
Changes to attributes on a product can leave zombie entries in the stock table with no way to edit or remove them. (Applicable if the
uc_stockmodule is enabled. [EDIT] And you'll need theuc_reportsmodule enabled to see the stock report.)Remove an option from an attribute
In principle, this situation could be avoided if store managers were scrupulous about deactivating SKUs from the stock table before removing the corresponding attribute option, but if they delete the option first, then they're hosed and they have to beg the webmaster to manually edit the stock table in the db.
This can happen more easily for attributes that are shared by multiple products; for example, if "Size" is used for both Shirts and Pants products, and then the store manager decides to no longer carry Tiny of anything, but forgets all the products that it's used for and only deactivates some of the SKUs.
One possible solution would be for the stock module to check and delete stock table values for any affected SKUs when an attribute option is deleted, but that seems like it could be dangerous by resulting in unintended deletion of stock information. So perhaps a better solution would be to add validation to the attribute option edit page and fail validation if there are active SKUs that used that option, requiring the store manager to explicitly deactivate each SKU (and therefore giving him/her a chance to say "oops, I forgot that we still need "Tiny" for socks, guess I won't entirely remove it").
Since there are other ways of creating zombie SKUs in the stock table (see next issue), it might also be useful for the stock report to check for and flag zombies.