feat: added product variants
This commit is contained in:
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user