feat(main): Make groups reorderable
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_11_0($module)
|
||||
{
|
||||
$groups = Db::getInstance()->executeS(
|
||||
'SELECT `id_ws_customhtml_group` FROM `' . _DB_PREFIX_ . 'ws_customhtml_group` ORDER BY `id_ws_customhtml_group` ASC'
|
||||
);
|
||||
|
||||
foreach ($groups as $index => $group) {
|
||||
if (!Db::getInstance()->update(
|
||||
'ws_customhtml_group',
|
||||
['ordering' => (int) $index],
|
||||
'`id_ws_customhtml_group` = ' . (int) $group['id_ws_customhtml_group']
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user