我使用karavan自动搜索扩展的magento1.7。我想修改搜索技术。在这种搜索技术中,如果我们提供了一个完整或部分的名称,那么搜索引擎就能很好地工作。但我想用它来换个名字。我的意思是,如果确切的名称是‘测试产品’,那么如果我使用‘产品测试’,结果将显示相同的产品在下拉产品列表中,现在是空的。我已经调试了它,并发现这个搜索引擎也使用magento默认搜索技术。任何想法都是acceptable.Please帮我..。提前谢谢..。
发布于 2014-11-14 09:41:14
Karavan扩展使用默认Magento搜索模型作为主干
app\code\local\Mage\CatalogSearch\Model\Resource\Search\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) . ')';
}
}像这样的人。
注意: DOnt覆盖BAse类
https://stackoverflow.com/questions/26413915
复制相似问题