Inherit Theme - Product Accessories Page

Store UI, layout, design, look and feel; Discussion on the customer facing pages of your online store. Cascading Style Sheets, Themes, Scriptlets, NVelocity and the components in the ConLib directory.
Post Reply
derekz
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 38
Joined: Mon Nov 03, 2008 3:13 pm

Inherit Theme - Product Accessories Page

Post by derekz » Tue Apr 28, 2009 1:59 pm

I have 3 themes set up in my store. First theme is the default for the entire store, and set in the Admin section. The other 2 themes are used to show differences between product in two different categories.

In the Admin section for the two categories, I have their themes configured for their respective look and feel. The themes are working perfectly for the categories and products, however, when I add a product to the cart, and the product accessories page opens, it is taking the default theme. Is there any way to set the product accessories theme to the same theme that the product bought has?

Thanks

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Inherit Theme - Product Accessories Page

Post by mazhar » Wed Apr 29, 2009 4:28 am

Well ASP.NET provides ways to change the theme through code. For this you have to set the Page.Theme property in the Page_PreInIt event handler like below

Code: Select all

protected void Page_PreInit(object sender, EventArgs e)
    {
        Page.Theme = "theme name";
    }
So for those pages where you want to have different themes when having products from different categories, First put above function in those pages and then update function to decide theme depedning upon your criteria. For example if it depends upon category then it could be something like

Code: Select all

protected void Page_PreInit(object sender, EventArgs e)
    {
Product product = ProductDataSource.Load(PageHelper.GetProductId());
        if(product.Categories[0] == 25)
                    Page.Theme = "theme1";
        else
        if(product.Categories[0] == 35)
                    Page.Theme = "theme2";
}

Post Reply