There's no reason that a broken product reference field should cause a total fatal. Let's put a try/catch in the formatter. Currently a dangling product reference causes a fatal.

EntityMetadataWrapperException: Unable to load the commerce_product with the id 1556. in EntityDrupalWrapper->value() (line 683 of /home/rfay/workspace/commerce/sites/all/modules/entity/includes/entity.wrapper.inc). Backtrace:

EntityDrupalWrapper->value() commerce_product_reference.module:182
commerce_product_reference_node_view(Object, 'teaser', 'en') 
call_user_func_array('commerce_product_reference_node_view', Array) module.inc:819
module_invoke_all('node_view', Object, 'teaser', 'en') node.module:1388
node_build_content(Object, 'teaser', 'en') node.module:1286
node_view(Object, 'teaser', NULL) node.module:2521
node_view_multiple(Array) node.module:2547
node_page_default() 
call_user_func_array('node_page_default', Array) menu.inc:503
menu_execute_active_handler() index.php:21

Comments

rszrama’s picture

Status: Active » Closed (fixed)

This was actually fixed upstream in the Entity API and finally made it into a release as of Entity API 7.x-1.0-beta11. Yay. : )

rfay’s picture

Could you give the reference of the fix? The issue or commit?

I wish I'd put more information in about how to recreate this.

Edit: Oh, I guess since product deletion doesn't check for danging references, just deleting a product will do it.

rfay’s picture

Works for me! Yay!