Files
wyczarujprezent.pl/modules/inpostizi/upgrade/upgrade-1.11.0.php
Jacek Pyziak 4066f6fa31 Add InPost Pay integration to admin templates
- Created a new template for the cart rule form with custom label, switch, and choice widgets.
- Implemented the InPost Pay block in the order details template for displaying delivery method, APM, and VAT invoice request.
- Added legacy support for the order details template to maintain compatibility with older PrestaShop versions.
2025-09-14 14:38:09 +02:00

66 lines
1.6 KiB
PHP

<?php
use InPost\Izi\Upgrade\CacheClearer;
use izi\prestashop\Configuration\Adapter\Configuration;
use izi\prestashop\Database\Connection;
use izi\prestashop\Hook\Admin\ActionAdminCartRuleSaveAfter;
use izi\prestashop\Hook\Admin\ActionAdminControllerSetMedia;
use izi\prestashop\Hook\Admin\DisplayBackOfficeHeader;
use izi\prestashop\Installer\Database\Version_1_11_0;
use izi\prestashop\Installer\DatabaseInstaller;
if (!defined('_PS_VERSION_')) {
exit;
}
require_once __DIR__ . '/CacheClearer.php';
class InPostIziUpdater_1_11_0
{
/**
* @var Module
*/
private $module;
/**
* @var DatabaseInstaller
*/
private $installer;
public function __construct(Module $module, DatabaseInstaller $installer)
{
$this->module = $module;
$this->installer = $installer;
}
public function upgrade(): bool
{
CacheClearer::getInstance()->clear();
$this->installer->install($this->module);
return $this->registerHooks();
}
private function registerHooks(): bool
{
return $this->module->registerHook([
ActionAdminCartRuleSaveAfter::HOOK_NAME,
ActionAdminControllerSetMedia::HOOK_NAME,
DisplayBackOfficeHeader::HOOK_NAME,
]);
}
}
/**
* @param InPostIzi $module
*/
function upgrade_module_1_11_0(Module $module): bool
{
$db = Db::getInstance();
$dbInstaller = new DatabaseInstaller(new Configuration($db), [
new Version_1_11_0(new Connection($db)),
]);
return (new InPostIziUpdater_1_11_0($module, $dbInstaller))->upgrade();
}