PHP / OpenCart 2.2.0 - Creating custom theme

三世轮回 提交于 2020-01-04 05:14:12

问题


i'm starting today with theme development in OpenCart 2.2 and i'm following this article:

http://code.tutsplus.com/tutorials/create-a-custom-theme-with-opencart-introduction--cms-21786

Wich uses the 1.5.6.1 version of opencart. (I can't find nothing about this for version 2.2, so i assumed it must be the same).

As a i understand we should create the theme directory in catalog/view/theme. For test pourposes i created a "customtheme" directory and copied the dir structure from the default theme.

The problem is that when i go to dashboard -> settings -> general -> Theme, the selectbox doesn't show the new theme i created.

What am i doing wrong? Should i just modify the default theme? it doesnt seem to be the best path to follow.

Thanks.


回答1:


I had the same issue when duplicating the default theme into a folder named duplicate, so I looked into the code. The admin extension for theme actually looks for a controller for the new theme which I didn't have; so what I did were

  • Duplicate the default theme controller (theme_default.php) under /admin/controller/theme/ into theme_duplicate.php and named the controller ControllerThemeThemeDuplicate
  • Replace all the keys theme_default with theme_duplicate
  • Duplicate the default view admin/view/template/theme/theme_default.tpl and named it theme_duplicate.tpl
  • I also duplicated the language file and named it theme_duplicate.php. I also updated a couple of texts inside the new duplicated language file.
  • Now if you look into the Extensions/Modifications/theme, you will see your new theme and it should so also be ready to be updated under settings




    回答2:


    I had the same problem, the custom theme was not available in the dashboard -> settings -> general -> Theme. I found a detailed solution here: http://undefined.gr/site/2016/10/09/custom-opencart-2-3-0-2-theme .




    回答3:


    You should paste all the files from catalog/view/theme/default/template into catalog/view/theme/default/customtheme. The template folder should be present there.




    回答4:


    As a newbie in opencart who got into this problem after watching the tutorial and downloading opencart 2.3.x, I read that they moved the theme changing thing to

    Extensions >> Extensions >> Themes (in the drop down menu) >> Edit >> Theme Directory.

    Hope this helps a future theme creator who comes here all confused.



    来源:https://stackoverflow.com/questions/36137603/php-opencart-2-2-0-creating-custom-theme

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