Skip to content

Instantly share code, notes, and snippets.

@carvalhorafael
Last active September 10, 2020 17:04
Show Gist options
  • Save carvalhorafael/57967eea4e6fba4c0874ac38a08c43c7 to your computer and use it in GitHub Desktop.
Save carvalhorafael/57967eea4e6fba4c0874ac38a08c43c7 to your computer and use it in GitHub Desktop.
<!-- templates/index.liquid L 120 está assim -->
<section class="home-products">
<h2 class="text-center">Títulos em Destaque</h2>
{% include 'product/list', products: products, gateway: gateway %}
</section>
<!-- Pode adicionar o trecho abaixo para carregar um snippet de categorias -->
{% if settings.view.home.enable_categories == true %}
{% include 'home/categories', gateway: gateway, categories: categories %}
{% else %}
{% include 'product/list', products: products, gateway: gateway %}
{% endif %}
<!-- Trecho de código de exemplo que pode ir em snippets/home/categories.liquid -->
<!-- Aqui você pode listar produtos de algumas categorias para exibir em destaque -->
<div class="home-categories">
{% assign all_categories = current_school | get_categories %}
{% assign config_categories = settings.view.home.categories | sort: 'order' %}
{% for c in config_categories %}
{% assign current_category = nil %}
{% for category in all_categories %}
{% if category.slug == c.slug %}
{% assign current_category = category %}
{% endif %}
{% endfor %}
{% assign category_products = current_school | get_products_by_category_and_subcategories: c.slug, 6 %}
<div class="home-category">
<div class="container">
<h3>{{ current_category.title }}</h3>
<div class="category-products">
<div class="row">
{% for product in category_products %}
<div class="col-sm-6 col-md-4">
{% include 'product/product-card', product: product, gateway: gateway %}
</div>
{% endfor %}
</div>
</div>
</div>
</div>
{% endfor %}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment