opencartopencart2.xopencart2.3

Opencart how to display model value of products in search page


I am using opencart version 2.1.0.2 and I am trying to display in the search results page the model number for each product.

I have tried the follow varius resolutions that I found on the web and also from stackoverflow questions but nothing worked for me at the end and I beleive that the reason its because that the examples that I followed was in different opencart versions.

One of the solutions that i found is Opencart display Model Code in Search Page

Can anyone suggest me any other solution that can work with my opencart version?


Solution

  • To display Model Number in search results

    Open search.php from Catalog/Controller/Product

    and search for

    'name'        => $result['name'],
    

    add this after

    'model'        => $result['model'],
    

    Now open search.tpl from catlog/view/theme/default/template/product

    and search for

        <?php if ($product['tax']) { ?>
             <span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
       <?php } ?>
    </p>
    

    add after

    <p>
       <?php if ($product['model']) { ?>
          <?php echo $text_model; ?> <?php echo $product['model']; ?>
       <?php } ?>
    </p>
    

    Hope this answer might Help you