I am new to opencart and trying to create custom theme using verson 3.All the tutorial i found on internet are for v2 and not working properly with v3. Please guide me.
Thanks.
steps worked for me(version 3.0.2.0 ):
1. Copy all the folder catalog/view/theme/default to catalog/view/theme/THEMENAME
2. Create the files by copying the default theme files i.e.
./admin/language/en-gb/extension/theme/THEMENAME.php (other languages too if needed)
./admin/view/template/extension/theme/THEMENAME.twig
./admin/controller/extension/theme/THEMENAME.php
as the respective default theme files
-> replacing theme_default with theme_THEMENAME, heading title on all 3 files etc
->search and replace theme/default to theme/THEMENAME in ./admin/controller/extension/theme/THEMENAME.php
->change href of css link in header.twig file
from
<link href="catalog/view/theme/default/stylesheet/stylesheet.css" rel="stylesheet">
to
<link href="catalog/view/theme/THEMENAME /stylesheet/stylesheet.css" rel="stylesheet">
3. You can now go to Extensions- Extensions Filter Themes and see your new Theme. Enable, choose the directory you uploaded at in step 1 and set all the parameters necessary and save.
4. You can now go to System Settings edit your store(s) and select the NEWTHEME.
You should now be seeing your new theme (assuming client/server caches are set to renew).
5. Now you can create your themeby changing css or template files or any other file to suite your need .
1. Duplicate the default theme
Code: Select all
<install_dir>/catalog/view/theme/default
To my own theme folder
Code: Select all
<install_dir>/catalog/view/theme/MyTheme
Code: Select all
# <install_dir>/catalog/view/theme/MyTheme/template/common/header.twig
...
<link href="catalog/view/theme/default/stylesheet/stylesheet.css" rel="stylesheet">
...
# Becomes
...
<install_dir>/catalog/view/theme/MyTheme/template/common/header.twig
...
Code: Select all
<install_dir>/admin/language/en-gb/extension/theme/default.php
<install_dir>/admin/view/template/extension/theme/default.twig
<install_dir>/admin/controller/extension/theme/default.php
...to create my new theme's extension files
Code: Select all
<install_dir>/admin/language/en-gb/extension/theme/MyTheme.php
<install_dir>/admin/view/template/extension/theme/MyTheme.twig
<install_dir>/admin/controller/extension/theme/MyTheme.php
Code: Select all
#<install_dir>/admin/language/en-gb/extension/theme/MyTheme.php
#
# Here I want to replace all references to 'default theme' with 'My Theme'
# I see that this isn't all that necessary but for clarity I will make sure any messages / errors / etc
# Relating to My Theme reflect 'My Theme' instead of 'Default Theme'
# Here are the 4 occurrences
...
$_['heading_title'] = 'My Theme';
...
$_['text_success'] = 'Success: You have modified My Theme!';
$_['text_edit'] = 'Edit My Theme';
...
$_['error_permission'] = 'Warning: You do not have permission to modify My Theme!';
Code: Select all
# <install_dir>/admin/view/template/extension/theme/MyTheme.twig
# Here's where it gets confusing. The original post says to replace theme_default...
# there are 48 occurrences in this template.
# My gut tells me to not mess with the <select> tags 'name' attribute
# (which is where these all occur) and if they wanted me to they would
# have said 'replace default_theme_*' or the like...
# On the other hand, there is no other occurrence of default_theme anywhere else
# in this file. I will leave alone for now and if it doesn't work i'll come back to this.
Code: Select all
# <install_dir>/admin/controller/extension/theme/MyTheme.php
# There are 5 occurrences
...
$this->load->language('extension/theme/MyTheme');
...
'href' => $this->url->link('extension/theme/MyTheme', 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $this->request->get['store_id'], true)
...
$data['action'] = $this->url->link('extension/theme/MyTheme', 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $this->request->get['store_id'], true);
...
$this->response->setOutput($this->load->view('extension/theme/default', $data));
...
if (!$this->user->hasPermission('modify', 'extension/theme/MyTheme')) { ...
Ok, I see my theme in Extensions > Extensions > Filter=themes but when I try to enable it I get "internal server error"You can now go to Extensions- Extensions Filter Themes and see your new Theme. Enable, choose the directory you uploaded at in step 1 and set all the parameters necessary and save.
I need to find out how to get better errors and turn on debuging / find where the logs are stored. I'll be back once I get that figured out... I'll also try changing those 48 occurrences of default_theme_* to MyTheme_* and get back to you.
Please reply, help me find the solution,
Thanks.
I checked my logs...
[Sun Jan 28 17:51:14.415304 2018] [php7:error] [pid 33696:tid 1172] [client 127.0.0.1:51378] PHP Fatal error: Uncaught Error: Class 'Controllerextensionthemebamidbar' not found in D:\\data\\sw\\bamidbarconnect\\shop\\system\\engine\\action.php:71
You have to update the class name in the controller you copied from the default
In my case, that entailed changing the name ControllerExtensionThemeDefault to ControllerExtensionThemeBamidbar fixed the problem; bamidbar is my theme's name.
There was a question from a commenter about which items needed to be renamed to theme_THEMENAME - I did a global search/replace of all occurrences of theme_default in the three files in the admin/ directory. That seems to have worked.as the respective default theme files and replacing theme_default with theme_THEMENAME, heading title on language files etc
After looking into these posts, I thought this had solved my issue and it now appears in my store to select the template, but when I go to extensions>extensions and select the template and update the fields I get this appear at the top of the page.steve_sobol wrote: ↑Mon Jan 29, 2018 10:07 amAbout that internal server error... I also saw it when enabling my theme
I checked my logs...
[Sun Jan 28 17:51:14.415304 2018] [php7:error] [pid 33696:tid 1172] [client 127.0.0.1:51378] PHP Fatal error: Uncaught Error: Class 'Controllerextensionthemebamidbar' not found in D:\\data\\sw\\bamidbarconnect\\shop\\system\\engine\\action.php:71
You have to update the class name in the controller you copied from the default
In my case, that entailed changing the name ControllerExtensionThemeDefault to ControllerExtensionThemeBamidbar fixed the problem; bamidbar is my theme's name.
Notice: Undefined index: theme_default_product_limit in /home/stgiftsc/public_html/test/admin/controller/extension/theme/lindsey.php on line 335Notice: Undefined index: theme_default_product_description_length in /home/stgiftsc/public_html/test/admin/controller/extension/theme/lindsey.php on line 339Notice: Undefined index: theme_default_image_category_width in /home/stgiftsc/public_html/test/admin/controller/extension/theme/lindsey.php on line 343Notice: Undefined index: theme_default_image_thumb_width in /home/stgiftsc/public_html/test/admin/controller/extension/theme/lindsey.php on line 347Notice: Undefined index: theme_default_image_popup_width in /home/stgiftsc/public_html/test/admin/controller/extension/theme/lindsey.php on line 351Notice: Undefined index: theme_default_image_product_width in /home/stgiftsc/public_html/test/admin/controller/extension/theme/lindsey.php on line 355Notice: Undefined index: theme_default_image_additional_width in /home/stgiftsc/public_html/test/admin/controller/extension/theme/lindsey.php on line 359Notice: Undefined index: theme_default_image_related_width in /home/stgiftsc/public_html/test/admin/controller/extension/theme/lindsey.php on line 363Notice: Undefined index: theme_default_image_compare_width in /home/stgiftsc/public_html/test/admin/controller/extension/theme/lindsey.php on line 367Notice: Undefined index: theme_default_image_wishlist_width in /home/stgiftsc/public_html/test/admin/controller/extension/theme/lindsey.php on line 371Notice: Undefined index: theme_default_image_cart_width in /home/stgiftsc/public_html/test/admin/controller/extension/theme/lindsey.php on line 375Notice: Undefined index: theme_default_image_location_width in /home/stgiftsc/public_html/test/admin/controller/extension/theme/lindsey.php on line 379
Does anyone know why this is happening and how it can be fixed so that it saves what I'm inputting.
Many thanks in advance
I try to do custom theme in opencart, I have seen some tutorial in that they coping the default theme and renaming some file and title, They showed this directory (/admin/language/en-gb/extension/theme/default.php, ./admin/view/template/extension/theme/default.twig, ./admin/controller/extension/theme/default.php) but in my opencart root folder there is no such folder in my root directory.
How to get the files.
Please help me,
Thank You
Attachments
disable_cashe.png (103.06 KiB) Viewed 64976 times
I've been having the undefined index errors which has been resolved by replacing all instances of "default" in admin/view/template/extension/theme/my_theme.twig with "my_theme" (obviously it should be whatever you've used for your theme name).
I noticed that there's a test on line 35:
{% if directory == theme_default_directory %}
which is going to fail since it should be
{% if directory == theme_my_theme_directory %}
Looking further into the file all the input box names are theme_default_blah_blah_blah so it makes to change them all to whatever your theme name is.
It's worth mentioning that I did turn off caching first.
first post of that topic and previous post (by kevxcs » Wed May 23, 2018 2:36 pm) made it complete for me, just as covered by the following video https://www.youtube.com/watch?v=mqTstomXZiM. This video tutorial is almost 100% step by step but you might have to use common sense sometime as for example the "admin/view/template/extension/theme/MYTHEME.twig" file changes, line 128. I changed 'default' to 'MYTHEME' and everything works fine so far.
I've created simple web app for creating new custom Opencart 3.x.x. theme. Please test it and let me know result.
http://ivan99.5gbfree.com/opencart-new-theme/
https://www.antropy.co.uk/blog/how-to-c ... t-3-theme/
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Nice idea but it throws loads of warnings:AndreyK wrote: ↑Fri Feb 15, 2019 2:03 pmHi everybody!
I've created simple web app for creating new custom Opencart 3.x.x. theme. Please test it and let me know result.
http://ivan99.5gbfree.com/opencart-new-theme/
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
AndreyK wrote: ↑Fri Feb 15, 2019 2:03 pmHi everybody!
I've created simple web app for creating new custom Opencart 3.x.x. theme. Please test it and let me know result.
http://ivan99.5gbfree.com/opencart-new-theme/
Thanks! There were some bug with hosting so i have to change it. Here is new URL:
http://kotsarweb.5gbfree.com/opencart3-new-theme
Nice summary. Of course, quite often all that's needed for a new theme is to merely create a new theme folder, and then in the OpenCart admin backend atpaulfeakins wrote: ↑Fri Feb 15, 2019 8:22 pmI've combined various information here to produce this downloadable theme template with instructions on how to give it your own name:
https://www.antropy.co.uk/blog/how-to-c ... t-3-theme/
Extensions > Extensions > Themes > Default Store Theme > edit > Theme Directory
to select it.
And only copy necessary files (CSS, images) and modified templates to the new theme folder.
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Nope that's not true, as it says in the very first paragraph of the article:
"Creating a new theme for OpenCart 1.5 used to be pretty easy - make a folder in the theme directory and copy only the files from the default theme that you want to change. And that was about it.
OpenCart 3 brings new features, but creating a theme is a little more difficult."
Presumably you haven't created an OC3 theme yet.
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
As long as you are fine with your various image size settings then quite often all you need to do is to create a new theme folder, with just the necessary template files, and stylesheets. And then select the theme folder at
Extensions > Extensions > Themes > Default Store Theme > edit > Theme Directory
I just tested it again, it works fine!
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
What exact version of 3?
Pretty sure a new theme needs "VC-L" - View, Controller and Language (but not Model) in the admin to appear in the dropdown.
See here:
viewtopic.php?t=187122
And here:
https://stackoverflow.com/questions/487 ... evelopment
I could be missing something obvious - would be good to get to the bottom of this.
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Users browsing this forum: No registered users and 159 guests