spree-contrib / spree_wishlist

Wishlist extension for Spree Commerce.

Home Page:http://guides.spreecommerce.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Variant image get a error in show page.

CharlyJazz opened this issue · comments

<%= 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.

Other solution:

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

Or more small:

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

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.