使用prestashop模块中的现有类 [英] Use existing classes in prestashop module
本文介绍了使用prestashop模块中的现有类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为prestashop准备一个自定义模块.我想在其中使用prestashop中已经存在的一些类(Orderdetail.php).
I am preparing a custom module for prestashop. I want to use in it some classes that exist in prestashop already (Orderdetail.php).
我该怎么做?下面的代码是否足够?还是需要另外添加其他内容?
How can I do this? Is the code below sufficient or do I need to include something else in addition?
$order = new OrderDetail;
推荐答案
是的,可以这样调用本机类.
Yes, the native classes can be called like that.
$order_detail = new OrderDetail();
但是,要使用自定义类,您需要将其文件包含在要使用它们的脚本中.
However to use custom classes you need to include their files in the script you want to use them.
include_once 'path_to_custom_class_file';
class MyModule extends Module {
public function aMethod() {
$myClass = new MyClass();
}
}
这篇关于使用prestashop模块中的现有类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文