add wishlist add wishlist show wishlist add compare add compare show compare preloader

SPEDIZIONE GRATIS DA 49€

{% assign sorted_products = collections.all.products | sort_by: 'sold_count', 'desc' %}
{% assign time_range_options = 'giorno,settimana,mese,custom' | split: ',' %}
{% assign sort_by_options = 'quantity,revenue' | split: ',' %}

<div class="best-seller-filters">
<label for="time-range">Seleziona il periodo:</label>
<select id="time-range">
{% for option in time_range_options %}
<option value="{{ option }}">{{ option | capitalize }}</option>
{% endfor %}
</select>

<label for="sort-by">Ordina per:</label>
<select id="sort-by">
{% for option in sort_by_options %}
<option value="{{ option }}">{{ option | capitalize }}</option>
{% endfor %}
</select>
</div>

<div class="best-sellers">
{% for product in sorted_products %}
<div class="best-seller-product">
<h3>{{ product.title }}</h3>
<img src="{{ product.featured_image.src | img_url: 'medium' }}" alt="{{ product.title }}">
<p>Prezzo: {{ product.price | money }}</p>
<p>Quantità vendute: {{ product.metafields.sales_data.quantity_sold }}</p>
<p>Fatturato: {{ product.metafields.sales_data.revenue | money }}</p>
<a href="{{ product.url }}">Visualizza prodotto</a>
</div>
{% endfor %}
</div>

<script>
document.getElementById('time-range').addEventListener('change', function() {
// Implementa la funzione per filtrare i prodotti in base al periodo temporale selezionato
});

document.getElementById('sort-by').addEventListener('change', function() {
// Implementa la funzione per ordinare i prodotti in base alla quantità o al fatturato
});
</script>