Product Detail Page - The Variant Form

106 views
Skip to first unread message

Joshua Wedekind

unread,
Mar 11, 2015, 9:01:15 PM3/11/15
to django...@googlegroups.com
Hello,

I am modifying the product detail page to suit our needs. Specifically, we need to modify the variant selection form to involve more than a single dropdown with an attributes summary list.

I.e. Instead of this UI:
Variant*
-- [ Color: Blue, Size: XL, Style: Plain ]
-- [ Color: Red, Size L, Style: Fancy   ]

Have this UI
Color*
-- [ Blue ]
-- [ Red ]

Size*
-- [ L   ]
-- [ XL ]

Style*
-- [ Plain   ]
-- [ Fancy ]


I realize this will involve some frontend JavaScript validation to make certain people don't select unavailable product combinations (e.g. maybe the Red isn't available in Plain, etc.). But I'm a JS expert, and really just need help with some way to get the data on the page.

It appears to me that oscar/apps/basket/forms.py > AddToBasketForm() is the Form to modify.
( link: https://github.com/django-oscar/django-oscar/blob/1.0.1/oscar/apps/basket/forms.py#L134

And specifically, it looks like I need to modify this method: _create_parent_product_fields(self, product)

I'm assuming this is a fairly common task. Are there any best practices, or examples? Perhaps someone could link me to there GitHub repo?

Thanks,
~Josh Wedekind

Joshua Wedekind

unread,
Mar 18, 2015, 8:49:41 PM3/18/15
to django...@googlegroups.com
Ok. Maybe this isn't a fairly common task. Lol. 

Maik Hoepfel

unread,
Mar 19, 2015, 11:12:40 AM3/19/15
to django...@googlegroups.com

Hi Joshua,

Sorry for being slow to reply. I think all Oscar core people are quite flat out at the moment.
Have a dig through the PRs, I think there is one where something similar is done. What you describe sounds sane. If you run into any trouble, grab me and I'll try to help.

Cheers,

Maik

--
https://github.com/tangentlabs/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to the Google Groups "django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-oscar.
To view this discussion on the web, visit https://groups.google.com/d/msgid/django-oscar/e2e44253-f4b3-4e70-96cb-7070706391f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Joshua Wedekind

unread,
Mar 23, 2015, 6:32:33 AM3/23/15
to django...@googlegroups.com
No worries, and no need to apologize. I think I've determined a solution for our specific purposes. 

Thanks.

John P

unread,
Mar 24, 2015, 11:40:43 AM3/24/15
to django...@googlegroups.com
Here's the open issue on github: https://github.com/django-oscar/django-oscar/issues/675

It looks like many people (myself included) have tried to solve this problem. The code I posted on that issue was an early attempt, and has since been abandoned.

John
Reply all
Reply to author
Forward
0 new messages