Refine Search Thumbnails Opencart

Opencart by default doesn’t display refine search Thumbnails. To display the category links with the thumbnails. We will do the following.

Open “catalog/controller/product” and search for (should be around line number 160 – 170) :

1
2
3
4
				$data['categories'][] = array(
					'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
					'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url)
				);

And replace it with:

1
2
3
4
5
				$data['categories'][] = array(
					'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
					'rs_image' => $result['image'],
					'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url)
				);

Now open “catalog/view/theme/default/template/product” and search for:

1
<?php foreach ($categories as $category) { ?>

and replace it with:

1
2
<?php foreach ($categories as $category) { ?>
<img src="http://www.YOURWEBSITE.com/image/<?php echo $category['rs_image']; ?>">

Upload the edited files and login into the admin section. Goto Extensions > Modifications and refresh once.

Visit the refine search section in the front end now, The thumbnails should appear.

Don’t forget to subscribe to our blog for more hacks.

Leave a Reply

Your email address will not be published. Required fields are marked *