Prestashop 1.6 Override admin Controller 未覆盖 [英] Prestashop 1.6 Override admin Controller not overriding

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

问题描述

我正在尝试覆盖 AdminCarriersControllerCore,特别是 postProcess 方法(以便它更新载体而不是删除并创建一个新载体,因为它破坏了引用).

I'm trying to override the AdminCarriersControllerCore, specifically the postProcess method (so that it updates the carrier instead of deleting and creating a new one, because it breaks reference).

要先检查它是否被覆盖,我会这样做:

To check that it get's overriden first i do:

<?php
class AdminCarriersController extends AdminCarriersControllerCore
{
    public function __construct(){
        die(var_dump('constructor'));
    }
}

我把它放在下面的路径

modules/<my_module_name>/override/controllers/admin/AdminCarriersController.php

它不会覆盖.

也试过:

modules/<my_module_name>/controllers/admin/AdminCarriersController.php

还删除了缓存文件(没有像文档所说的那样自动重新生成)

Also deleted the cache file (which didn't get regenerated automatically as the docs say)

rm class_index.php 

感谢您的帮助.用于覆盖的官方 Prestashop 文档页面

注意:是的,我知道有一个 reference_id 或其他什么,我不应该直接使用carrier_id,但是该模块已经太神秘了,并且尝试将carrier_id更改为正确的一个风险太大并且太费时间了.

Note: Yes, I'm aware that there is a reference_id or whatever and that I shouldn't use the carrier_id directly, but the module is already too cryptic and trying to change the carrier_id to the correct one is too risky and too much time-consuming.

推荐答案

在你的 module_name/override 中放置覆盖文件还没有做任何事情.安装模块时,PrestaShop 将检查您的模块中是否有覆盖文件,并检查您的覆盖类是否具有已被另一个模块覆盖的方法.如果是这样,那么您将无法安装该模块.

Placing override files in your module_name/overridedoes not do anything yet. When installing a module, PrestaShop will check if you have override files in your module and do a check if your overriden class has methods already overriden by another module. If it does, then you won't be able to install the module.

如果您已经安装了模块并且由于某种原因无法重新安装它,那么您需要将覆盖文件直接放入根override文件夹并删除文件 cache/class_index.php.

If you have module already installed and you can't reinstall it for some reason then you need to place override file directly into root override folder and delete file cache/class_index.php.

我不确定是否通过模块升级安装了覆盖文件.我稍后会检查并更新答案.

I'm not sure if override files get installed with a module upgrade. I'll check it later and update the answer.

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

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