How to get the "Options" fields from a 'child' product.

5 views
Skip to first unread message

Thomas

unread,
Mar 22, 2013, 1:25:09 AM3/22/13
to satchm...@googlegroups.com
Hi,

I am stumped by what would seem to be really trivial..

Let us say I sell Hats in two colours (Black, White) and in two sizes (Medium, Large). If someone purchased a Large Black Hat, then the 'child' product is hat_black_large, and the product id is say 3.

My question is: given the product id of 3 (or the product of hat_black_large), how do I derive the selected options 'Large' and 'Black' ?

I am able to derive the 'parent' product id (eg it would be '1' in this case), but I just can't figure out what method to use to get the options ..

Many thanks,
Thomas

Thomas

unread,
Mar 22, 2013, 3:35:22 AM3/22/13
to satchm...@googlegroups.com
Finally figured it out:

options = current_product.options.values('name', 'price_change').order_by('option_group')
Reply all
Reply to author
Forward
0 new messages