[-] BO : Fix #PSTEST-1220 : now position update for attribute value is good && fix JavaScript error in admin-dnd.js
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14843 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -255,12 +255,16 @@ class AttributeCore extends ObjectModel
|
||||
*/
|
||||
public function updatePosition($way, $position)
|
||||
{
|
||||
if (!$res = Db::getInstance()->executeS('
|
||||
if (!$id_attribute_group = (int)Tools::getValue('id_attribute_group'))
|
||||
$id_attribute_group = (int)$this->id_attribute_group;
|
||||
|
||||
$sql = '
|
||||
SELECT a.`id_attribute`, a.`position`, a.`id_attribute_group`
|
||||
FROM `'._DB_PREFIX_.'attribute` a
|
||||
WHERE a.`id_attribute_group` = '.(int)Tools::getValue('id_attribute_group', 1).'
|
||||
ORDER BY a.`position` ASC'
|
||||
))
|
||||
WHERE a.`id_attribute_group` = '.(int)$id_attribute_group.'
|
||||
ORDER BY a.`position` ASC';
|
||||
|
||||
if (!$res = Db::getInstance()->executeS($sql))
|
||||
return false;
|
||||
|
||||
foreach ($res as $attribute)
|
||||
|
||||
@@ -573,14 +573,17 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
||||
if (!Combination::isFeatureActive())
|
||||
return;
|
||||
|
||||
// If it's an attribute, load object Attribute()
|
||||
if (Tools::getValue('updateattribute') || Tools::isSubmit('deleteattribute') || Tools::isSubmit('submitAddattribute'))
|
||||
if (!Tools::getValue($this->identifier) && Tools::getValue('id_attribute') && !Tools::getValue('attributeOrderby'))
|
||||
{
|
||||
// Override var of Controller
|
||||
$this->table = 'attribute';
|
||||
$this->className = 'Attribute';
|
||||
$this->identifier = 'id_attribute';
|
||||
}
|
||||
|
||||
// If it's an attribute, load object Attribute()
|
||||
if (Tools::getValue('updateattribute') || Tools::isSubmit('deleteattribute') || Tools::isSubmit('submitAddattribute'))
|
||||
{
|
||||
if ($this->tabAccess['edit'] !== '1')
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
else if (!$object = new Attribute((int)Tools::getValue($this->identifier)))
|
||||
|
||||
+2
-2
@@ -148,9 +148,9 @@ function initTableDnD(table)
|
||||
$(this).attr('id', $(this).attr('id').replace(reg, '_' + i));
|
||||
// Update link position
|
||||
// Up links
|
||||
$(this).children('td.dragHandle a:odd').attr('href', $(this).children('td.dragHandle a:odd').attr('href').replace(up_reg, 'position='+ (i - 1) +'&'));
|
||||
$(this).find('td.dragHandle a:odd').attr('href', $(this).find('td.dragHandle a:odd').attr('href').replace(up_reg, 'position='+ (i - 1) +'&'));
|
||||
// Down links
|
||||
$(this).children('td.dragHandle a:even').attr('href', $(this).children('td.dragHandle a:even').attr('href').replace(up_reg, 'position='+ (i + 1) +'&'));
|
||||
$(this).find('td.dragHandle a:even').attr('href', $(this).find('td.dragHandle a:even').attr('href').replace(up_reg, 'position='+ (i + 1) +'&'));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user