I've found this free ext very cool, but i need to apply to category page.
any ideas?
http://www.opencart.com/index.php?route ... load_id=32
Is this possible to recreate in opencart 2? struggling to find a solutionQphoria wrote:I'll show you a very easy and cool dynamic way to do this:
Edit: catalog/controller/product/category.php
Find:Replace with:Code: Select all
$this->template = $this->config->get('config_template') . 'product/category.tpl';
Now, anytime you want a custom category template. Create a clone of the category.tpl file using the category path as part of the name. For example:Code: Select all
$this->template = $this->config->get('config_template') . 'product/category_' . $this->request->get['path'] . '.tpl'; if (!file_exists(DIR_TEMPLATE . $this->template)) { $this->template = $this->config->get('config_template') . 'product/category.tpl'; }
category_25.tpl
category_25_38.tpl
category_25_38_72.tpl
etc.
The code will first check for the existence of an override file. If there is one it will use it. If there is none for that category, then it will default to the original file.
This can be done for virtually any file. Products, information, etc.
I wanted this functionality, so I found a solution for opencart v2.3.0.2. I thought I would post it in case anyone else needs this:
In catalog/controller/product/category.php
find this line:
replace with this:
In catalog/controller/product/category.php
find this line:
Code: Select all
$this->response->setOutput($this->load->view('product/category', $data));
replace with this:
Code: Select all
if (file_exists(DIR_TEMPLATE . 'default/template/product/category_' . $this->request->get['path'] . '.tpl')) {
$this->response->setOutput($this->load->view('product/category_' . $this->request->get['path'], $data));
}
else {
$this->response->setOutput($this->load->view('product/category', $data));
}
Who is online
Users browsing this forum: No registered users and 110 guests