I am building a commerce site in D7, which has images attached to the product entities. The field is set to unlimited, and the actual display is handled by Galleria. In my catalog pages, I use views and only show the first image, linking to the product entity. I have had to use a view for the front page to accomplish the same thing.

The problem arises when I show an entity reference on the product pages for 'Related Products' which I wish to show as a rendered entity - teaser. When I go to Manage Display for the Product entity, and select 'Teaser', there is no option to limit the number of images shown. The only work around I have come up with is to hide the images in the teaser, and to create a teaser image field which is hidden in the full display.

This would seem to be a basic requirement when rendering a teaser. If there are multiple values in a field, for which you wish to display an exemplar in the teaser, you should be able to do so.

Comments

damiankloip’s picture

You might want to have a look at field_multiple_limit module. This might do exactly what you need.

Triskelion’s picture

Status: Active » Closed (fixed)

Did exactly what I needed.

I am glad to see that these are d7 backports of d8 core functions.

It is getting hard to keep up with all the new contrib modules. I appreciate your response bringing these to my attention.

Thank you.

josephsergio’s picture

StatusFileSize
new65.38 KB

Sorry to reopen, but I am having sort of the same issue. I had created a view so that when you click on one of my products - on that specific product page there are (2) images, both a front and back thumbnail with one main image above rotating between the (2).

The only issue is that in my teaser, both of those images are present. Please see screenshot - Is there any simple fix for this

Triskelion’s picture

Edit your view, and select the image field. Under the field settings, expand 'MULTIPLE FIELD SETTINGS' and display '1' value starting from '0'.

josephsergio’s picture

Wont this alter the number of images I am displaying though. I want (2) images showing when you view the product however only (1) showing when you see the teaser?

Triskelion’s picture

I assume the 'view' is the display of a filtered query of several products, each of which is displayed as a teaser, with several teasers you can look at, each with a single image.

My next assumption is that you select a single product to expand on your screen, and the 'view' of teasers will be replaced by a display of a single product, showing both (or more) images.

If this is the case, then the settings are independent. Maybe you are confused by the word 'view'. In drupal it refers to a list which is the result of a database query; a repost of several entities which (usually) will allow you to find, select, and view (look at!) the one you want. The display settings on a 'view' (query, list, report ....) will not effect the display of the entity (node, page ....).

Play with it. See what happens, and have fun. That's how you learn.

josephsergio’s picture

I had tried the multiple field settings option you recommended but no luck. Not sure exactly what it is I should be playing with as this was a view I had imported. I have attached (3) screenshots as to better assist your understanding of my issue. The first being the teaser (note 2 images display) - I would only like 1. The second is what is displayed when the image is clicked (the larger image rotates as you roll over each thumbnail). Finally the last is just the view details. I hope this helps somewhat as I am really struggling.

Thanks