Page 2 of 2

Re: figuring out how to do "As Low As - $"

Posted: Thu Sep 01, 2011 9:35 am
by crazyjoe
I did Kalamazoo's change and it worked like a dream! Exactly what I was looking for! However, when placing an order in the admin, if I need to add a product that only has 1 variant, the "Add to Cart" button never appears in the pop-up because it doesn't think i've chosen an option. Any idea of a work around for that? My sales dept. often places orders in the admin for call in's.

Re: figuring out how to do "As Low As - $"

Posted: Thu Jan 10, 2013 3:51 pm
by jdarby
Is there an appropriate change for this issue in 7.0.7? The code below is not the same in ProductHelper.cs
mazhar wrote:Hello All
Please give a try to the following workaround. Edit the App_Code/ProductHelper.Cs file and locate the following code in the BuildProductOptions method

Code: Select all

aspOptions.Items.Add(String.Empty);
                    // GET THE COLLECTION OF OPTIONS THAT ARE AVAILABLE FOR THE CURRENT SELECTIONS
                    OptionChoiceCollection availableOptions = OptionChoiceDataSource.GetAvailableChoices(product.ProductId, option.OptionId, selectedChoices);
                    foreach (OptionChoice optionOption in availableOptions)
                    {
                        aspOptions.Items.Add(new ListItem(optionOption.Name, optionOption.OptionChoiceId.ToString()));
                    }
and make it look like

Code: Select all

                    // GET THE COLLECTION OF OPTIONS THAT ARE AVAILABLE FOR THE CURRENT SELECTIONS
                    OptionChoiceCollection availableOptions = OptionChoiceDataSource.GetAvailableChoices(product.ProductId, option.OptionId, selectedChoices);
                    foreach (OptionChoice optionOption in availableOptions)
                    {
                        aspOptions.Items.Add(new ListItem(optionOption.Name, optionOption.OptionChoiceId.ToString()));
                    }
if (aspOptions.Items.Count > 0)
                        aspOptions.Items[0].Selected = true;
This change will select the first available choice as default in the dropdown boxes and will remove the blank one.

Re: figuring out how to do "As Low As - $"

Posted: Wed Jan 23, 2013 9:31 am
by jdarby
Kalamazoo wrote:I am in version 7.04. We were looking for a way to use the admin header text for options in a useful and purposeful way. If you enter in a value and leave it, you force a selection, if you do not enter in a value then this automatically selects the top option by default and makes it selected so you don't have to waste so much time of a customer to buy your product (in the right cases....)

just replace this in ProductHelper.cs

Code: Select all

aspOptions.Items.Add(option.HeaderText);


with

Code: Select all

if (!string.IsNullOrEmpty(option.HeaderText))
                    {
                        aspOptions.Items.Add(option.HeaderText);
                    }
Seems to work like a champ and I hope others will try it and see if it works for you as well. I don't know how to keep changes being made to this file so just document for any upgrade. If anyone else has a better idea that would be great.

Thanks,

Phil Chrisman
I made this change (v7.0.7) and it works as far as loading the first option when the product page loads instead of blank dropdowns. However, it does not update the price from $0.00 to reflect what is setup for the variant. Any ideas?