0

我有一个要求,只有当用户在类别页面上时,才必须显示产品搜索和登录/注册链接。该块不应在静态页脚页面上显示为联系我们或其他静态页脚链接。

奇怪的是,客户可能对这件事有非常具体的要求。

在社区的帮助下,我尽可能地靠自己工作。但到目前为止,我已经能够完全启用或禁用该块。

4

2 回答 2

1

一种解决方案可能是:

编辑模板文件catalog/view/template/your_theme/product/category.tpl并将搜索输入和登录/注册链接直接添加到该模板(某处),同时使用 CSS 正确定位以满足您的需求。

然后编辑控制器文件并在此处复制登录/注册链接catalog/controller/product/category.php的代码片段。catalog/controller/common/header.php

当然catalog/view/template/your_theme/common/header.tpl,从这里编辑和删除搜索输入和登录/注册链接。

这应该够了……

另一种解决方案:

  • 复制catalog/view/template/your_theme/common/header.tplcatalog/view/template/your_theme/common/header_category.tpl
  • 复制catalog/controller/common/header.phpcatalog/controller/common/header_category.php
  • 编辑catalog/view/template/your_theme/common/header.tpl并删除搜索输入和注册/登录链接...
  • 编辑catalog/controller/product/category.php并找到片段代码,例如$this->data['children'] = array(...);->这里替换headerheader_category

从来没有这样做过,但它可能会工作......

于 2012-11-06T10:44:28.503 回答
0

最后我发现这篇文章正是我想要的……

http://craigmurray.me.uk/opencart-mods/how-to-highlight-the-current-category-in-the-header-in-opencart/

我做了

if (isset($this->request->get['path'])) {

<<DISPLAY SECTION>>

}

但不确定如果链接是 SEO 友好的,这是否可行。现在这正在工作。

于 2012-11-07T08:17:11.537 回答