Post by BOUSCAT123 » Wed Jun 13, 2018 8:14 am

Hello, i have made something that display categories as result in search.tpl but i do not get the image of the category i don't understand why. It's a lot frustrating because everything works but the image category.

Here is the code into controler of product/search.php

Code: Select all

$product_total = $this->model_catalog_product->getTotalProducts($filter_data);
				$categories_result = $this->model_catalog_categories_search->searchCategories(str_replace('-', '_', $filter_data['filter_name']));
				$data['categories'] = array();
				foreach ($categories_result as $category) {
					if ($category['image']) {
						$image = $this->model_tool_image->resize($category['image'], 512, 200);
					} else {
						$image = $this->model_tool_image->resize('placeholder.png', 512, 200);
					$data['categories'][] = array(
							'category_id'  	=> $category['category_id'],
							'image'       		=> $image,
							'name'        		=> $category['name'],
Model of this categories search:

Code: Select all

<?php class ModelCatalogCategoriesSearch extends Model {

    public function searchCategories($term) {

        $categories = [];
        if (!empty($term)) {
            $categories_sql = "SELECT * FROM " . DB_PREFIX . "category WHERE name LIKE '%" . $this->db->escape($term) . "%' ORDER BY name ASC;";

            $categories_query = $this->db->query($categories_sql);

            foreach ($categories_query->rows as $category) {
                $categories[$category['category_id']] = $category;

        return $categories;

And the product/search.tpl:

Code: Select all

				<?php if ($categories) { ?>

				        <?php foreach ($categories as $category) { ?>
				        <a href="index.php?route=product/category&path=<?php echo $category['category_id']; ?>">
				          <img src="<?php echo $category['image']; ?>"/>
					<?php echo $category['name']; ?></a>
				        <?php } ?>

				<?php } ?>



Sun Dec 09, 2012 11:23 pm

Post by IP_CAM » Wed Jun 13, 2018 9:17 am

A rare opportunity, as it looks, for beeing such an Oldie here ... :D (since 09 Dec 2012)
But to solve this problem, you better ask for pro assistance in the commercial
section of this forum, many Dev's don't come here anymore, and so don't see
your Posting. And with 100'000+ clients since 1999, I guess you should be able to
afford it too :D
Good Luck, nothing personal, just making a joke !
Ernie ... ur-fr.html

I am no longer active at this Forum.
Please don't send Personal Messages, contact:
Github OC Downloads:
2'000+ FREE OC Extensions from the World's largest Github OC Archive.

User avatar
Legendary Member


Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by BOUSCAT123 » Wed Jun 13, 2018 3:34 pm

Hello, i have made a modification of a module that display manufacturers in search result to display category. The developper didn't answer for a previous support ask since 3 days then i think as he has developped 2 modules and was not connected since 2016 he will not answer.
This is why i ask for some help here. I don't think somebody will help me, but if it could be possible i would be really happy to display manufacturers with images in search results.

Nobody has an idea to solve this problem?



Sun Dec 09, 2012 11:23 pm
Who is online

Users browsing this forum: No registered users and 4 guests