Rendering a product reference field of a line item as rendered product is causing fatal error:
Fatal error: __clone method called on non-object in commerce_product_reference.module on line 846

Attached patch fixes the issue.

Comments

tatyana’s picture

Component: Product » Product reference
rszrama’s picture

Status: Active » Needs review
Issue tags: +sprint

Tagging for http://contribkanban.com/#/board/commerce/7.x-1.x.

Haven't tested the patch.

Status: Needs review » Needs work

The last submitted patch, commerce.product_view_fatal_error.patch, failed testing.

mglaman’s picture

Version: 7.x-1.11 » 7.x-1.x-dev
Status: Needs work » Needs review
StatusFileSize
new951 bytes

Re-roll in proper format.

Makes sense

783-785

  foreach ($items as $delta => $item) {
    $product_ids[$item['product_id']] = $item['product_id'];
  }

$item gets overwritten in at the beginning of the case

foreach ($items as $delta => $item) {
rszrama’s picture

Category: Bug report » Support request
Status: Needs review » Postponed (maintainer needs more info)

I don't mind making this change, as it appears harmless, but I actually can't reproduce the problem on any sort of View or content type.

I edited the Shopping Cart block to render the product reference field and created a line item View from scratch. I created a content type with a product reference on it and viewed its output with the field rendering the product and made a View of said node types.

All of this leads me to believe the $items loop is fine and that the entity key should in fact be an object, but for some reason in your site it isn't. It would be useful to know what the $item array actually looks like for you. My hunch is the fix is just covering up some other module's interference in the $items array.

bojanz’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)