Im trying to make an product template extender, which is going to manipulate the value of another template tag.
public class SalesPriceProductTemplateExtender : ProductTemplateExtender { public override void ExtendTemplate(Dynamicweb.Rendering.Template template) { const string tag = "Product.SalesPrice"; try { var tagValue = Convert.ToInt32(template.Tags.GetTagByName("Ecom:Product.Price.Price").Value) * 2; template.SetTag(tag, tagValue.ToString("C")); } catch (Exception e) { template.SetTag("SalesPriceProductTemplateExtender.Debug", e.ToString()); template.SetTag(tag, 0.ToString("C")); } } }
This always return 0,00 since it throw an exception. By further investigation I can see that if I do an count on "template.Tags" I get 0. So it does not look like it is fetching the template tags. Is this correct? Is this code fireing before the tags are even set? If so, how can I make an extender that fires after the tags are generated, but before the site is loaded.