İçeriğe geç
Tüm kodlar

ER3NSHOP

Kurulum sihirbazlı online mağaza sistemi

61 satır · 3,9 KBHamİndir
<?php
$discount = discount_rate($product);
$sold_out = $product['stock'] < 1;
$has_variants = !empty($product['variant_name']);
$second = theme_on('card_hover_image') ? hover_image($product['id']) : null;
?>
<article data-customize="urunler" data-customize-label="Ürün kartı" class="group relative">
    <div class="relative <?= card_ratio_class() ?> overflow-hidden rounded-2xl bg-zinc-100">
        <a href="<?= product_url($product) ?>" class="block h-full w-full">
            <?= product_image($product, 'h-full w-full object-cover transition duration-700 ease-out-soft group-hover:scale-[1.04]' . ($second ? ' group-hover:opacity-0' : '')) ?>
            <?php if ($second): ?>
                <img src="<?= e(upload_url($second)) ?>" alt="" loading="lazy" class="absolute inset-0 h-full w-full object-cover opacity-0 transition duration-700 ease-out-soft group-hover:opacity-100">
            <?php endif ?>
        </a>

        <div class="pointer-events-none absolute top-3 left-3 flex flex-col items-start gap-1.5">
            <?php foreach (product_badges($product) as [$label, $class]): ?>
                <span class="rounded-full px-2.5 py-1 text-[11px] font-bold backdrop-blur <?= $class ?>"><?= e($label) ?></span>
            <?php endforeach ?>
        </div>

        <form method="post" action="<?= url('favori') ?>" data-ajax class="absolute top-3 right-3">
            <?= csrf_field() ?>
            <input type="hidden" name="id" value="<?= $product['id'] ?>">
            <button data-favorite="<?= $product['id'] ?>" <?= is_favorite($product['id']) ? 'data-active' : '' ?> class="flex size-9 items-center justify-center rounded-full bg-white/90 text-zinc-700 shadow-sm backdrop-blur transition hover:scale-110 hover:text-rose-500 data-active:text-rose-500 data-active:*:fill-current" aria-label="Favorilere ekle">
                <?= icon('heart', 'size-[18px]', '1.8') ?>
            </button>
        </form>

        <?php if (!$sold_out && theme_on('card_quick_add')): ?>
            <div class="absolute inset-x-3 bottom-3 translate-y-2 opacity-0 transition duration-300 group-hover:translate-y-0 group-hover:opacity-100 max-lg:hidden">
                <?php if ($has_variants): ?>
                    <a href="<?= product_url($product) ?>" class="btn w-full bg-white/95 py-2.5 text-ink shadow-lg backdrop-blur hover:bg-white">Seçenekleri gör</a>
                <?php else: ?>
                    <form method="post" action="<?= url('sepet-ekle') ?>" data-ajax>
                        <?= csrf_field() ?>
                        <input type="hidden" name="id" value="<?= $product['id'] ?>">
                        <button class="btn w-full bg-white/95 py-2.5 text-ink shadow-lg backdrop-blur hover:bg-white"><?= icon('plus', 'size-4', '2') ?>Sepete ekle</button>
                    </form>
                <?php endif ?>
            </div>
        <?php endif ?>
    </div>

    <div class="mt-4 px-0.5">
        <a href="<?= product_url($product) ?>" class="line-clamp-1 text-sm font-medium text-ink"><?= e($product['name']) ?></a>
        <?php if (theme_on('card_rating') && !empty($product['review_count'])): ?>
            <div class="mt-1 flex items-center gap-1.5 text-xs text-zinc-500">
                <span class="text-amber-400"><?= star_icon('size-3.5') ?></span>
                <span class="font-medium text-zinc-700"><?= number_format($product['rating'], 1, ',', '') ?></span>
                <span>(<?= (int) $product['review_count'] ?>)</span>
            </div>
        <?php endif ?>
        <div class="mt-1.5 flex items-baseline gap-2">
            <span class="text-[15px] font-semibold <?= $discount ? 'text-accent-600' : 'text-ink' ?>"><?= money($product['price']) ?></span>
            <?php if ($discount): ?>
                <span class="text-xs text-zinc-400 line-through"><?= money($product['old_price']) ?></span>
            <?php endif ?>
        </div>
    </div>
</article>

Lisans bilgisi projenin LICENSE dosyasında.