Created
June 29, 2011 07:58
-
-
Save mbrochh/1053371 to your computer and use it in GitHub Desktop.
Providing drop down lists for simplevariations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% load simplevariation_tags %} | |
<!-- Your product detail view here --> | |
<form method="post" action="{% url cart %}">{% csrf_token %} | |
{% with option_groups=object|get_option_groups %} | |
{% if option_groups %} | |
<div> | |
<h2>Variations:</h2> | |
{% for option_group in option_groups %} | |
<label for="add_item_option_group_{{ option_group.id }}">{{ option_group.name }}</label> | |
{% with options=option_group|get_options %} | |
<select name="add_item_option_group_{{ option_group.id }}"> | |
{% for option in options %} | |
<option value="{{ option.id }}">{{ option.name }}</option> | |
{% endfor %} | |
</select> | |
{% endwith %} | |
{% endfor %} | |
</div> | |
{% endif %} | |
{% endwith %} | |
<input type="hidden" name="add_item_id" value="{{object.id}}"> | |
<input type="hidden" name="add_item_quantity" value="1"> | |
<input type="submit" value="Add to cart"> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment