Page 1 of 1

Search result lists disabled products if "search description" checked

Posted: Fri Jan 18, 2008 3:16 pm
by madaha
how to slove this problem? Looking for help.

Re: Search result lists disabled products if "search description" checked

Posted: Sat Jan 19, 2008 2:33 pm
by bruce
It is an error in the sql statement.

change catalog\controller\search.php as shown. It is a one line change but I have shown more code to help you locate it. The original line is commented. Replace it with the line below.

Code: Select all

      		if (!$session->get('search.description')) {
        		$sql = "select * from product p left join product_description pd on (p.product_id = pd.product_id) left join image i on (p.image_id = i.image_id) where pd.language_id = '?' and pd.name like '?' and p.date_available < now() and p.status = '1'";
				
				$results = $database->getRows($database->splitQuery($database->parse($sql, $language->getId(), '%' . $session->get('search.search') . '%'), $session->get('search.page'), $config->get('config_max_rows')));
      		} else { 
                // $sql = "select * from product p left join product_description pd on (p.product_id = pd.product_id) left join image i on (p.image_id = i.image_id) where pd.language_id = '?' and pd.name like '?' or pd.description like '?' and p.date_available < now() and p.status = '1'";
                // ** replace the above line with the following line
                $sql = "select * from product p left join product_description pd on (p.product_id = pd.product_id) left join image i on (p.image_id = i.image_id) where pd.language_id = '?' and (pd.name like '?' or pd.description like '?') and p.date_available < now() and p.status = '1'";
				
				$results = $database->getRows($database->splitQuery($database->parse($sql, $language->getId(), '%' . $session->get('search.search') . '%', '%' . $session->get('search.search') . '%'), $session->get('search.page'), $config->get('config_max_rows')));
      		}

Search result lists disabled products if "search description" checked [sloved]

Posted: Sun Jan 20, 2008 1:02 pm
by madaha
Problem sloved ! Thank you so much !