Why is OpenCart 2.3 custom theme not showing?

亡梦爱人 提交于 2019-11-27 06:22:28

问题


I've read through some guides and watched a YouTube video on how to create a custom theme for OpenCart. After trying various things it still doesn't seem to be working right.

If I go to 'Extensions > Themes > Edit Store' I can switch the theme directory but this doesn't seem right. The question bubble there says changing the theme directory here is only for legacy support of older themes. Current themes should be available through 'System > Settings > Edit Store > General Tab (Select Theme Dropdown).

Why doesn't this seem to work? The new version is supposed to fall back on the default theme if something isn't available but it can't if I change the theme directory. I've even tried simply copying the whole default folder and renaming it.


回答1:


Opencart 2.3.0 :

Go to Extestions >> Extestions >> Choose the extension type >> Select Themes >> Edit Your themes >> change default theme. See screenshots:

1 : https://postimg.cc/image/ds02xcmbp/

2 : https://postimg.cc/image/bre4q9fk5/




回答2:


In file <Your project name>/catalog/controller/event/theme.php replace row 16 from:

$theme = $this->config->get('config_theme');

to:

$theme = $this->config->get($this->config->get('config_theme') . '_directory');



回答3:


I know it's bit late to answer but it can be helpful to others.

In OpenCart 2.3.0.2 creating a custom theme is little complex , finally i found this doc here which helped me a lot http://undefined.gr/site/2016/10/09/custom-opencart-2-3-0-2-theme/

To start with copy the default folder found in upload/catalog/view/theme/default to a new folder in the same directory. Name it “mytheme“.

Then copy the theme_default.php file in upload/admin/controller/extension/theme and place it in same directory. Name it “mytheme.php“.

  • Rename the class to (line 2):

ControllerExtensionThemeMyTheme + Replace all “theme_default” text to “mytheme“. Yes there are a lot (197).

Copy the theme_default.tpl in upload/admin/view/template/extension/theme and place it in the same directory. Name it “mytheme.tpl“.

  • Replace all “theme_default” text to “mytheme“. (48)

Copy theme_default.php in upload/admin/language/en-gb/extension/theme 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”.

Finally for the thumnail image to show correctly in store settings rename default.png to mytheme.png in upload/catalog/view/theme/mytheme/image 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



来源:https://stackoverflow.com/questions/39097531/why-is-opencart-2-3-custom-theme-not-showing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!