Post by radi8tor » Sun Sep 23, 2018 6:07 pm

Hi,

Can I tweak the search in OC 3.0.2.0 so that if search returns 1 result, product page should be displayed instead of search result page?

Regards,
Andras
Last edited by radi8tor on Mon Sep 24, 2018 2:38 pm, edited 1 time in total.

New member

Posts

Joined
Thu Feb 01, 2018 6:21 pm

Post by pprmkr » Sun Sep 23, 2018 6:27 pm

Edit catalog/controller/product/search.php
Before:

Code: Select all

			foreach ($results as $result) {
Insert:

Code: Select all

			if ($product_total == 1) {
				// print_r($results);
				foreach ($results as $result) {
					$this->response->redirect($this->url->link('product/product', 'product_id=' . $result['product_id']));
				}
			}

User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by cyclops12 » Sun Sep 23, 2018 6:45 pm

Nice piece of code pprmkr
Will save the user an extra click 8)

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by radi8tor » Mon Sep 24, 2018 2:38 pm

pprmkr wrote:
Sun Sep 23, 2018 6:27 pm
Edit catalog/controller/product/search.php
Many thanks!

New member

Posts

Joined
Thu Feb 01, 2018 6:21 pm
Who is online

Users browsing this forum: No registered users and 399 guests