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

product view and JS require an image #99

Closed
NathanPJF opened this issue Feb 23, 2017 · 2 comments
Closed

product view and JS require an image #99

NathanPJF opened this issue Feb 23, 2017 · 2 comments
Assignees
Labels
Milestone

Comments

@NathanPJF
Copy link
Contributor

Issue

The markup and JS assumes your product images will always have an image.

  • When product template doesn't have a featured image, it renders the placeholder tag.
  • The JS throws an error when it goes looking for an image selector and doesn't find one.

I realize it's not common for a product not to have an image, but it's an assumption baked into the theme that should be addressed.

Reproduction

Make a product that has no images associated with it. Example screenshot: http://take.ms/zIVff

Screenshot of feature product section

http://take.ms/P5jDA

Problem code

Three areas:

  • featured-product.liquid
  • product.liquid
  • product.js

In featured-product.liquid, it assumes that if you don't have a featured image then you must be onboarding:

  {% if product.featured_image.src != blank %}
    {{ product.featured_image.src | img_url: '480x480' | img_tag: product.featured_image.src.alt, 'product-image' }}
  {% else %}
    {{ 'product-1' | placeholder_svg_tag: 'placeholder-svg placeholder-svg--small' }}
  {% endif %}

In product.liquid there's no check if a featured image exists.

In product.js there is no check whether $(selectors.productFeaturedImage, this.$container) yields any results first.

this.settings.imageSize = slate.Image.imageSize($(selectors.productFeaturedImage, this.$container).attr('src'))
@NathanPJF NathanPJF added the bug label Feb 23, 2017
@NathanPJF
Copy link
Contributor Author

Possibly related: https://github.com/Shopify/narrative/pull/252/

@t-kelly t-kelly added this to the 0.12.0 milestone Jul 14, 2017
@t-kelly t-kelly self-assigned this Jul 14, 2017
@t-kelly t-kelly modified the milestones: 0.13.0, 0.12.0 Aug 10, 2017
@lock
Copy link

lock bot commented Oct 27, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants