Page 1 of 1

Product option choice default selection

Posted: Fri Aug 23, 2013 9:41 am
by corgalore
In Gold R5, if I create product options and set one of the choices as 'selected', the choice is not selected on the public product page. I had to add this work-around in order to get it working:

Around Line 799, BuyProductDialog.asxc.cs

Code: Select all

foreach (OptionChoice choice in opt.Choices)
 {

  //Fix:Select default choice
  if (!IsPostBack && _SelectedOptionChoices.Count == 0)
  {
   if (choice.Selected)
    ddl.SelectedValue = choice.Id.ToString();
  }
  //End Fix

  if (!string.IsNullOrEmpty(choice.ImageUrl))
  {
   imageScript.Append("    " + ddl.ClientID + "_Images[" + choice.Id.ToString() + "] = '" + this.Page.ResolveUrl(choice.ImageUrl) + "';\n");
  }
}