Results 1 to 3 of 3

Thread: Would like products to use own template.master

  1. #1
    Join Date
    Jun 2011
    Posts
    19

    Exclamation Would like products to use own template.master

    I have created a template.master that I want only my products to use. What steps do I need to take to implement this. I do not have the source code. Help would be very much appreciated!

  2. #2
    Join Date
    Jan 2007
    Location
    Evansville, IN
    Posts
    57

    Default

    It's not terribly easy to assign a .master to a product. This thread should get you started.

    template.master can only be assigned to an entity like a category.
    -----------------------------------------------------
    MadStamper
    9.3 VB - http://www.SignsOverAmerica.com

  3. #3
    Join Date
    Nov 2008
    Location
    London, UK
    Posts
    432

    Default

    One *really* easy way to do this without needing access to the source code...

    In your site's root web directory, look for showproduct.aspx.cs

    Edit this file and find the method called OverrideTemplate()

    Change the start of the method to look like this:

    Code:
          protected override string OverrideTemplate()
            {
    			return "product.master";
    Leave the rest of the code unchanged. You will of course need your custom product template file (called product.master) in App_Templates\Skin_1

    (Note: This switches off all other template switching for products and is a brute force quick code change)

    Taking this a stage further, you could even put template names into the product's ExtensionData field. This would enable you to use the default template (where ExtensionData is empty) but to allow individual products to have their own custom templates.

    Adam

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •