简体   繁体   English

如何从主题覆盖PrestaShop 1.5.x中的控制器?

[英]How to override controller in PrestaShop 1.5.x from a theme?

I want to override modules\\blockwishlist\\controllers\\front\\mywishlist.php 我想覆盖modules \\ blockwishlist \\ controllers \\ front \\ mywishlist.php

and more specifically 更具体地说

{
    $this->display_column_left = false; (to be true)
    parent::initContent();

    $this->assign();
}

However i need to make it in a theme, so when users install the theme they don't need to place override file anywhere. 但是我需要在主题中进行设置,因此,当用户安装主题时,他们无需在任何位置放置替代文件。

You can't override module controller in PrestaShop 1.5 您不能在PrestaShop 1.5中覆盖模块控制器

Workaround: Clone the module with different name and do the necessary changes. 解决方法:使用其他名称克隆模块并进行必要的更改。 When you're ready with the theme export it via the "Import/export a theme" module and pick that module from the "Modules" block ("Select the modules that you wish to export"). 准备好主题导出后,可通过“导入/导出主题”模块将其导出,然后从“模块”块中选择该模块(“选择要导出的模块”)。 This way that module will be packaged along with the theme and will be installed when the theme is installed. 这样,模块将与主题打包在一起,并在安装主题时安装。

Note that that module is creating 4 tables during the installation and dropping them when unistalled. 请注意,该模块将在安装期间创建4个表,并在未安装时将其删除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM