{% extends 'base.html.twig' %}
{# Some helpers to make this file more readable #}
{% set d = product.default_variation|default %}
{% block main %}
<div class="max-w-screen-2xl mx-auto px-5 lg:px-20 pt-header">
{% include 'template-parts/breadcrumb.html.twig' %}
</div>
<main id="product-{{ product.id }}"
x-init="$nextTick(() => { initialize() })"
{% if d %}
x-data="window.alpineProductData({{ product | json_encode }}, {{ product['default_variation'] | json_encode }})"
{% else %}
x-data="window.alpineProductData({{ product | json_encode }})"
{% endif %}
class="max-w-screen-2xl mx-auto px-5 lg:px-20">
<div class="grid grid-cols-1 lg:grid-cols-2 lg:grid-rows-[0.02fr_1fr] gap-y-6 lg:gap-x-12 lg:gap-y-4 pb-0 lg:pb-12">
<div class="swiper-container-wrapper product-gallery -ml-4 lg:ml-0 w-screen lg:w-full flex flex-col sm:flex-row-reverse flex-nowrap gap-4 lg:aspect-[677/400] lg:overflow-hidden order-2 lg:order-first">
{% if product.gallery|default or product.galleryVariations|default %}
<div class="swiper group/product-page-swiper w-full lg:w-[calc(100%-100px)] relative !z-5">
{% if product.discount|default %}
{% embed 'components/picto.html.twig' with {picto_name: '- ' ~ product.discount ~ '%'} %}{% endembed %}
{% endif %}
{% if product.video|default %}
<button data-modal-target="{{ product.video }}"
class="absolute top-4 right-4 z-100 flex w-max flex-row items-center gap-2 rounded-none bg-neutral-200 py-1 px-3">
{% include 'assets/youtube_icon.svg' %}
<span class="text-sm font-bold text-black">Ver vĂdeo</span>
</button>
{% endif %}
<div class="swiper-wrapper">
<template x-for="item in current?.gallery || []">
<div class="swiper-slide">
<template x-if="item.src">
<a :href="item.src" :data-pswp-src="item.src" :data-pswp-width="1024"
:data-pswp-height="1024" class="cursor-zoom-in" rel="noreferrer">
<img class="w-full h-full aspect-[4/3] object-contain"
:src="item.src"
:srcset="item.srcset"
:sizes="item.sizes"
:alt="item.alt" loading="lazy">
</a>
</template>
</div>
</template>
{% for image in product.gallery %}
<div class="swiper-slide">
{% if image.src|default %}
<a href="{{ image.src }}" data-pswp-src="{{ image.src }}" data-pswp-width="1024"
data-pswp-height="1024" class="cursor-zoom-in" rel="noreferrer">
<img class="w-full h-full aspect-[4/3] object-contain"
src="{{ image.src }}"
srcset="{{ image.srcset }}"
sizes="{{ image.sizes }}"
alt="{{ image.alt }}" loading="lazy">
</a>
{% endif %}
{% if image.youtube_id|default %}
<iframe src="{{ image.youtube_src }}" class="w-full h-full"
width="640" height="360" frameborder="0"
allow="autoplay; fullscreen; picture-in-picture"
allowfullscreen></iframe>
{% endif %}
</div>
{% endfor %}
</div>
<div class="swiper-scrollbar lg:opacity-0 group-[.swiper-initialized:hover]/product-page-swiper:opacity-100 transition-opacity duration-300 ease-in-out"></div>
<div class="swiper-button-next aria-disabled:hidden after:hidden" aria-disabled="true">
{% include 'assets/swiper-next.svg' %}
</div>
<div class="swiper-button-prev aria-disabled:hidden after:hidden" aria-disabled="true">
{% include 'assets/swiper-prev.svg' %}
</div>
</div>
<div class="swiper product-page-swiper-thumbs w-[100px] !hidden lg:!block relative">
<div class="swiper-wrapper">
<template x-for="item in current?.gallery || []">
<div class="swiper-slide !h-auto cursor-pointer last:!mb-0">
<template x-if="item.src">
<img :src="item.thumbnail.src"
:alt="item.alt" loading="lazy">
</template>
</div>
</template>
{% for image in product.gallery %}
<div class="swiper-slide !h-auto cursor-pointer last:!mb-0">
<img src="{{ image.thumbnail.src }}"
alt="Miniatura {{ image.thumbnail.alt|default ? image.thumbnail.alt : image.alt }}"
loading="lazy">
</div>
{% endfor %}
</div>
<div class="swiper-button-next swiper-button-next-thumbs !top-auto !bottom-0 !left-0 !right-0 !mt-0 m-auto aria-disabled:hidden after:hidden"
aria-disabled="true">
{% include 'assets/swiper-next-thumbs.svg' %}
</div>
<div class="swiper-button-prev swiper-button-prev-thumbs !top-0 !left-0 !right-0 !mt-0 m-auto aria-disabled:hidden after:hidden"
aria-disabled="true">
{% include 'assets/swiper-prev-thumbs.svg' %}
</div>
</div>
{% endif %}
</div>
<div class="row-span-1">
<h1 class="text-3xl lg:max-w-lg">{{ product.name }}</h1>
</div>
<div class="lg:row-span-2 order-4">
<div class="lg:sticky lg:top-header flex flex-col gap-y-6 z-0 sm:max-xl max-w-lg">
{% block start_sticky_product %}{% endblock %}
{% block price_box %}
{% embed 'template-parts/price-box.html.twig' %}{% endembed %}
{% endblock %}
{% block info_destacada %}
{% embed 'components/info-destacada.html.twig' with {
envio: true,
tiempo_envio: product.attributes['pa_tiempo-de-envio'][0].name ?? '',
size: product.length|default or product.width|default or product.height|default
} only %}{% endembed %}
{% endblock %}
{% if product.short_description|default %}
<span class="order-last lg:order-none text-sm text-black prose max-w-none">{{ product.short_description|raw }}</span>
{% endif %}
{% if product.is_in_stock|default %}
{% if product.variation_attributes|default %}
<div id="product-attributes"
class="space-y-6 bg-stone-100 xs:rounded-none p-4 w-screen -ml-4 xs:w-full xs:ml-0">
{% block product_attributes %}
{% for key, attribute in product.variation_attributes %}
{% embed 'components/attributes/attribute-button.html.twig' with {
atributos: 'product.variation_attributes["' ~ key ~ '"]',
atributo: key,
} only %}
{% endembed %}
{% endfor %}
{% endblock %}
</div>
{% endif %}
{% block add_to_cart %}
{% embed 'components/add-to-cart.html.twig' with {
quantity: true
} %}{% endembed %}
{% endblock %}
{% block after_add_to_cart %}{% endblock %}
{% else %}
<div class="flex flex-row items-center gap-3 mt-6">
<button id="addToCart"
class="no-stock w-full flex flex-row justify-center items-center gap-3 rounded-none bg-black p-3 text-white text-center">
<span>Producto agotado</span>
</button>
</div>
{% endif %}
<a href="{{ path('whatsapp_link', {'link': app.request.pathInfo}) }}" target="_blank"
rel="nofollow" class="[&_svg]:max-w-40
[&_svg]:max-h-40 [&_svg]:w-full [&_svg]:h-auto [&_svg]:object-contain">
{% include 'assets/whatsapp-herramientasparaalicatador.svg' %}
</a>
</div>
{% block price_nav_fixed %}
{% embed 'template-parts/price-nav-fixed.html.twig' %}{% endembed %}
{% endblock %}
</div>
<div class="order-last lg:order-3 mt-0 lg:mt-[400px] mb-8">
{% block before_accordion %}{% endblock %}
{% if product.accordion|default %}
{% embed 'components/accordion.html.twig' with {
id: 'accordion_product',
accordion: 'collapse',
items: product.accordion
} %}
{% endembed %}
{% endif %}
</div>
{% if product.video|default %}
{% embed 'components/modal.html.twig' with {id: product.video, modal_button_class: 'hidden', youtube_id: product.video, modal_zIndex: 'z-[1000001]'} %}{% endembed %}
{% endif %}
{% block modales_producto %}{% endblock %}
</div>
{% block informacion_adicional_producto %}{% endblock %}
</main>
{% block after_main %}{% endblock %}
{% if product.upsell_ids|default %}
<section class="max-w-screen-2xl mx-auto px-5 lg:px-20 flex flex-col gap-8">
{{ render_block('listadoproductos', {
titulo: product.tituloProductosRelacionados ?? 'Productos relacionados' ,
alineacion: 'start',
categorias_productos: false,
etiquetas_productos: false,
numero_productos: '-1',
boton: '',
slider_grid: 'slider',
productos: product.upsell_ids,
id: 'relacionados',
}) }}
</section>
{% endif %}
{% endblock %}
{% block footer %}
{% include 'footer.html.twig' %}
<div class="pb-44 lg:pb-16"></div>
<style>
#whatsapp {
margin-bottom: 5rem;
}
</style>
{{ wp_footer() }}
{% endblock footer %}
{% block json_schema %}
{{ json_schema|raw }}
{% endblock %}