Answer the question
In order to leave comments, you need to log in
How to include a separate stylesheet for an OpenCart category?
Hello!
OCStore 1.5.4 It is necessary that a separate style sheet be connected for some product categories.
Moreover, you need to determine what style should be for a particular category from the admin panel.
How can such a problem be solved?
Thank you!
Answer the question
In order to leave comments, you need to log in
It will look something like this:
create a style category module where you can display categories and define their name style.
We create
a model
class ModelStyleCategory extends Model {
$style_categoryes = $this->db->query("SELECT * FROM " . DB_PREFIX ."setting WHERE `group` = 'style_cat'");
return $style_categoryes->rows;
}
$this->load->model('catalog/style_model');
$category_style = $this->model_catalog_style_model->
if(isset($this->request->get['path'])) {
foreach ($category_style as $style) {
if ($style[category_id] == $this->request->get['path'])) {
$this->data['style_category'] ='<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/'.$style[name].'.css">';
}
}
}
if (isset($style_category)) {
echo $style_category;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question