Prestashop 中的自动加载模块类 [英] Autoload module class in Prestashop

查看:63
本文介绍了Prestashop 中的自动加载模块类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个模块,该模块覆盖了 FrontControllerCore 类以添加额外的 Smarty 变量.

I've created a module that has an override for the FrontControllerCore class to add additional Smarty variables.

我遇到的问题是尝试自动加载在我的模块中的控制器中引用的类.类没有被加载,我不知道如何将它添加到自动加载器.

The issue I'm running into is trying to autoload a class that is referenced in the controller that is in my module. The class isn't being loaded and I don't know how to add it to the autoloader.

推荐答案

安装模块时,FrontController.php 文件应位于:覆盖\类\控制器\

When you install the module the FrontController.php file should be located in: override\classes\controller\

因此,您可以从 FrontController.php 手动包含"该文件,例如:

so from the FrontController.php you can "include" manually that file like:

require_once(dirname(__FILE__).'/../../../modules/servicecharges/classes/ServiceCharge.php');

此类包含不会自动加载.

There's no autoload for such includes.

这篇关于Prestashop 中的自动加载模块类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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