Hi Everyone,
We are doing some customization to not to show some products to particular user groups when they visit our store catalog.
Problem is we are building kit componets with Product A,B,C,D,E,F. In this Kit product there are some products which should be shown to particular user groups.
say we have to hide Product A and Product B from user group G1 when they view this kit product.
How do I do this. I went through BuyProductDialog.ascx and I don't see any code where kit products are binding to the phKitProducts control.
Can any one help where to find the exact place so that we can skip adding Product A and Product B when the user is from Group G1.
Thanks a lot in advance.
Carol
Hiding some products in kit products
-
- Commander (CMDR)
- Posts: 121
- Joined: Wed Dec 17, 2008 9:13 am
Re: Hiding some products in kit products
Find out the calls to ProductHelper in BuyProductDialog control. You can found ProductHelper class under App_Code folder and check its BuildKitOptions function.
Re: Hiding some products in kit products
Yes you are right that code is not accessible but you can process the control returned by code. For example if you are using radio button list then you can update the BuildKitOptions method radio button list part as below
I just imposed a very simple check to determine whether to show or hide this item
you can replace with your custom logic.
Code: Select all
Type oType = o.GetType();
if (oType.Equals(typeof(RadioButtonList)))
{
((RadioButtonList)o).AutoPostBack = true;
RadioButtonList rblist = ((RadioButtonList)o);
for (int i = 0; i < rblist.Items.Count; i++)
{
ListItem listItem = rblist.Items[i];
if (listItem != null)
{
KitProduct kitProduct = KitProductDataSource.Load(AlwaysConvert.ToInt(listItem.Value));
if (kitProduct.Name == "Hide This Product")
{
rblist.Items.Remove(listItem);
i = 0;
continue;
}
}
}
}
Code: Select all
if (kitProduct.Name == "Hide This Product")