I have been playing with the theme switcher module supplied by Q and was having problems getting it to show changes in the stylesheet.css with theme changes. I tried reinstalling and checking the instructions several times first.
I noticed that it did not always seem to change the visible html settings when trying to change using the Front End dropdown box. It was fine with the backend Admin part.
After a long look I put this down to being that the front end was using the $this->config->get('config_template') which was the value stored in the database rather than the 'theme' request from the combo box on change.
Consequently the symptoms I had were that the index page picked up the 'wrong' stylesheet from the view\theme\default folder rather than the 'intended' one from view\theme\[myTheme] folder
I have now solved my problem and thought I would post the changes I ahd to make in case it is of use to anyone else
Two changes were made to catalg\controller\common\header.php
About line 39 after
Code: Select all
$this->data['description'] = $this->document->description;
Code: Select all
if (($this->request->server['REQUEST_METHOD'] == 'GET') && isset($this->request->get['theme'])) {
$this->data['template'] = $this->request->get['theme'];
} else {
$this->data['template'] = $this->config->get('config_template');
}
About line 188 after
Code: Select all
$this->id = 'header';
Code: Select all
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/header.tpl')) {
$this->template = $this->config->get('config_template') . '/template/common/header.tpl';
} else {
$this->template = 'default/template/common/header.tpl';
}
with
Code: Select all
if (($this->request->server['REQUEST_METHOD'] == 'GET') && isset($this->request->get['theme'])){
if (file_exists(DIR_TEMPLATE . $this->request->get['theme'] . '/template/common/header.tpl')) {
$this->template = $this->request->get['theme'] . '/template/common/header.tpl';
} else {
$this->template = 'default/template/common/header.tpl';
}
} else {
$this->template = 'default/template/common/header.tpl';
}
Of course just replacing
Code: Select all
/<?php echo $template; ?>
with the literal string you are using for your theme ( ie "MyTheme") would also work but that is somewhat using hardcoding over the issue