Default selection in the product options

Post feature requests to this forum and a pre-configured poll will automatically be created for you.
Post Reply
User avatar
Willisski
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 82
Joined: Thu Oct 27, 2005 1:46 am
Location: http://www.Thejibshop.com
Contact:

Default selection in the product options

Post by Willisski » Fri May 29, 2009 2:21 pm

We need default selection in the product options (Color,Size,etc...) Right now the customer has to click on a blank field. it would be great if there was a default for those selections.

crazyjoe
Commander (CMDR)
Commander (CMDR)
Posts: 172
Joined: Mon Apr 26, 2010 2:20 pm

Re: Default selection in the product options

Post by crazyjoe » Fri Apr 30, 2010 2:54 pm

I can't believe there aren't a million other people thinking this is necessary too! I agree 100% this needs to be implemented in the next release.
Crazy Joe Sadloski
Webmaster
Hot Leathers Inc.
http://www.hotleathers.com

8bitbyte
Ensign (ENS)
Ensign (ENS)
Posts: 2
Joined: Sat Sep 17, 2011 1:43 pm

Re: Default selection in the product options

Post by 8bitbyte » Sat Sep 17, 2011 1:45 pm

Please have a look at this solution for setting the default product option:
http://8bitbyte.com/programming-help/20 ... ct-option/

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

Re: Default selection in the product options

Post by jmestep » Mon Sep 19, 2011 7:17 am

You don't really need javascript to do it. In the App_Code/ProductHelper.cs, you can remove this line:
aspOptions.Items.Add(option.HeaderText);
or this line
aspOptions.Items.Add(String.Empty);
depending on what build of Able you are using. Able had said in the past that it might cause a problem if you are using inventory on the variants, but I don't know if that even applies now, it was so long ago.
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

sfeher
Captain (CAPT)
Captain (CAPT)
Posts: 220
Joined: Fri Jun 04, 2004 1:58 pm
Location: Steubenville, Ohio

Re: Default selection in the product options

Post by sfeher » Fri Feb 22, 2013 2:13 pm

Curious if anyone has tested in this GOLD yet....
I'm trying to enforce the first option to be the 'default' choice....

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: Default selection in the product options

Post by david-ebt » Tue Feb 26, 2013 4:24 pm

In GOLD there is a function in the BuyProductDialog.ascx.cs that builds the options choice - GetOptionChoices. By default this function adds the option header text as the first item. We commented out that code to always default to the first option.

Code: Select all

protected List<OptionChoiceItem> GetOptionChoices(Object objOption, int index)
{
	ProductOption productOption = objOption as ProductOption;
	if (productOption == null)
		return GetOptionChoiceValues(new List<OptionChoice>());

	IList<OptionChoice> availableChoices;

	if (!ShowAllOptions && index < ProductVariant.MAXIMUM_ATTRIBUTES)
	{
		availableChoices = OptionChoiceDataSource.GetAvailableChoices(_Product.Id, productOption.OptionId, _SelectedOptionChoices);
	}
	else
	{
		availableChoices = productOption.Option.Choices;
	}

	//OptionChoice optionChoice = new OptionChoice();
	//optionChoice.Name = productOption.Option.HeaderText;
	//optionChoice.OptionId = productOption.OptionId;
	//availableChoices.Insert(0, optionChoice);

	return GetOptionChoiceValues(availableChoices);
}
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

sfeher
Captain (CAPT)
Captain (CAPT)
Posts: 220
Joined: Fri Jun 04, 2004 1:58 pm
Location: Steubenville, Ohio

Re: Default selection in the product options

Post by sfeher » Wed Feb 27, 2013 8:12 am

Yes, David......

I found that same code and updated just a few days ago...
Thanks for the response, though!

meer2005
Captain (CAPT)
Captain (CAPT)
Posts: 245
Joined: Wed Feb 09, 2005 2:00 pm

Re: Default selection in the product options

Post by meer2005 » Tue Nov 04, 2014 3:13 pm

In R9, I just commented out the following line on the BuyProductDialog:

Code: Select all

 //ddl.Items.Add(new ListItem(opt.HeaderText, string.Empty));
Has anyone done this to where it adds the header text if entered within a products options, or defaults to the first option if there is no header text for that product option?

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2645
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Default selection in the product options

Post by Katie » Wed Nov 05, 2014 3:41 pm

If you are using Gold R9, then you can either use the Header text or you can select a default option. From the Manage Option Choices page, there is a column where you can check a box for "Selected". This will be the default option choice, if you want to use the feature, or it will just default to the header text. No customization necessary!
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

Post Reply