Prestashop 1.6 获取模块类的实例 [英] Prestashop 1.6 get instance of module class
本文介绍了Prestashop 1.6 获取模块类的实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个重写的类 OrderConfirmationControllerCore
.
我有一个 Abra
类的模块.
I have a modul with class Abra
.
我需要在 OrderConfirmationControllerCore
我的代码是:
class OrderConfirmationController extends OrderConfirmationControllerCore
{
public function init()
{
$abraSetDocs = new Abra();
parent::init();
}
}
这会产生错误:
Fatal error: Class 'Abra' not found in /../override/controllers/front/OrderConfirmationController.php on line 39
如何获取类的实例?
推荐答案
$abraSetDocs = Module::getInstanceByName('abra');
注意'abra'是模块名($this->name from the module __construct()),不是类名.
Note that 'abra' is the name of the module ($this->name from the module __construct()), not the class name.
这篇关于Prestashop 1.6 获取模块类的实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文