How to create a sub theme for opencart 3

Submitted by ruo on Mon, 05/07/2018 - 12:44

1, create the subtheme theme:

/catalog/view/theme/subtheme

which will use the default theme if the template file miss, you can copy the file and modify it one by one.

2, create admin files for subtheme to enable it.

clone:

admin/controller/extension/theme/default.php

to:

admin/controller/extension/theme/subtheme.php

and replace all theme_default to theme_subtheme

replace all theme/default to theme/subtheme

 

Options action.

clone:

admin/language/en-gb/extension/theme/default.php

to:

admin/language/en-gb/extension/theme/subtheme.php

and modify same strings like heading_title to "Sub theme"

Clone 

admin/view/template/extension/theme/default.twig

to

admin/view/template/extension/theme/subtheme.twig

and replace all theme_default to theme_subtheme

 

3.Enable it on database:

Execute the SQL command:

INSERT INTO `oc_setting` ( `store_id`, `code`, `key`, `value`, `serialized`) VALUES 
( 0, 'theme_subtheme', 'theme_subtheme_status', '1', 0);

 

4. Enable the theme:

Go to Extensions>Extensions>Filter by theme, the theme should display as enabled.

Go to Setting> select your store and enable the new theme now.

 

 

 

 

 

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.