// attributes position works fine

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10433 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
vChabot
2011-11-22 14:53:50 +00:00
parent 3fbdda4b45
commit 4b15da6656
8 changed files with 277 additions and 139 deletions
+8 -1
View File
@@ -286,7 +286,14 @@ class AttributeCore extends ObjectModel
if (!isset($moved_attribute) || !isset($position))
return false;
p('
UPDATE `'._DB_PREFIX_.'attribute`
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
WHERE `position`
'.($way
? '> '.(int)$moved_attribute['position'].' AND `position` <= '.(int)$position
: '< '.(int)$moved_attribute['position'].' AND `position` >= '.(int)$position).'
AND `id_attribute_group`='.(int)$moved_attribute['id_attribute_group']);
// < and > statements rather than BETWEEN operator
// since BETWEEN is treated differently according to databases
return (Db::getInstance()->execute('
+1 -1
View File
@@ -371,7 +371,7 @@ abstract class ObjectModelCore
$assos = GroupShop::getAssoTables();
if (isset($assos[$this->table]) && $assos[$this->table]['type'] == 'group_shop')
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.$this->table.'group_shop` WHERE `'.$this->identifier.'`='.(int)$this->id);
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.$this->table.'_group_shop` WHERE `'.$this->identifier.'`='.(int)$this->id);
/* Hook */
Hook::exec('actionObject'.get_class($this).'DeleteAfter');