Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.0-alpha2
Component:
Product
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Oct 2010 at 20:36 UTC
Updated:
1 Nov 2010 at 14:20 UTC
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
Comment #1
rszrama commentedOooh, 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.
Comment #2
rszrama commentedActually, 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...