feat(main): Add slider block type
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_16_0($module)
|
||||
{
|
||||
$columnsToAdd = [
|
||||
'slides_per_view_mobile' => 'DECIMAL(4,2) NOT NULL DEFAULT 1',
|
||||
'slides_per_view_tablet' => 'DECIMAL(4,2) NOT NULL DEFAULT 2',
|
||||
'slides_per_view_desktop' => 'DECIMAL(4,2) NOT NULL DEFAULT 3',
|
||||
'autoplay_delay' => 'INT(11) NOT NULL DEFAULT 0',
|
||||
];
|
||||
|
||||
foreach ($columnsToAdd as $column => $definition) {
|
||||
$existing = Db::getInstance()->executeS(
|
||||
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'' . $column . '\''
|
||||
);
|
||||
|
||||
if (!empty($existing)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Db::getInstance()->execute(
|
||||
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml` ADD COLUMN `' . $column . '` ' . $definition
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return Db::getInstance()->execute(
|
||||
'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'ws_customhtml_slide` (
|
||||
`id_ws_customhtml_slide` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
`id_ws_customhtml` INT(11) NOT NULL,
|
||||
`title` VARCHAR(256) NOT NULL DEFAULT \'\',
|
||||
`description` TEXT,
|
||||
`extra_description` TEXT,
|
||||
`link` VARCHAR(512) NOT NULL DEFAULT \'\',
|
||||
`link_text` VARCHAR(128) NOT NULL DEFAULT \'\',
|
||||
`image` VARCHAR(255) NOT NULL DEFAULT \'\',
|
||||
`ordering` INT(11) NOT NULL DEFAULT 0,
|
||||
`date_add` DATETIME NOT NULL,
|
||||
`date_upd` DATETIME NOT NULL,
|
||||
KEY `id_ws_customhtml` (`id_ws_customhtml`)
|
||||
)'
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user