Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use collection.featured_image instead of image #245

Merged
merged 17 commits into from
Jul 27, 2021

Conversation

martinamarien
Copy link
Contributor

@martinamarien martinamarien commented Jul 21, 2021

Why are these changes introduced?
Currently, the collection card only displays the collection image, if one exists.
In other themes, we use the collection's first product image as a fallback, if one exists.
Fixes #172

What approach did you take?
We recently introduced the new featured_image property on the collection object.
By using this property, it means:

  • If a collection has a featured image, it will be used in the collection card
  • If a collection has no featured image and the first available product has featured media, use the product’s first available featured media as the collection card image. (Collection: test collection)
  • If the collection and its first product has no media, then do not show an image in the collection card. (Collection: shop all)

This PR converts collection.image to collection.featured_image in three places:

  • Collection list template
  • Collection list section
  • Collection block in the collage section

Other considerations
N/A

Demo links
See test store

Testing and reviewing

  • Please ignore online store git commits - I will revert when reviewing is complete
  • Test:
    • Collection list template
    • Collection list section
    • Collection block in the collage section

Checklist

@ghost ghost added the cla-needed label Jul 21, 2021
@martinamarien martinamarien marked this pull request as ready for review July 21, 2021 21:14
@martinamarien martinamarien changed the title use collection.featured_image instead of image Use collection.featured_image instead of image Jul 21, 2021
Al-Campuzano
Al-Campuzano previously approved these changes Jul 22, 2021
Copy link
Contributor

@Al-Campuzano Al-Campuzano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

@tauthomas01 tauthomas01 self-assigned this Jul 22, 2021
tauthomas01
tauthomas01 previously approved these changes Jul 22, 2021
Copy link
Contributor

@tauthomas01 tauthomas01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and looks good.

@martinamarien martinamarien dismissed stale reviews from tauthomas01 and Al-Campuzano via edf739e July 26, 2021 14:38
KaichenWang
KaichenWang previously approved these changes Jul 26, 2021
Copy link
Contributor

@KaichenWang KaichenWang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@KaichenWang KaichenWang self-requested a review July 26, 2021 17:59
Copy link
Contributor

@tyleralsbury tyleralsbury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Love when something already exists for an elegant solution.

@@ -540,4 +540,4 @@
}
]
}
{% endschema %}
{% endschema %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{% endschema %}
{% endschema %}

@martinamarien martinamarien merged commit a87910d into main Jul 27, 2021
@martinamarien martinamarien deleted the fix-collection-card-image branch July 27, 2021 17:12
phapsidesGT pushed a commit to Gravytrain-UK/gt-shopify-dawn-theme that referenced this pull request Sep 3, 2024
* use collection.featured_image instead of image

* Update from Shopify for theme dawn/fix-collection-card-image

* Update from Shopify for theme dawn/fix-collection-card-image

* Update from Shopify for theme dawn/fix-collection-card-image

* Update from Shopify for theme dawn/fix-collection-card-image

* Update from Shopify for theme dawn/fix-collection-card-image

* Update from Shopify for theme dawn/fix-collection-card-image

* Update from Shopify for theme dawn/fix-collection-card-image

* Update from Shopify for theme dawn/fix-collection-card-image

* Update from Shopify for theme dawn/fix-collection-card-image

* Update from Shopify for theme dawn/fix-collection-card-image

* Update from Shopify for theme dawn/fix-collection-card-image

* Update from Shopify for theme dawn/fix-collection-card-image

* Update from Shopify for theme dawn/fix-collection-card-image

* Update from Shopify for theme dawn/fix-collection-card-image

* revert setting changes made by online store git

* fix end of line

Co-authored-by: shopify-online-store[bot] <79544226+shopify-online-store[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Collection list: If no collection image, fall back to first-available product image
5 participants