As part of my investigation into #893364: Currency not working properly, I managed to delete a product type that had existing products.

This has caused the product list to break with this error:

PHP Fatal error: Cannot access empty property in /Users/mikl/Sites/commerce/modules/field/field.attach.inc on line 317, referer: http://localhost/commerce/admin/commerce/products/types

In the interest of preserving referential integrity, I think we should try to prevent the user from deleting product types that have existing products. Baring that, we should at least warn the user that doing so will mess up their data.

In any case, we will need to be able to handle missing product types gracefully.

Comments

rszrama’s picture

Title: Deleting content types breaks product list if a product of that kind was created… » Deleting product types breaks product list if a product of that kind was created…

Oooh, good find. Yeah, I agree with you - best solution here seems to be to just prevent product type deletion. This can happen at the same time as #919266: Providing commerce_product_info() for other modules to be able to add product types.

rszrama’s picture

Status: Active » Fixed

Actually, went ahead and did this. It's easy enough, and I decided to do it at a different point in the code (so it doesn't make sense to wait till I restructure the product type definition for the issue linked above).

Commit: http://github.com/rszrama/drupalcommerce/commit/41f1dfdf36f6d4e9eb0225a5...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.