Skip to content

Instantly share code, notes, and snippets.

@tewe11
Created February 26, 2021 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tewe11/8629d48453cb4e10b79834fac39f0461 to your computer and use it in GitHub Desktop.
Save tewe11/8629d48453cb4e10b79834fac39f0461 to your computer and use it in GitHub Desktop.
{%- if section.settings.show_product_recent_viewed -%}
<hr class="hr--clear hr--small">
{% comment %}
Use Liquid to build the grid item. It will be a string, ready to be stored in the local storage
{% endcomment %}
{%- assign grid_item_width = 'post-large--one-quarter medium--one-quarter small--one-half' -%}
{%- assign product_width = 300 -%}
{%- assign featured = product -%}
{%- capture grid_item -%}
<div class="grid__item {{ grid_item_width }}">
{% include 'product-grid-item' %}
</div>
{%- endcapture -%}
<div class="product-recently-viewed"
data-handle="{{ product.handle }}"
data-id="{{ product.id }}"
data-section-type="recently-viewed"
data-grid-item= "{{ grid_item | replace: 'ProductImage','RecentProductImage' | escape }}"
hidden >
{%- if section.settings.heading != blank -%}
<div class="section-header section-header--medium">
<h2 class="h4">{{ section.settings.heading | escape }}</h2>
</div>
{%- endif -%}
<div class="slides supports-js grid-uniform grid-link__container recently-viewed">
</div>
{%- endif -%}
{% schema %}
{
"name": {
"de": "Zuletzt angesehene Produkte",
"en": "Recently viewed products",
"fr": "Produits vus récemment "
},
"settings": [
{
"type": "checkbox",
"id": "show_product_recent_viewed",
"label": {
"de": "Zuletzt angesehene Produkte anzeigen",
"en": "Recently Viewed Products",
"fr": "Afficher les produits vus récemment"
},
"info": {
"de": "Zuletzt angesehene Produkte werden im lokalen Speichter gesammelt",
"en": "Recently viewed products are collected in the local storage",
"fr": "Les recommandations dynamiques changent et s'améliorent avec le temps. [En savoir plus](https://help.shopify.com/en/themes/development/recommended-products)"
},
"default": true
},
{
"type": "text",
"id": "heading",
"label": {
"de": "Überschrift",
"en": "Heading",
"fr": "En-tête"
},
"default": {
"de": "Zuletzt angesehene Produkte",
"en": "Recently viewed products",
"fr": "Produits vus récemment"
}
},
{
"type": "checkbox",
"id": "vendor_enable",
"label": {
"de": "Produktanbieter anzeigen",
"en": "Show product vendor",
"fr": "Afficher le distributeur du produit"
},
"default": false
},
{
"type": "checkbox",
"id": "show_sale_circle",
"label": {
"de": "Kreis für 'Sonderangebot' anzeigen",
"en": "Show 'Sale' circle",
"fr": "Afficher la vignette « Réduction »"
}
},
{
"type": "checkbox",
"id": "center_grid_link",
"label": {
"de": "Text unter Produktbildern zentrieren",
"en": "Center text below product images",
"fr": "Centrer le texte sous les images des produits"
}
},
{
"type": "range",
"id": "how_many_to_show",
"label": {
"de": "Anzahl der angezeigten Produkte",
"en": "Number of products to show",
"fr": "Nombre des produits de vu"
},
"max": 8,
"min": 1,
"default": 4
}
]
}
{% endschema %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment