Issue When Changing Theme

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
I have created a new theme called ThemeX for example.

I have created the theme, stylesheets, etc. and placed them in the App_Themes folder.  No problem there.
I have selected the new theme in the Admin section of the system.  No problem there.
The new theme is properly utilized on any page that uses the Root.Master.  No problem there.
The web.config file still contains a theme specification of DarkOrange.

Now for the issue...
I created a new master page called Root2 (for example).  This master page is a "base" master page.
In the code-behind file I modified the "public partial class" statement with the result shown below...

namespace NopSolutions.NopCommerce.Web.MasterPages
{
    public partial class BackRoot : BaseNopFrontendMasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}

The web.config file still contains a reference to the DarkOrange theme.

I built a detailed page (call it DetailPageUsingRoot2 for example) that uses the new "Root2" master page.
When I display that page in the browser, it still uses the DarkOrange theme.

The default.aspx page properly uses the new theme.
When I put a link on the default.aspx to DetailPageUsingRoot2.aspx, it is displayed using the Dark Orange theme.

If I change the web.config theme section to the new theme, everything displays in the new theme.

There must be some kind of "hook" that I am missing in my new Root2.master page that does not load the theme selected in the Admin section.

I must be really stupid to not figure this out on my own, but could you please you tell me how to get the selected theme to display on my Root2.master-related paged regardless of what the web.config file contains for a specified theme?

Thanks in advance!

Lynn
13 years ago
Don't worry Lynn, you're not stupid. I don't even know anything about this topic at all, but I'm going to take a stab at helping you anyway.

It seems like your new pages aren't getting the theme set so they pull a default from the web.config file.

The theme is set in BaseNopFrontendPage.cs, around line 118. This is NOT a master page, or a base master page... or whatever. This is the page that all of the aspx pages are based on in the front end store. The theme is set using NopContext.Current.WorkingTheme, which pulls it from the setting "Display.PublicStoreTheme"...

What is your new details page base page? It should read something like:
public partial class RegisterPage : BaseNopFrontendPage

I know that when you create a new page it always defaults to:
public partial class NewPage : System.Web.UI.Page

You have to make sure that your new page says the former and not the latter, or the theme won't be set.

Hope this helps,
13 years ago
Barry,

That solved the problem!  Thank you, Barry.  As the old adage goes, "the devil's in the details"!

Thanks again!  Onward and upward!

Lynn
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.