Problem

One product display linked to two products each with a different image. When the referenced product is changed in teaser view of a product display, the view mode is changed to the default for the referenced product and shows fields not made visible in the teaser view.

Steps to recreate

This problem affects any product display-referenced product view mode where the default display shows different fields from the other displays (teaser, full etc) and the product is updated via the select box.

  1. Create two products each with a different image.
  2. Set the teaser display views to not show the price and show the image as a thumbnail
  3. Create a product display and link the two products to it.
  4. View the product display in teaser view mode (e.g. on /node) showing a select box (containing the two products) and the initial teaser view of the first referenced product (see attached image 1).
  5. When the referenced product in the product select list is changed to the second product the ajax call back displays the details (image) of the second product, but the view mode (teaser) is lost and the first available view mode is found (default) which shows the price and the large image (see image 2 attached ).

This also affects the full node page and appears to be that the view mode is lost by the AJAX post back. This worked in version pre beta 4.

Comments

rszrama’s picture

Status: Active » Fixed

Ahh, the problem lay in commerce_cart_field_attach_view_alter(). I was using a += operator on an array to alter the context for the current display node's view mode... but since the view_mode parameter was already set, it wasn't updating it for use when rendering product fields.

Commit: http://drupalcode.org/project/commerce.git/commit/9a4fe37

rszrama’s picture

(This commit made it into the RC1, I just forgot to submit my comment form. : )

iaugur’s picture

Great stuff Ryan! just upgraded to latest rc1 and yay that's fixed and even more goodies to discover! Thanks a million.

rszrama’s picture

w00t! Glad to hear it. : )

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

typo