prestshop在一次安装中创建两个模块


Prestashop create two modules in one installation

在我的模块中,我需要扩展pre - shop核心CarrierModulePaymentModule,因为它具有运输和支付部分。所以我计划单独创建两个不同的模块,并在一个文件夹中构建它们并安装一次。我需要知道我怎么能使安装脚本安装两个模块(一个接一个)。

这是一个模块的安装函数

public function install() {
        $flag = parent::install();
        if ($this->name !== 'urbitbasic')
            $flag = ($flag && $this->registerHook('displayRightColumnProduct'));
        return ($this->installer->installTables() &&
                $this->installer->installCarriers() &&
                $this->installer->installWarehouseCarriers() &&
                $this->installTabs() &&
                $this->registerHook('displayBackOfficeHeader') &&
                $this->registerHook('actionCarrierUpdate') &&
                $this->registerHook('actionObjectCarrierUpdateAfter') &&
                $this->registerHook('displayCarrierList') &&
                $this->registerHook('displayOrderConfirmation') &&
                $flag);
    }

基本上我需要创建一个模块,一个安装文件,安装两个模块。

您必须安装几乎一个模块,选择您要安装的模块,在该模块中您可以执行以下步骤:

public function install() {
    $flag = parent::install();
    if ($this->name !== 'urbitbasic')
        $flag = ($flag && $this->registerHook('displayRightColumnProduct'));
    $first_install = ($this->installer->installTables() &&
            $this->installer->installCarriers() &&
            $this->installer->installWarehouseCarriers() &&
            $this->installTabs() &&
            $this->registerHook('displayBackOfficeHeader') &&
            $this->registerHook('actionCarrierUpdate') &&
            $this->registerHook('actionObjectCarrierUpdateAfter') &&
            $this->registerHook('displayCarrierList') &&
            $this->registerHook('displayOrderConfirmation') &&
            $flag);
    // Now we install the second module
    $mysecondmodule = Module::getInstanceByName('{thenameofyoursecondmodule}');
    $second_install = $mysecondmodule->install();
    return $first_install AND $second_install;
}