Citation de code source en PHPn° 295
30 June 2016 à 01:30
$result = (Db::getInstance()->Execute('
UPDATE `'._DB_PREFIX_.'category`
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
WHERE `position`
'.($way
? '> '.(int)($movedCategory['position']).' AND `position` <= '.(int)($position)
: '< '.(int)($movedCategory['position']).' AND `position` >= '.(int)($position)).'
AND `id_parent`='.(int)($movedCategory['id_parent']))
AND Db::getInstance()->Execute('
UPDATE `'._DB_PREFIX_.'category`
SET `position` = '.(int)($position).'
WHERE `id_parent` = '.(int)($movedCategory['id_parent']).'
AND `id_category`='.(int)($movedCategory['id_category'])));