[-] BO : fix bug #PSTEST-913 - drag and drop position change for tabs broken in AdminTabsController
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13757 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -912,3 +912,28 @@ if (Tools::isSubmit('getZones'))
|
||||
die(Tools::jsonEncode($html));
|
||||
}
|
||||
|
||||
/* Modify carrier position */
|
||||
if (Tools::isSubmit('ajaxTabsPositions'))
|
||||
{
|
||||
$way = (int)(Tools::getValue('way'));
|
||||
$id_tab = (int)(Tools::getValue('id_tab'));
|
||||
$positions = Tools::getValue('tab');
|
||||
|
||||
foreach ($positions as $position => $value)
|
||||
{
|
||||
$pos = explode('_', $value);
|
||||
|
||||
if (isset($pos[2]) && (int)$pos[2] === $id_tab)
|
||||
{
|
||||
if ($tab = new Tab((int)$pos[2]))
|
||||
if (isset($position) && $tab->updatePosition($way, $position))
|
||||
echo "ok position ".(int)$position." for tab ".(int)$pos[1]."\r\n";
|
||||
else
|
||||
echo '{"hasError" : true, "errors" : "Can not update tab '. (int)$id_tab . ' to position '.(int)$position.' "}';
|
||||
else
|
||||
echo '{"hasError" : true, "errors" : "This tab ('.(int)$id_tab.') can t be loaded"}';
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,6 +152,15 @@ function initTableDnD(table)
|
||||
}
|
||||
}
|
||||
|
||||
if (table.id == 'tab') {
|
||||
params = {
|
||||
ajaxTabsPositions: true,
|
||||
id_tab : ids[2],
|
||||
way: way,
|
||||
token: token
|
||||
}
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
async: false,
|
||||
|
||||
Reference in New Issue
Block a user