首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Magento 1.7中使用Kanavan自动搜索的反向名称搜索

在Magento 1.7中使用Kanavan自动搜索的反向名称搜索
EN

Stack Overflow用户
提问于 2014-10-16 21:08:50
回答 1查看 407关注 0票数 1

我使用karavan自动搜索扩展的magento1.7。我想修改搜索技术。在这种搜索技术中,如果我们提供了一个完整或部分的名称,那么搜索引擎就能很好地工作。但我想用它来换个名字。我的意思是,如果确切的名称是‘测试产品’,那么如果我使用‘产品测试’,结果将显示相同的产品在下拉产品列表中,现在是空的。我已经调试了它,并发现这个搜索引擎也使用magento默认搜索技术。任何想法都是acceptable.Please帮我..。提前谢谢..。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-11-14 09:41:14

Karavan扩展使用默认Magento搜索模型作为主干

app\code\local\Mage\CatalogSearch\Model\Resource\Search\collection.php

查找_getSearchEntityIdsSql()方法,并根据需要对其进行更改。

代码语言:javascript
复制
$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类

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26413915

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档