Ajustes antes de produccion

This commit is contained in:
2026-10-22 00:07:21 -06:00
parent f9666c4088
commit 1be9d16c83
124 changed files with 3540 additions and 772 deletions
+50 -28
View File
@@ -3,6 +3,7 @@
@param {product} product - Product to display
@param {string} [form_suffix] - Keeps the product form id unique
@param {string} [badge_mode] - `tags` shows the skin label, `collection` shows the category collection, `none` hides badges
@example
{% render 'collection-card', product: product, form_suffix: section.id %}
@@ -28,25 +29,40 @@
assign subtitle = variant.title
endif
assign skin_label = product.metafields.custom.tipo_de_piel.value | default: product.metafields.custom.tipo_de_piel
if skin_label == blank
assign skin_label = product.metafields.custom.skin_type.value | default: product.metafields.custom.skin_type
endif
assign badge_mode = badge_mode | default: 'tags'
%}
{% if badge_mode == 'collection' %}
{% capture collection_label %}
{% render 'product-collection-label', product: product %}
{% endcapture %}
{% endif %}
{% liquid
assign collection_label = collection_label | strip
assign skin_label = blank
assign badge_best = false
assign badge_recommended = false
for tag in product.tags
assign tag_label = tag | downcase
if tag_label contains 'vendido' or tag_label contains 'bestseller'
assign badge_best = true
if badge_mode != 'none'
if badge_mode == 'tags'
assign skin_label = product.metafields.custom.tipo_de_piel.value | default: product.metafields.custom.tipo_de_piel
if skin_label == blank
assign skin_label = product.metafields.custom.skin_type.value | default: product.metafields.custom.skin_type
endif
endif
if tag_label contains 'recomend'
assign badge_recommended = true
endif
if skin_label == blank and tag_label contains 'piel'
assign skin_label = tag
endif
endfor
for tag in product.tags
assign tag_label = tag | downcase
if tag_label contains 'vendido' or tag_label contains 'bestseller'
assign badge_best = true
endif
if tag_label contains 'recomend'
assign badge_recommended = true
endif
if badge_mode == 'tags' and skin_label == blank and tag_label contains 'piel'
assign skin_label = tag
endif
endfor
endif
assign rating_value = 0
assign rating_count = 0
@@ -99,17 +115,21 @@
{% endif %}
</a>
<div class="collection-card__badges">
{% if badge_best %}
<span class="collection-card__badge collection-card__badge--best">{{ 'bestsellers.badge' | t }}</span>
{% endif %}
{% if badge_recommended %}
<span class="collection-card__badge collection-card__badge--best">{{ 'collection_page.recommended' | t }}</span>
{% endif %}
{% if skin_label != blank %}
<span class="collection-card__badge collection-card__badge--skin">{{ skin_label | escape }}</span>
{% endif %}
</div>
{% if badge_mode != 'none' %}
<div class="collection-card__badges">
{% if badge_best %}
<span class="collection-card__badge collection-card__badge--best">{{ 'bestsellers.badge' | t }}</span>
{% endif %}
{% if badge_recommended %}
<span class="collection-card__badge collection-card__badge--best">{{ 'collection_page.recommended' | t }}</span>
{% endif %}
{% if badge_mode == 'collection' and collection_label != blank %}
<span class="collection-card__badge collection-card__badge--skin">{{ collection_label | escape }}</span>
{% elsif badge_mode == 'tags' and skin_label != blank %}
<span class="collection-card__badge collection-card__badge--skin">{{ skin_label | escape }}</span>
{% endif %}
</div>
{% endif %}
<button
class="collection-card__wish"
@@ -211,7 +231,7 @@
document.addEventListener('click', (event) => {
const wish = event.target.closest('.collection-card [data-wishlist]');
if (!wish) return;
if (!wish || wish.closest('[data-product-page]')) return;
const id = String(wish.dataset.productId || '');
const handle = String(wish.dataset.productHandle || '');
if (!id) return;
@@ -225,8 +245,10 @@
});
document.addEventListener('submit', async (event) => {
if (event.defaultPrevented) return;
const form = event.target;
if (!(form instanceof HTMLFormElement) || !form.hasAttribute('data-collection-card')) return;
if (form.closest('[data-product-page]')) return;
if (event.defaultPrevented) return;
event.preventDefault();