Files
slump-x-land-studio/templates/shop/product.html
T

46 lines
2.2 KiB
HTML

{% extends 'base.html' %}
{% block title %}{{ product.title }} · Shop · SLUMP X LAND{% endblock %}
{% block content %}
<main class="page-shell">
<p><a href="{% url 'shop-index' %}">&larr; Back to Shop</a></p>
<article class="product-detail" style="display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:2rem;">
{% if product.image %}
<div><img src="{{ product.image.url }}" alt="{{ product.title }}" style="width:100%;border-radius:8px;"></div>
{% endif %}
<div>
<span class="badge">{{ product.get_kind_display }}</span>
<h1>{{ product.title }}</h1>
<p style="font-size:1.35rem;"><strong>${{ product.price_usd }}{% if product.kind == 'subscription' %} / {{ product.billing_interval }}{% endif %}</strong></p>
{% if product.description %}<div class="prose">{{ product.description|linebreaks }}</div>{% endif %}
{% if product.kind == 'subscription' %}
<form method="post" action="{% url 'shop-subscribe' product.slug %}" style="margin-top:1.5rem;display:grid;gap:.75rem;max-width:360px;">
{% csrf_token %}
{% if not request.user.is_authenticated or not request.user.email %}
<label>Email for membership receipts
<input type="email" name="email" required placeholder="you@example.com">
</label>
{% endif %}
{% if stripe_enabled %}
<button type="submit" name="gateway" value="stripe" class="btn">Subscribe with Card (Stripe)</button>
{% endif %}
{% if paypal_enabled and product.paypal_plan_id %}
<button type="submit" name="gateway" value="paypal" class="btn">Subscribe with PayPal</button>
{% endif %}
</form>
{% else %}
{% if product.in_stock %}
<form method="post" action="{% url 'shop-cart-add' product.pk %}" style="margin-top:1.5rem;display:flex;gap:.75rem;align-items:center;">
{% csrf_token %}
<input type="number" name="quantity" value="1" min="1" max="20" style="width:72px;">
<button type="submit" class="btn">Add to Cart</button>
</form>
{% else %}
<p><strong>Sold Out</strong></p>
{% endif %}
{% endif %}
</div>
</article>
</main>
{% endblock %}