Prestashop 1.6 控制器覆盖 [英] Prestashop 1.6 Controller override

查看:65
本文介绍了Prestashop 1.6 控制器覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何覆盖 Prestashop 中的内容.我正在尝试覆盖类别控制器以显示自定义类别(具有不同数据的不同模板).

I know how to override things in Prestashop. I'm trying to override Category Controller to display custom categories (different template with different data).

我将 CategoryController 复制到/modules/mymodule/override/controllers/front 并且我在/modules/mymodule/controllers/front/display.php 有模块控制器,并且有 initContent 方法.

I copied CategoryController to /modules/mymodule/override/controllers/front and I have module controller at /modules/mymodule/controllers/front/display.php and there's initContent method.

如何在我的 display.php 控制器中使用修改后的 CategoryController?

How can I use modified CategoryController in my display.php controller?

推荐答案

您创建了两个不同的控制器:

You have created two different controllers:

  1. 覆盖类别控制器
  2. 模块控制器

在 2. 中使用 1. 是无意义的 - 这意味着您在语义上做错了.如果您想使用不同的模板显示自定义类别,您只需要覆盖 CategoryController,并设置正确的模板(如果您将使用两个不同的模板来显示类别).如果您只需要一个模板,只需覆盖控制器并更改主题模板即可.

Using 1. within 2. is nonesense - which means that you do something semantically wrong. If you want to to display custom categories with different template you need only to override the CategoryController, and set the proper template (if you will use two different templates for displaying categories). If you need only one template, just override the controller and change the theme template.

这篇关于Prestashop 1.6 控制器覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆