在自定义模块prestashop

时间:2016-11-03 14:17:15

标签: module include prestashop

我正在尝试在自定义模块中加载产品类,以便运行以下命令:

 $customized_datas = Product::getAllCustomizedDatas((int)$order->id_cart);

我的模块结构如下:

class autoWebspace extends Module {
    public function __construct() {
    $this->name = 'autowebspace';
    $this->tab = 'front_office_features';
    $this->version = '1.0';
    $this->author = 'dimitris';
    $this->need_instance = 0;
    parent::__construct();
    $this->displayName = $this->l('webspace creation in plesk');
    $this->description = $this->l('Creates webspace in plesk after purchase');
}


public function install() {
    return (parent::install() && $this->registerHook('actionValidateOrder') && $this->registerHook('displayHeader'));
}




public function hookActionValidateOrder($params) {
$customized_datas = Product::getAllCustomizedDatas((int)$order->id_cart);
}

我该怎么做?

1 个答案:

答案 0 :(得分:0)

就像那样:

public function hookActionValidateOrder($params) {
    $customized_datas = Product::getAllCustomizedDatas((int)$params['order']->id_cart);
}

或者您可以改为使用$params['cart']->id