Hi,
In Opencart 2.x and 3.x body has different class in different pages. You can use it in Opencart 1 too.
code from the catalog\controller\common\header.php OC2.3:
and catalog\view\theme\default\template\common\header.tpl:
In Opencart 2.x and 3.x body has different class in different pages. You can use it in Opencart 1 too.
code from the catalog\controller\common\header.php OC2.3:
Code: Select all
// For page specific css
if (isset($this->request->get['route'])) {
if (isset($this->request->get['product_id'])) {
$class = '-' . $this->request->get['product_id'];
} elseif (isset($this->request->get['path'])) {
$class = '-' . $this->request->get['path'];
} elseif (isset($this->request->get['manufacturer_id'])) {
$class = '-' . $this->request->get['manufacturer_id'];
} elseif (isset($this->request->get['information_id'])) {
$class = '-' . $this->request->get['information_id'];
} else {
$class = '';
}
$data['class'] = str_replace('/', '-', $this->request->get['route']) . $class;
} else {
$data['class'] = 'common-home';
}
Code: Select all
<body class="<?php echo $class; ?>">
I think my description in the previous post is enough.
If you have OpenCart 2.x package, look at the files I mentioned.
If you use custom theme, edit your custom theme instead of the default template.
If you have OpenCart 2.x package, look at the files I mentioned.
If you use custom theme, edit your custom theme instead of the default template.
i saw that the problem is not the only one .
my body like this in the header.tpl
<body>
<div id="wrap1">
<div id="wrap2"></div>
<div id="wrap3"></div>
<div id="wrap4"></div>
<div id="wrap5"></div>
<div id="wrap6"> </div>
but on catalog and product page i will need , maybe 2 or 3 of them ... what kind of change i have to do for that ... thanks
( https://www.opencart.com/index.php?rout ... earch=body )
i install this extenison but i think it is only about css ...
my body like this in the header.tpl
<body>
<div id="wrap1">
<div id="wrap2"></div>
<div id="wrap3"></div>
<div id="wrap4"></div>
<div id="wrap5"></div>
<div id="wrap6"> </div>
but on catalog and product page i will need , maybe 2 or 3 of them ... what kind of change i have to do for that ... thanks
( https://www.opencart.com/index.php?rout ... earch=body )
i install this extenison but i think it is only about css ...
This is, what will be shown in a 1.5.6.x Version, after implementing the Code into the header.php file,
it's suddenly complaining about an unexpected 'end-php' ?> TAG on the Page End.
and after removing this PHP END Tag (still required in 1.5.x Versions!), it displays this:
meaning, that the Code from v.2.x Versions in the header.php file does not work, as coded,
since 1.5.6.x Versions still use $this->data instead of $data !
---
So, I implemented this Code, found in PEKU's famous V.2-themed OpenCart EDGE 1.5.6.5, to
make it work error-free.
---
The Content will replace anything, what comes below this Sectiion:
with this:
And one now just has to find out, where to place the COMMAND, to exchange the Default Style
with the Custom Style, to be used in specific Sections.
Untested yet, but possibly, by creating a product-category-34 CLASS Section
in the stylesheet.css File, to match the Page(s), where changes are to be placed.
In this case, the <body class="product-category-34"> Link in the Browser-Source.
But, to be honest, I don't know (yet), I could be faaaar off !...
Ernie
it's suddenly complaining about an unexpected 'end-php' ?> TAG on the Page End.
Code: Select all
Parse error: syntax error, unexpected '?>', expecting function (T_FUNCTION) in /home/jacobch/www/ebikes_li/shop/vqmod/vqcache/vq2-catalog_controller_common_header.php on line 221
Code: Select all
Parse error: syntax error, unexpected end of file, expecting function (T_FUNCTION) in /home/jacobch/www/ebikes_li/shop/vqmod/vqcache/vq2-catalog_controller_common_header.php on line 221
since 1.5.6.x Versions still use $this->data instead of $data !
---
So, I implemented this Code, found in PEKU's famous V.2-themed OpenCart EDGE 1.5.6.5, to
make it work error-free.
---
The Content will replace anything, what comes below this Sectiion:
Code: Select all
'href' => $this->url->link('product/category', 'path=' . $category['category_id'])
);
}
}
Code: Select all
if (isset($this->request->get['route'])) {
if (isset($this->request->get['product_id'])) {
$class = '-' . $this->request->get['product_id'];
} elseif (isset($this->request->get['path'])) {
$class = '-' . $this->request->get['path'];
} elseif (isset($this->request->get['manufacturer_id'])) {
$class = '-' . $this->request->get['manufacturer_id'];
} else {
$class = '';
}
$this->data['class'] = str_replace('/', '-', $this->request->get['route']) . $class;
} else {
$this->data['class'] = 'common-home';
}
$this->children = array(
'module/language',
'module/currency',
'module/cart'
);
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();
}
}
?>
with the Custom Style, to be used in specific Sections.
Untested yet, but possibly, by creating a product-category-34 CLASS Section
in the stylesheet.css File, to match the Page(s), where changes are to be placed.
In this case, the <body class="product-category-34"> Link in the Browser-Source.
But, to be honest, I don't know (yet), I could be faaaar off !...
Ernie
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Who is online
Users browsing this forum: No registered users and 394 guests