Thursday, February 2, 2012

How to show the Exact searh result in Magento

If you want to show the exact search reult for your products
Two things need to be changed

1) In admin system->configuration->catalog->catlogsearch->Search Type
 Make it as Like


2)Just copy the fulltex.php file  in local folder as given 
 app/code/local/Mage/CatalogSearch/Model/Mysql4/fulltext.php

 and just replace the above code 
  
foreach ($words as $word) {
    $like[] = $helper->getCILike('s.data_index', $word, array('position' => 'any'));
}
if ($like) {
    $likeCond = '(' . join(' OR ', $like) . ')';
}

BY 
    
foreach ($words as $word) { 
    $like[] = '`s`.`data_index` LIKE :likew' . $likeI;
    $bind[':likew'] = '%' . $queryText . '%';
}
if ($like) {
    $likeCond = '(' . join(' AND ', $like) . ')'; 
}
                
and clear the cache and reindex tha data from admin Hope this will help you 

No comments:

Post a Comment

Thankyou for your Comments

LinkWithin

Blog has moved, searching new blog...