I am working with opencart. I want to change slideshow from "content-top" to "header". It means, I wanna move the slideshow above the top menu, and it will also displays in every page instead of in home page only.
I've done following steps: 1st: add a position named "header" in admin three "slideshow.php" files (controller, language, and view folders). 2nd: I modified header.php:(add those codes after the "//menu" code block in controller folder)
$layout_id = 1;
$module_data = array();
$this->load->model('setting/extension');
$extensions = $this->model_setting_extension->getExtensions('module');
foreach ($extensions as $extension) {
$modules = $this->config->get($extension['code'] . '_module');
if ($modules) {
foreach ($modules as $module) {
if ($module['layout_id'] == $layout_id && $module['position'] == 'header' && $module['status']) {
$module_data[] = array(
'code' => $extension['code'],
'setting' => $module,
'sort_order' => $module['sort_order']
);
}
}
}
}
$sort_order = array();
foreach ($module_data as $key => $value) {
$sort_order[$key] = $value['sort_order'];
}
array_multisort($sort_order, SORT_ASC, $module_data);
$this->data['modules'] = array();
foreach ($module_data as $module) {
$module = $this->getChild('module/' . $module['code'], $module['setting']);
if ($module) {
$this->data['modules'][] = $module;
}
}
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';
}
$this->render();
3rd: add codes in header.tpl file: still, before the "//menu" code block. (in view folder)
<div>
<?php foreach ($modules as $module) { ?>
<?php echo $module; ?>
<?php } ?>
</div>
Now, the problem is: the javascript codes in banner.tpl will not run anymore. Luckily however, the javascript codes in slideshow.tpl still run.
So, currently, the website displays the banner in header position, before the menu in Home page, but the slideshow effect doesn't. If you set two photos, both of them will display in the front page. They will not change with each other any more.