Page 1 of 1

Problem with item.Product.ProductTemplate

Posted: Fri Dec 18, 2009 12:03 pm
by dnoell
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

Re: Problem with item.Product.ProductTemplate

Posted: Fri Dec 18, 2009 4:26 pm
by jmestep
It it's using product templates in 7.0.0, it would still be using product templates in 7.0.4 and you don't need to switch to putting everything in product custom fields.
Where is your code located?