Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding option to Not use existing item_option_group value as the default select option value #21

Open
ChrisFreeman opened this issue Jan 29, 2014 · 0 comments

Comments

@ChrisFreeman
Copy link

I would like the default item_option_group value be a non-valid "Choose Size" (or similar).

Currently, there doesn't appear to be a way to specify a non-valid option as the default option_group_value. I hacked a solution by altering the product_detail template to insert default option outside of the recommended "{% for option in options %}" loop:

<option selected="selected" value="">Choose Size</option>

I then hacked the SimplevariationsCartDetails.post method to modify the "key.startswith('add_item_option_group_') section to check for an empty key value:

if not self.request.POST[key]:
    messages.warning(self.request,'No Size Select!  Please select Size below.')
    nextURL = self.request.GET.get('next', '')
    return HttpResponseRedirect(nextURL)

Aside: I also modified product_detail template to include a "next" value in the product_detail template form action attribute, so it would be available above.

I'm not sure if this is valuable to others, or if there is a way to incorporate this as a feature that can be enabled/disabled to allow adding into a pull request.

Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant