diff --git a/admin-dev/ajax.php b/admin-dev/ajax.php index 2663ad2d9..e170072d3 100644 --- a/admin-dev/ajax.php +++ b/admin-dev/ajax.php @@ -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; + } + } +} diff --git a/js/admin-dnd.js b/js/admin-dnd.js index d05e9bf65..f47b2d503 100644 --- a/js/admin-dnd.js +++ b/js/admin-dnd.js @@ -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,