Page 1 of 1

Opencart 2.2.0.0 undefined index in search results page

Posted: Mon Aug 22, 2016 10:07 pm
by kgudzinski
Hello, 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

Code: Select all

'manufacturer'    => $result['manufacturer'],
'model'    => $result['model'],
to this code:

Code: Select all

				$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

Code: Select all

<?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?