Post by eft0 » Fri Feb 23, 2018 3:31 am

OC version: 3.0.2.0
I need to use the multi-store feature, the 1st store it's working fine, now I need to create a new one.

I want to duplicate the "default" template, and assign it to a new store in the same OC, what I do so far:

- Upload the "default" version of the theme into /catalog/view/theme/tc/
- Modify the /template/common/header.twig for path issues.
- Duplicate /admin/controller/extension/theme/default.php to /admin/controller/extension/theme/tc.php
- In this file, replacing all the "theme_default" to "theme_tc" and the class name
- Duplicate the language files /admin/language/en-gb/extension/theme/default.php to /admin/language/en-gb/extension/theme/tc.php

Now:
- Goint to admin Panel, Extensions -> Modules -> Themes
- Install and activate the "TC" theme, and fill all data.
- System -> Settings -> Stores -> Add New
- Fill all the data and select theme "TC".
- Save and go to the new URL: http://www.todocalculadoras.cl/
- The theme doesnt change (if you view the source code, header seccion (header.twig) does't change the "default" path).

In my cPanel I use the "aditional domains" setting to assign the new domain on the same hosting account, pointing to the same document root.-

1st store working fine: https://www.doce34.cl/
2nd store: http://www.todocalculadoras.cl

I'm with this issue two days now, don't now what else to do, I read some stuff about layouts, but can't understand well, any help or clue will be aprreciate, thanks to all!

Newbie

Posts

Joined
Thu Apr 22, 2010 5:24 am

Post by jan.hermann » Sat Feb 24, 2018 10:30 pm

Hi.

I've been fighting the same problem for about two weeks, and finally got a breakthrough. I've made my own step-by-step guide so i can repeat this at a later time, and it seems there is one file you are missing: “/admin/view/template/extension/theme/default-twig”
Make a copy of it and rename the copy to “/admin/view/template/extension/theme/THEME_NAME.twig”
Open the file and edit it: Replace “default” with “THEME_NAME”. Save

Hope it helps.
My complete step-by-step guide follows, just in case.

This guide assumes you are copying the default OC theme, and is based off of the following forum thread: viewtopic.php?t=185921, with additions found various other places as well as through trial and error.

The guide is a step-by-step guide, and will enable you to completely redesign your theme, including the stylesheet.css for each store in you multistore setup of OC 3.0.2.0.

1. Creating a new theme folder
1.1. “Create catalog/view/theme/THEME_NAME” where “THEME_NAME” is a name you assign. It can be anything, but avoid blank spaces.

1.2. Copy all the files and subfolders in the folder “catalog/view/theme/default“
(or any other folder you want to use as a source for your new theme) to the catalog created above.

1.2.1. Change name of theme preview image located in
“theme/THEME_NAME/image/defult.png “
must be renamed to
“theme/THEME_NAME/image/THEME_NAME.png” in order for the picture to be displayed in the OC admin panel. Ideally a fresh picture of the theme should replace it so you know you’re seeing the right file in OC admin. Use a company logo or any other image temporarily if you want.

1.2.2. Open “theme/THEME_NAME/template/common/header.twig “ in an editor.
Search for “stylesheet.css” and edit the path to
catalog/view/theme/THEME_NAME/stylesheet/stylesheet.css"
Save

2. Make a copy the following files
2.1. “/admin/controller/extension/theme/default.php”
Rename to
“/admin/controller/extension/theme/THEME_NAME.php”

Open the file and edit it:
Replace “default” with “THEME_NAME”
Save

2.2. ”admin/language/en-gb/extension/theme/default.php”
Rename the copy to
”admin/language/en-gb/extension/theme/THEME_NAME.php

Repeate for other languages too if needed.

This is a language file. Copy and replace the word “default” with “THEME_NAME”

2.3. “/admin/view/template/extension/theme/default-twig”
Rename the copy to
“/admin/view/template/extension/theme/THEME_NAME.twig”

Open the file and edit it:
Replace “default” with “THEME_NAME”
Save


3. You can now go to your OC admin panel
3.1. Navigate to Extensions- Extensions
3.1.1. Filter for Themes and see your new Theme at the end of the list.
3.1.2. Enable the theme
3.1.3. Assign it to your store (click the edit button)
3.1.3.1. choose the directory you uploaded at in step 1 and set all the parameters necessary and save.
3.1.3.2. Set status to “enable”

3.2. Navigate to “System – Settings”
3.2.1. edit the store you want to assign the new theme to
3.2.2. select THEME_NAME in the dropdown.

4. If you do not see your theme, do the following:
4.1. Go to your dashboard main page
4.2. Click on the gear-icon in the upper right corner, just below your name and the log-out button.
4.3. Turn OFF caching for the theme
4.4. Hit refresh
4.5. Go back to “step 5 and try again.

Disclaimer:
This worked for me, but I have not done extensive testing to see if there are any bugs and or glitches. Any feedback is welcomed as that may help us all.

Thanks, Hermann.

Newbie

Posts

Joined
Sat Feb 24, 2018 7:54 pm

Post by Tomit » Mon Mar 26, 2018 8:05 pm

Thanks, this step by step guid has helped me a lot!, the theme / template system is quite a pain to get set up correctly..

Since I will need to copy the default theme a few times, I thought it might be easy to create a simple shellscript to do the work for me :) I only tried it on opencart 3.0.2.0 since that is what I'm working with. and it will only copy the default theme.

I thought I'd share it here, remember, use it at your own risk, with caution and only if you know what you are doing (or ar least create a full backup first) !

The file: https://gist.github.com/tom-it/ea1d64f2 ... 0fbca2fcf9

you need terminal access for this.. just upload the shellscript somewhere and give it execute permissions .
Usage: ./duplicate.sh THEMEDIR ADMINDIR COPYNAME

So if the script is in your root file (temporarily offcourse) and you want it to create a copy called test
./duplicate.sh catalog/view/theme admin test

Image


New member

Posts

Joined
Sat Sep 14, 2013 9:54 pm
Location - Netherlands

Post by d3z1gnr » Fri May 18, 2018 4:41 pm

This is excellent. Thank you :)

Mike Little
Director / Developer / Makes the coffee
Creative Digital Limited
http://www.creativedigital.co.nz


User avatar
Active Member

Posts

Joined
Mon Jan 18, 2010 2:59 pm
Location - Auckland, New Zealand
Who is online

Users browsing this forum: No registered users and 13 guests