如何解决Opencart SEO 模块搜索问题
当 SEO 被激活时,我在搜索栏中的搜索功能出现问题,我每次搜索都找不到页面
没有 SEO 激活搜索工作正常
我注意到在这个例子中使用关键字 iphone 的区别如下
https://www.example.com/se/product/search?search=iphone(在设置搜索链接中禁用 SEO 看起来像这样并且有效)
https://www.example.com/product/searchiphone(在设置中启用 SEO 搜索链接看起来像这样并且不起作用)
启用的 SEO 看起来像这样的 searchiphone,而禁用的 SEO 则搜索有效 search?search=iphone
如果有人能帮我找到要更改的正确行,那么使用 SEO 激活的搜索会从搜索更改为搜索吗?search=
我已经添加了与搜索产品相关的文件中的代码
<!-- Search -->
<file path="catalog/controller/product/search.php">
<operation>
<search><![CDATA[function index() {]]></search>
<add position="before"><![CDATA[
private function _decodeSearchKeyword() {
$name = 'search';
if( ! isset( $this->request->get[$name] ) ) {
$name = $name == 'filter_name' ? 'search' : 'filter_name';
if( ! isset( $this->request->get[$name] ) )
return '';
}
$search = urldecode( $this->request->get[$name] );
return str_replace( 'Ow==',';',$search );
}
]]></add>
</operation>
</file>
<file path="catalog/controller/product/search.php">
<operation>
<search><![CDATA[$search = $this->request->get['search'];]]></search>
<add position="replace"><![CDATA[
$search = $this->_decodeSearchKeyword();
]]></add>
</operation>
<operation>
<search><![CDATA[$tag = $this->request->get['search'];]]></search>
<add position="replace"><![CDATA[
$tag = $this->_decodeSearchKeyword();
]]></add>
</operation>
<operation>
<search><![CDATA[$this->document->setTitle($this->language->get('heading_title') . ' - ' . $this->request->get['search']);]]></search>
<add position="replace"><![CDATA[
$this->document->setTitle($this->language->get('heading_title') . ' - ' . $this->_decodeSearchKeyword());
]]></add>
</operation>
<operation>
<search><![CDATA[urlencode(html_entity_decode($this->request->get['search'],ENT_QUOTES,'UTF-8'))]]></search>
<add position="replace"><![CDATA[urlencode(html_entity_decode($this->_decodeSearchKeyword(),'UTF-8'))]]></add>
</operation>
<operation>
<search><![CDATA[$data['heading_title'] = $this->language->get('heading_title') . ' - ' . $this->request->get['search'];]]></search>
<add position="replace"><![CDATA[$data['heading_title'] = $this->language->get('heading_title') . ' - ' . $this->_decodeSearchKeyword();]]></add>
</operation>
</file>
<file path="catalog/controller/product/category.php">
<operation>
<search><![CDATA[$this->document->setTitle(]]></search>
<add position="after"><![CDATA[
if ( $this->config->get('smp_use_meta_robots') && ( isset($this->request->get['page']) || isset($this->request->get['limit']) || isset($this->request->get['order']) ) ) {
if( !empty($this->config->get('smp_use_meta_robots_value')) ){
$this->document->addMeta( 'ROBOTS',$this->config->get('smp_use_meta_robots_value') );
}
}
]]></add>
</operation>
</file>
<file path="catalog/controller/product/search.php">
<operation>
<search><![CDATA[$this->document->setTitle(]]></search>
<add position="after"><![CDATA[
if ( $this->config->get('smp_use_meta_robots') ){
if( !empty($this->config->get('smp_use_meta_robots_value')) ){
$this->document->addMeta( 'ROBOTS',$this->config->get('smp_use_meta_robots_value') );
}
}
]]></add>
</operation>
</file>
感谢任何帮助
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。