feat: added product variants

This commit is contained in:
2026-07-23 11:37:37 +02:00
parent 5786c07077
commit 87405f31fa
22 changed files with 818 additions and 315 deletions
@@ -3,6 +3,20 @@
{% csrf_token %}
<input type="hidden" name="product" value="{{ product.pk }}">
{% if product.has_variants %}
<div class="mb-4">
<label for="variant">{% translate 'Variante' %}</label>
<select class="input" id="variant" name="variant">
{% for variant in product.variants.all %}
<option value="{{ variant.pk }}" {% if not variant.stock %}disabled{% endif %}>
{% for attribute_value in variant.attribute_values.all %}{{ attribute_value }}{% if not forloop.last %}, {% endif %}{% endfor %}
{% if not variant.stock %}({% translate 'agotado' %}){% endif %}
</option>
{% endfor %}
</select>
</div>
{% endif %}
<div class="flex items-center">
<input class="input mr-4" id="quantity" aria-label="quantity" type="number" min="1" max="10" name="quantity" value="1">
<button class="btn btn-primary">