Product Variant price in option dropdown

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Product Variant price in option dropdown

Post by jmestep » Wed May 20, 2009 2:22 pm

Is there a way of picking up the price modifier for an option on the product page when the product has variants from the variant price?
The code below to add the modifier doesn't work if the there are variants and the modifier is put in to the box on the Edit variants for the product, but the price has been deleted from the price in the option grid.

Code: Select all

if (optionOption.PriceModifier > 0)
                        {
                            aspOptions.Items.Add(new ListItem(optionOption.Name + " ( +" + optionOption.PriceModifier.ToString("ulc") + ")", optionOption.OptionChoiceId.ToString()));
                        }
                        else if (optionOption.PriceModifier < 0)
                        {
                            aspOptions.Items.Add(new ListItem(optionOption.Name + " (  " + optionOption.PriceModifier.ToString("ulc") + ")", optionOption.OptionChoiceId.ToString()));
                        }
                        else
                           {
 aspOptions.Items.Add(new ListItem(optionOption.Name, optionOption.OptionChoiceId.ToString()));                      
                            }
Or is this something where they should have the prices in the option grid to start with?
Thanks
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Product Variant price in option dropdown

Post by mazhar » Thu May 21, 2009 5:47 am

You can try to load variant by using ProductVariantDataSource.LoadForOptionList(productId, choice ids)

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Product Variant price in option dropdown

Post by jmestep » Tue May 26, 2009 5:59 am

This is just in case someone else runs across it. I was having trouble getting the choiceIds and Mazar posted code here that does it:
viewtopic.php?f=42&t=10310
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

Post Reply