Page 1 of 2

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

Posted: Sat Apr 12, 2008 10:14 pm
by solgraphix
I am trying to figure out how to default a option to the first choice? normally it just is blank...but i need it to come up with the first one in the option choices....i currently have business cards for sale...but for qty i have say 1K, 2K & 5K...it default to nothing so my price when people look at the cart says Price: $0.00. i want it to default to 1K so on the page is says, say Price: $50.00...

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

Posted: Sun Apr 13, 2008 11:41 pm
by Naveed
I think currently there is no administrator option available to select a choice as default option choice. I will discuss this feature with my senior team mates.

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

Posted: Fri Sep 26, 2008 4:18 pm
by wave_werks
Has anyone found a solution to set a default option to appear in the blank menus on the drop-downs?

I searched the forum, submitted a bug report directly to the developers, and posted a feature request here on the forums. The bug response was to check the forum - which I've already done. The feature request was posted in the "feature request" section of the forum on the 22nd and has yet to see a response.

... is it really possible that this cart produces blank menus for options? Makes the product page look broken!

Thanks to all for any advise or suggestions you may have.

- Jeff

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

Posted: Fri Sep 26, 2008 4:24 pm
by jmestep
Yes, it really does that and I think there was a reply on a topic yesterday that it was for performance problems. I had changed one of my sites by taking out the empty string that was in the code before the options were displayed, but an Able developer said that wouldn't work if there was inventory control on the options.

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

Posted: Fri Sep 26, 2008 5:23 pm
by wave_werks
Thanks for the quick reply.

It's really quite disturbing that there's not some text such as "Please Select..." on the blank menus so that at least something shows up when a customer arrives at the product page. As of now they land on a page that looks like it is not populated with a product or is broken, or better yet thinks that maybe the shop owner doesn't know what he/she is doing.

This one really needs to be fixed.

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

Posted: Fri Sep 26, 2008 5:57 pm
by Shopping Cart Admin
Hello,
This one really needs to be fixed.
It's not broken, it's a feature enhancement.

Moved to feature enhancement thread so it's not lost, thank you for your suggestion.

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

Posted: Fri Sep 26, 2008 10:14 pm
by mazhar
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: Fri Sep 26, 2008 11:48 pm
by mazhar
Here is another workaround. In this workaround instead of selecting the first choice by default we will show a <Select Option> list item instead of having blank space. Edit the App_Code/ProductHelper.Cs file and locate the following code in the BuildProductOptions method and locate the following line of code

Code: Select all

aspOptions.Items.Add(String.Empty);
and make it look like

Code: Select all

aspOptions.Items.Add("<Select Option>");

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

Posted: Sat Sep 27, 2008 9:11 am
by jmestep
This is great if it works.
Removing this code is what I had done before, and Logan said it wouldn't work under some conditions, so it's good there is another workaround.
aspOptions.Items.Add(String.Empty);

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

Posted: Mon Oct 06, 2008 1:11 pm
by jmestep
I tried this method and nothing changed:

Code: Select all

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;

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

Posted: Mon Oct 20, 2008 11:52 am
by mazhar
Did you removed the following statement?

Code: Select all

aspOptions.Items.Add(String.Empty);

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

Posted: Mon Oct 20, 2008 2:54 pm
by jmestep
I had done that in the past, but not after this post. Logan said if the product had inventory (I think that's what he said) it wouldn't work to remove that. I thought maybe your code bypassed that.

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

Posted: Tue Oct 21, 2008 3:24 pm
by Sean@WMS
Thanks for this, Mazhar.

However, as by default the first option is a blank option, to get the first "real" option to show, this should be set to look for the second item in the array:

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[1].Selected = true;
That is, not:

Code: Select all

aspOptions.Items[0].Selected = true;
but

Code: Select all

aspOptions.Items[1].Selected = true;
This will set the first actual option to "selected". Otherwise, your other method is solid for those who would prefer "Please Select" in lieu of the blank selected option.

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

Posted: Tue Oct 21, 2008 5:11 pm
by jmestep
This worked great. I'm going to leave this in
aspOptions.Items.Add(String.Empty);

unless you know for sure it's OK to take out.

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

Posted: Tue Oct 21, 2008 5:15 pm
by Sean@WMS
I've a question: If I edit App_Code/ProductHelper.Cs directly, it will get overwritten by upgrades. However, I can't find any reference call to this file in the source code so that I could modify it in something like App_Code/Custom/ProductHelper.Cs

Any suggestions on how to handle this?

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

Posted: Tue Oct 21, 2008 5:17 pm
by jmestep
Just make sure you save a backup. I think there are one or two conlibs I have found that don't work from the Custom folder also.

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

Posted: Wed Oct 22, 2008 5:31 am
by mazhar
I've a question: If I edit App_Code/ProductHelper.Cs directly, it will get overwritten by upgrades. However, I can't find any reference call to this file in the source code so that I could modify it in something like App_Code/Custom/ProductHelper.Cs

Any suggestions on how to handle this?
App_Code is a special ASP.NET folder and the classes in it are automatically available all across the application. If you want to create some custom version of class then create Custom folder inside the App_Code folder place a copy of file in it, provide some namespace for this newly created class. Now you can use this custom version where ever you need it.

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

Posted: Wed Nov 04, 2009 4:15 pm
by Jaz
Is there an update on how to make the first option show on 7.03? Tried the method listed here, but it crashed my site.

I noticed:

aspOptions.Items.Add(String.Empty);

Changed to:

aspOptions.Items.Add(option.HeaderText);

Not being a programmer, I don't know what changes I need to make.

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

Posted: Thu Nov 05, 2009 6:32 am
by jmestep
This line
aspOptions.Items.Add(option.HeaderText)
picks up whatever you put into the header text field when you are setting up the options.
I tried taking that out in 7.0.3 and ran into problems with the displayed price not updating as someone changes option choices with more than one option. I haven't tested with only one option.

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

Posted: Fri Nov 06, 2009 2:19 pm
by Jaz
So I am guessing for now we just can't put in a default option? It was nice to be able to do this before because puting in a default (popular option) it reduced phone calls and customer confusion.

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

Posted: Fri Nov 06, 2009 5:13 pm
by jmestep
Yes you can put in a default. Instead of this:
aspOptions.Items.Add(option.HeaderText)
you could have something like
aspOptions.Items.Add("Please select...");

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

Posted: Fri Nov 06, 2009 6:01 pm
by Jaz
Not as good as showing the first option, but it will have to do.

Thanks,

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

Posted: Wed Jan 20, 2010 2:55 pm
by lliberty
Hi,
I had edited the file: ProductHelper.Cs
I then uploaded it to our site. When I tried to access AbleCommerce, I got an error.
I had saved the original file and I just put it back, but that didn't help.
Is there anything I can do to get this issue resolved as soon as possible.
Please visit this page:
page:http://arcoide.com/product.aspx?PageId=270 and try to choose add to cart.
You will see the error.
Please help.

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

Posted: Thu Jan 21, 2010 8:17 am
by mazhar
just tested your link at it seems to work. I think you were able resolve the problem.

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

Posted: Sun Jul 18, 2010 2:17 pm
by Kalamazoo
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