Skip to content
This repository has been archived by the owner on Nov 2, 2021. It is now read-only.

Variant image get a error in show page. #120

Open
CharlyJazz opened this issue May 7, 2019 · 2 comments
Open

Variant image get a error in show page. #120

CharlyJazz opened this issue May 7, 2019 · 2 comments

Comments

@CharlyJazz
Copy link
Contributor

<%= image_tag variant.images.first.attachment.url(:small) %>

Screenshot from 2019-05-07 17-58-01

I fixed this bug with this code

<% if variant.images.length != 0 %>
  <%= small_image(variant.product) %>
<% end %>

We should talk about it.

@CharlyJazz
Copy link
Contributor Author

CharlyJazz commented May 7, 2019

Other solution:

<%= product_image(variant.product, itemprop: "image") %>

Or more small:

<%= small_image(variant.product, itemprop: "image") %>

@MateoLa
Copy link

MateoLa commented Jul 29, 2019

Hello.
I have this issue too.
I think it could be a better solution:
<%= image_tag main_app.url_for(variant.images.first.url(:small)) %>
retrieving the first stored image for this variant.
(Not the master image and without resizing the image again throught product_image or small_image methods).

MateoLa.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants