加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

magento 1 search Incorrect

发布时间:2020-12-13 22:18:06 所属栏目:PHP教程 来源:网络整理
导读:文件目录app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php 大约 345 ~ 347 行注释掉 $likeCond = ‘‘; if ($searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_LIKE || $searchType == Mage_CatalogSearch_Model_Fulltext::SEAR

文件目录app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php

大约 345 ~ 347 行注释掉

        $likeCond  = ‘‘;
            if ($searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_LIKE
                || $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE
            ) {
                $helper = Mage::getResourceHelper(‘core‘);
                $words = Mage::helper(‘core/string‘)->splitWords($queryText,true,$query->getMaxQueryWords());
                foreach ($words as $word) {
                    $like[] = $helper->getCILike(‘s.data_index‘,$word,array(‘position‘ => ‘any‘));
                }
                if ($like) {
                    $likeCond = ‘(‘ . join(‘ OR ‘,$like) . ‘)‘;
                }
            }

?

在347行下添加下面2行

$likeCond = ‘`s`.`data_index` LIKE :likew‘;
$bind[‘:likew‘] = ‘%‘.$queryText.‘%‘;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读