php - 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 -->
<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(), ENT_QUOTES, '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>
任何帮助表示赞赏
解决方案
推荐阅读
- c# - 收集 int 并根据它们的字符串在新行上打印它们
- android - 通过 AccessibilityService 获取 Chrome 当前 URL
- javascript - 在Javascript中映射二维数组
- javascript - Formvalidation.io - 无法读取 null 的属性“classList”
- python - list.remove(x): x 不在列表中不理解
- c# - 试图找到一个函数来计算游戏中的属性变化
- node.js - 将值传递给 API 网关的 Lambda 函数
- postgresql - 如何在没有 psql 的情况下通过 PgAdmin4 导入 pg_dump?“[archiver] 输入文件似乎是文本格式转储。使用 psql。”
- delphi - soapenv:Server.userException -> 来自 eBay 交易 API GetSellingManagerSoldListingsRequest 的错误
- python - 代码返回命令未找到,但我不确定我将命令放在哪里