silvershop-core
silvershop-core copied to clipboard
canArchive on ProductCategory
If you archive a ProductCategory, all products that are children of this ProductCategory, will also be archived. This is Silverstripe standard behaviour for pages, but it might not be transparent to the user, when working with products in multiple categories.
Example: The user has "Blue t-shirt" product in the category: "New T-shirts" but also the product has an additional category "Coloured T-shirts".
The user now deletes the category "New t-shirts", expecting the product to still exist in "Coloured T-shirts", but it does not, it is now archived.
A fix could be to disallow archiving for categories that contain products, this can be done via canArchive() method
Fixed in https://github.com/silvershop/silvershop-core/pull/817