Hello... Wondering if anyone has run into this issue...
I have kit items for almost all my products. I've noticed that when a kit component consists of multiple kitproducts, that it shows up as: example: size - (12x) - ($32.99) ....
Is there a way to get rid of the '(12x)' part of this option? I thought that I had isolated this down to the ProductHelper.cs file, but cannot seem to find where exactly this is created. I created my (3000) Kit options with this information already in place... (example ... 5 lbs. - Case of 12 ), so I don't need this to display.
Can anyone please help with this one?
I appreciate any help!
Scott
Quantity text on product page options
Re: Quantity text on product page options
Anybody???
Re: Quantity text on product page options
Well this happens in KitComponent.GetControl method.... which is part of CommerceBuilder.DLL.
You will see this being called in ProductHelper.cs
You can write your own equivalent of this method somewhre in App_Code and use it instead.
To facilitate writing an equivalent of this method here I am posting the source of KitComponent.GetControl() method...
You will see this being called in ProductHelper.cs
You can write your own equivalent of this method somewhre in App_Code and use it instead.
To facilitate writing an equivalent of this method here I am posting the source of KitComponent.GetControl() method...
Code: Select all
/// <summary>
/// Create the control represented by this kit component.
/// </summary>
/// <returns>A web control populated for this kit component</returns>
public System.Web.UI.WebControls.WebControl GetControl()
{
bool setSelected = false;
bool inventoryIsDisabled = !Token.Instance.Store.EnableInventory;
switch (this.InputType)
{
case KitInputType.CheckBox:
CheckBoxList checkBoxList = new CheckBoxList();
checkBoxList.ID = this.UniqueId;
foreach (KitProduct choice in this.KitProducts)
{
if (inventoryIsDisabled || VerifyInventory(choice))
{
string choiceValue = choice.KitProductId.ToString();
if (string.IsNullOrEmpty(choiceValue)) choiceValue = choice.Name;
string choiceName = string.Format("{0} - ({1:ulc})", choice.DisplayName, choice.CalculatedPrice);
ListItem item = new ListItem(choiceName, choiceValue);
item.Selected = choice.IsSelected;
checkBoxList.Items.Add(item);
}
}
if (checkBoxList.Items.Count <= 0)
{
return GetComponentOutOfStockLabel();
}
else
{
return checkBoxList;
}
case KitInputType.DropDown:
DropDownList dropDown = new DropDownList();
dropDown.ID = this.UniqueId;
//CHECK FOR HEADER OPTION
if (!string.IsNullOrEmpty(this.HeaderOption))
dropDown.Items.Add(new ListItem(this.HeaderOption, "0"));
//ADD IN PRODUCT CHOICES
foreach (KitProduct choice in this.KitProducts)
{
if (inventoryIsDisabled || VerifyInventory(choice))
{
string choiceValue = choice.KitProductId.ToString();
if (string.IsNullOrEmpty(choiceValue)) choiceValue = choice.Name;
string choiceName = string.Format("{0} - ({1:ulc})", choice.DisplayName, choice.CalculatedPrice);
ListItem item = new ListItem(choiceName, choiceValue);
if (!setSelected && choice.IsSelected)
{
item.Selected = (choice.IsSelected);
setSelected = true;
}
dropDown.Items.Add(item);
}
}
if (dropDown.Items.Count <= 0)
{
return GetComponentOutOfStockLabel();
}
else
{
return dropDown;
}
case KitInputType.IncludedShown:
BulletedList bulletedList = new BulletedList();
bulletedList.ID = this.UniqueId;
foreach (KitProduct choice in this.KitProducts)
{
if (inventoryIsDisabled || VerifyInventory(choice))
{
string choiceName = string.Format("{0} - ({1:ulc})", choice.DisplayName, choice.CalculatedPrice);
ListItem item = new ListItem(choiceName);
bulletedList.Items.Add(item);
}
}
if (bulletedList.Items.Count <= 0)
{
return GetComponentOutOfStockLabel();
}
else
{
return bulletedList;
}
case KitInputType.RadioButton:
RadioButtonList radioButtonList = new RadioButtonList();
radioButtonList.ID = this.UniqueId;
if (this.Columns > 1) radioButtonList.RepeatColumns = this.Columns;
//CHECK FOR HEADER OPTION
if (!string.IsNullOrEmpty(this.HeaderOption))
radioButtonList.Items.Add(new ListItem(this.HeaderOption, "0"));
//ADD IN PRODUCT CHOICES
foreach (KitProduct choice in this.KitProducts)
{
if (inventoryIsDisabled || VerifyInventory(choice))
{
string choiceValue = choice.KitProductId.ToString();
if (string.IsNullOrEmpty(choiceValue)) choiceValue = choice.Name;
string choiceName = string.Format("{0} - ({1:ulc})", choice.DisplayName, choice.CalculatedPrice);
ListItem item = new ListItem(choiceName, choiceValue);
if (!setSelected && choice.IsSelected)
{
item.Selected = (choice.IsSelected);
setSelected = true;
}
radioButtonList.Items.Add(item);
}
}
if (!setSelected && this.KitProducts.Count > 0) radioButtonList.SelectedIndex = 0;
if (radioButtonList.Items.Count <= 0)
{
return GetComponentOutOfStockLabel();
}
else
{
return radioButtonList;
}
}
return null;
}
Re: Quantity text on product page options
Exactly what I was looking for...
Thank you for replying.
Scott
Thank you for replying.
Scott
Re: Quantity text on product page options
One more question, really quickly...
Some of the methods used (VerifyInventory(choice), and GetComponentOutOfStockLabel()) I can't seem to find anywhere... Is there a file I need to include to allow access to those? (couldn't find them in the Class Lib doc)
Thank you again for the help.
Scott
Some of the methods used (VerifyInventory(choice), and GetComponentOutOfStockLabel()) I can't seem to find anywhere... Is there a file I need to include to allow access to those? (couldn't find them in the Class Lib doc)
Thank you again for the help.
Scott
Re: Quantity text on product page options
Code: Select all
private Label GetComponentOutOfStockLabel()
{
string message;
if (this.KitProducts.Count > 0)
{
message = "All options for '{0}' are currently out of stock.";
}
else
{
message = "No options available for '{0}' at this time.";
}
Label lbl = new Label();
lbl.ID = this.UniqueId;
lbl.Text = string.Format(message, this.Name);
return lbl;
}
Code: Select all
private bool VerifyInventory(KitProduct kp)
{
InventoryManagerData invData = kp.CheckStock();
return (invData.InventoryMode == InventoryMode.None || invData.InStock >= kp.Quantity || invData.AllowBackorder);
}