Merge branch 'ticket-13754-fixSalePosition' into develop
This commit is contained in:
commit
8ebad0868b
@ -269,6 +269,8 @@ class Sale {
|
||||
');
|
||||
}
|
||||
|
||||
self::sortActiveSaleAfterAdd();
|
||||
|
||||
Module::hookExec('privatesales_create', array('sale' => $this));
|
||||
}
|
||||
}
|
||||
@ -297,6 +299,21 @@ class Sale {
|
||||
}
|
||||
}
|
||||
|
||||
public static function sortActiveSaleAfterAdd(){
|
||||
foreach(Db::getInstance()->executeS('
|
||||
SELECT id_sale, position
|
||||
FROM '._DB_PREFIX_.'privatesale
|
||||
WHERE lock_position = 1
|
||||
AND `date_end` > NOW()
|
||||
ORDER BY position DESC
|
||||
') as $sale){
|
||||
$pos = $sale['position']+1;
|
||||
|
||||
Db::getInstance()->ExecuteS( 'UPDATE '._DB_PREFIX_.'privatesale SET position = position-1 WHERE position = '. $pos);
|
||||
Db::getInstance()->ExecuteS( 'UPDATE '._DB_PREFIX_.'privatesale SET position = position+1 WHERE id_sale = '. $sale['id_sale']);
|
||||
}
|
||||
}
|
||||
|
||||
public static function rrmdir($dir) {
|
||||
if(is_dir($dir)) {
|
||||
$objects = scandir($dir);
|
||||
|
Loading…
Reference in New Issue
Block a user