0
votes

i try add a Model and Manufacturer name do display on search results page (OC version 2.2.0.0). I have solution, that works on Opencart v 1.5.6 +.

1. I have added this code to /catalog/controller/product/search.php

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

to this code:

$data['products'][] = array(
           'product_id'  => $result['product_id'],
           'thumb'       => $image,
           'name'        => $result['name'],
           'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get($this->config->get('config_theme') . '_product_description_length')) . '..',
           'price'       => $price,
           'special'     => $special,
           'tax'         => $tax,
           'minimum'     => $result['minimum'] > 0 ? $result['minimum'] : 1,
           'rating'      => $result['rating'],
           'href'        => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)
        );
     }

2. In /catalog/view/theme/default/template/product/search.tpl i have added this code:

in "div class caption" i try to call this names with

<?php echo $product['model']; ?>
<?php echo $product['manufacturer']; ?>

Result: error UNDEFINED INDEX on version oc 2.2. On Opencart 1 this code works perfect.

Any sugestions?

1
Be sure to check if the values are properly passed to those keys in the array. Undefined index is when there is a property with no value asigned to it.g9m29
Hello, thank You for answer. Mayby You know where i can find this all keys in Opencart CMS files?Kšištof Gudzinski

1 Answers

0
votes

Hola a mi me funciono así. encontroller category.php

                $data['products'][] = array(
                'product_id'  => $result['product_id'],
                'manufacturer' => $result['manufacturer'],
                'thumb'       => $image,
                'name'        => $result['name'],
                'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get($this->config->get('config_theme') . '_product_description_length')) . '..',
                'price'       => $price,
                'special'     => $special,
                'tax'         => $tax,
                'minimum'     => $result['minimum'] > 0 ? $result['minimum'] : 1,
                'rating'      => $result['rating'],
                'href'        => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)
            );