silvershop-core icon indicating copy to clipboard operation
silvershop-core copied to clipboard

canArchive on ProductCategory

Open thomasbnielsen opened this issue 2 years ago • 1 comments

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.

thomasbnielsen avatar Oct 30 '23 13:10 thomasbnielsen

A fix could be to disallow archiving for categories that contain products, this can be done via canArchive() method

wernerkrauss avatar Oct 30 '23 14:10 wernerkrauss

Fixed in https://github.com/silvershop/silvershop-core/pull/817

wilr avatar May 02 '24 20:05 wilr