Problem with item.Product.ProductTemplate
Posted: Fri Dec 18, 2009 12:03 pm
I am in the process of upgrading from 7.0.0 to 7.0.4. I have some custom code that uses item.Product.ProductTemplate and my understanding is that I should be using CustomFields instead of ProductTemplate. I'm wondering how to update the following code:
//Used to clear template information entered by the user after submission.
private static void ClearProductTemplateInput(BasketItem item, Control container)
{
// COLLECT ANY ADDITIONAL INPUTS
Product product = item.Product;
if (product != null)
{
ProductTemplate template = item.Product.ProductTemplate;
if (template != null)
{
foreach (InputField input in template.InputFields)
{
//ONLY LOOK FOR CUSTOMER INPUT FIELDS
if (!input.IsMerchantField)
{
//SEE IF WE CAN LOCATE THE CONTROL
Control findControl = PageHelper.RecursiveFindControl(container, input.UniqueId);
if (findControl != null)
{
TextBox tb = findControl as TextBox;
if (tb != null)
{
tb.Text = "";
}
}
}
}
}
}
}
Thanks in advance,
David Noell
//Used to clear template information entered by the user after submission.
private static void ClearProductTemplateInput(BasketItem item, Control container)
{
// COLLECT ANY ADDITIONAL INPUTS
Product product = item.Product;
if (product != null)
{
ProductTemplate template = item.Product.ProductTemplate;
if (template != null)
{
foreach (InputField input in template.InputFields)
{
//ONLY LOOK FOR CUSTOMER INPUT FIELDS
if (!input.IsMerchantField)
{
//SEE IF WE CAN LOCATE THE CONTROL
Control findControl = PageHelper.RecursiveFindControl(container, input.UniqueId);
if (findControl != null)
{
TextBox tb = findControl as TextBox;
if (tb != null)
{
tb.Text = "";
}
}
}
}
}
}
}
Thanks in advance,
David Noell