2014-10-16 56 views
1

我正在使用karavan自動搜索擴展magento1.7。我想修改搜索技術。在那種搜索技術中,如果我們提供全部或部分名稱,那麼搜索引擎完美地工作。但我希望它適用於反向名稱。我的意思是如果確切的名稱是'測試產品',那麼如果我使用'產品測試',那麼結果將在下拉產品列表中顯示相同的產品,現在變成空的。我調試過它,發現這個搜索引擎也使用了magento的默認搜索技術。 任何一種思想是acceptable.Please幫助我.. 在此先感謝..在Magento 1.7中使用Kanavan Autosearch進行反向名稱搜索

回答

1

Karavan擴展使用爲骨幹

應用程序\代碼\本地\法師\ CatalogSearch \型號\資源\默認Magento的搜索模式搜索\ collection.php

查找方法_getSearchEntityIdsSql()並根據需要進行更改。

$words = array(); 
    if(str_word_count($this->_searchQuery)>1){ 
      $words = explode(" ",$this->_searchQuery); 
    } 
    $ifValueId = $this->getConnection()->getCheckSql('t2.value_id > 0', 't2.value', 't1.value'); 
    foreach ($tables as $table => $attributeIds) { 
     foreach($words as $word){ 
      $selects[] = $this->getConnection()->select() 
         ->from(array('t1' => $table), 'entity_id') 
         ->joinLeft(
          array('t2' => $table), 
          $this->getConnection()->quoteInto(
           't1.entity_id = t2.entity_id AND t1.attribute_id = t2.attribute_id AND t2.store_id = ?', 
           $this->getStoreId()), 
          array() 
         ) 
        ->where('t1.attribute_id IN (?)', $attributeIds) 
        ->where('t1.store_id = ?', 0) 
        ->where($resHelper->getCILike($ifValueId, $word, $likeOptions)); 
     } 
     if ($selects) { 
      $likeCond = '(' . join(' and ', $selects) . ')'; 
     } 

    } 

有些是這樣的。

注意:不覆蓋BAse類