1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Sample Products Module Public Display Template

Sample Products Module Public Display Template

2 posts, 0 answered
  1. Greg
    Greg avatar
    82 posts
    Registered:
    08 Aug 2012
    08 Jan 2010
    Link to this post
    We are in the process of customizing the Sample Products Module to include some new fields (images, etc) and are trying to figure out what display template is currently used on the public side. I'm assuming it is using the compiled display template from the Generic Content module? If so, can I copy the external templates from the generic content module and App_LocalResources folder over to ~/Sitefinity/ControlTemplates/Products to begin customizing the public-side display of this page?

    Also, do we need to change the ProductsPublicView.cs file to point it to this new External item template?

    Thanks!

    - Greg
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    08 Jan 2010
    Link to this post
    Hello Greg Delorey,

    ProductsPublicView control inherits from ContentView. By default the ProductsPublicView uses the embedded templates that comes from ContentView. If you want to use your own customized templates you can copy/paste these one for ContentView that we have exposed as external resources. Then you have to override LayoutTemplatePath and ItemListTemplatePath properties of the ProductsPublicView to set the templates. Below is a sample code

    public override Type LocalizationAssemblyInfo
    {
        get
        {
            return this.GetType();
        }
        set
        {
            base.LocalizationAssemblyInfo = value;
        }
    }
     
    public override Type AssemblyInfo
    {
        get
        {
            return this.GetType();
        }
        set
        {
            base.AssemblyInfo = value;
        }
    }
     
    [WebSysTemplate(PublicView.TelerikSingleItemTemplateName, "PublicView_SingleItemTemplatePath_Desc", "/Samples", true, "2010-01-01")]
    public override string SingleItemTemplatePath
    {
        get
        {
            return base.SingleItemTemplatePath;
        }
        set
        {
            base.SingleItemTemplatePath = value;
        }
    }
     
    public override string SingleItemTemplateName
    {
        get
        {
            if (string.IsNullOrEmpty(this.singleItemTemplateName))
                this.singleItemTemplateName = PublicView.TelerikSingleItemTemplateName;
            return this.singleItemTemplateName;
        }
        set
        {
            this.singleItemTemplateName = value;
        }
    }
     
    [WebSysTemplate(PublicView.TelerikItemListTemplateName, "PublicView_ItemListTemplatePath_Desc", "/Sample", true, "2010-01-01")]
    public override string ItemListTemplatePath
    {
        get
        {
            return base.ItemListTemplatePath;
        }
        set
        {
            base.ItemListTemplatePath = value;
        }
    }
     
    public override string ItemListTemplateName
    {
        get
        {
            if (string.IsNullOrEmpty(this.itemListTemplateName))
                this.itemListTemplateName = PublicView.TelerikItemListTemplateName;
            return this.itemListTemplateName;
        }
        set
        {
            this.itemListTemplateName = value;
        }
    }
     
     
    #region Constants
     
    private const string TelerikItemListTemplateName =
     "Telerik.Samples.Resources.ControlTemplates.Frontend.ListPageMaster.ascx";
     
    private const string TelerikSingleItemTemplateName =
     "Telerik.Samples.Resources.ControlTemplates.Frontend.ListPageDetails.ascx";
     
    #endregion
     
     
     
    private string itemListTemplateName;
    private string singleItemTemplateName;


    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered