NOPCommerce Themes and Theming

NopCommerce 2.0 is now fully ASP.Net MVC3 using razor etc. Pretty nice stuff. This makes porting a site from earlier version a bit of a challenge, if it has a lot of customization. Actually if you only made customizations via CSS modifications, then it is actualy very easy to port over (I’ll make another post covering this), but changes to any of the aspx files will require porting these over to the new razor .cshtml format.

When doing this porting though, a nice new feature in 2.0 makes this job easier-  the ability to “overload” a view inside your theme. This basically means that a custom pluggable theme can change the page structures. Previously, the themes really only had power to change things via stylesheets, so you could change colors and formatting, but doing deeper modifications to pages requred opening the source code in visual studio and hacking on the .aspx pages.

To take advantage of this feature, just add your overloaded (or even completely new) .cshtml files inside the /themes/{your theme}/Views folder. This folder should mimic your normal views folder, ie it should use a /Shared folder for shared views, /Home for the home etc.

Now you can hack on the structure of your site without having to change the original .cshtml file.. if you mess things up, just delete (or rename) your theme view and the original view will be picked up and used.


Leave a Reply

Your email address will not be published. Required fields are marked *