Problem with item.Product.ProductTemplate

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
dnoell
Ensign (ENS)
Ensign (ENS)
Posts: 19
Joined: Mon Jul 07, 2008 9:36 am

Problem with item.Product.ProductTemplate

Post by dnoell » 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

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Problem with item.Product.ProductTemplate

Post by jmestep » Fri Dec 18, 2009 4:26 pm

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?
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

Post Reply