Tuesday, May 9, 2017

Custom OpenCart theme

I was looking to customize the default theme in OpenCart and realized that I will probably need to do quite a bit of work given there was no immediate “help” related on the subject.
In essence it turned out to be a lot less painful than I thought.
Here is what I did. Assuming new theme name “mytheme” and title “My Theme”.
Make copies…
  1. To start with copy the default folder found in
    to a new folder in the same directory. Name it “mytheme“.
  2. Then copy the theme_default.php file in
    and place it in same directory. Name it “mytheme.php“.
    + Rename the class to (line 2):
    + Replace all “theme_default” text to “mytheme“. Yes there are a lot (197).
  3. Copy the theme_default.tpl in
    and place it in the same directory. Name it “mytheme.tpl“.
    + Replace all “theme_default” text to “mytheme“. (48)
  4. Copy theme_default.php in
    and place it in the same directory. Name it “mytheme.php“.
    + Set the new theme’s title in heading_title (line 3) to “My Theme”.
  5. Finally for the thumnail image to show correctly in store settings rename default.png to mytheme.png in
Now go into your Administration > Extensions > Extensions and select Themes in “Choose the extension type”. You should be seeing your new theme. Install it with the green (+) button and edit it to enable it. Also ensure you set the correct theme directory whilst editing the theme!
Then in System > Settings edit your store to use your new theme.
That should do it. You can now go ahead and start chopping and changing the default theme.