[-] BO : Fix #PSTEST-1220 : now position update for attribute value is good && fix JavaScript error in admin-dnd.js
This commit is contained in:
@@ -255,12 +255,16 @@ class AttributeCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function updatePosition($way, $position)
|
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`
|
SELECT a.`id_attribute`, a.`position`, a.`id_attribute_group`
|
||||||
FROM `'._DB_PREFIX_.'attribute` a
|
FROM `'._DB_PREFIX_.'attribute` a
|
||||||
WHERE a.`id_attribute_group` = '.(int)Tools::getValue('id_attribute_group', 1).'
|
WHERE a.`id_attribute_group` = '.(int)$id_attribute_group.'
|
||||||
ORDER BY a.`position` ASC'
|
ORDER BY a.`position` ASC';
|
||||||
))
|
|
||||||
|
if (!$res = Db::getInstance()->executeS($sql))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach ($res as $attribute)
|
foreach ($res as $attribute)
|
||||||
|
|||||||
@@ -573,14 +573,17 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
|||||||
if (!Combination::isFeatureActive())
|
if (!Combination::isFeatureActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If it's an attribute, load object Attribute()
|
if (!Tools::getValue($this->identifier) && Tools::getValue('id_attribute') && !Tools::getValue('attributeOrderby'))
|
||||||
if (Tools::getValue('updateattribute') || Tools::isSubmit('deleteattribute') || Tools::isSubmit('submitAddattribute'))
|
|
||||||
{
|
{
|
||||||
// Override var of Controller
|
// Override var of Controller
|
||||||
$this->table = 'attribute';
|
$this->table = 'attribute';
|
||||||
$this->className = 'Attribute';
|
$this->className = 'Attribute';
|
||||||
$this->identifier = 'id_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')
|
if ($this->tabAccess['edit'] !== '1')
|
||||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||||
else if (!$object = new Attribute((int)Tools::getValue($this->identifier)))
|
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));
|
$(this).attr('id', $(this).attr('id').replace(reg, '_' + i));
|
||||||
// Update link position
|
// Update link position
|
||||||
// Up links
|
// 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
|
// 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