[*] BO : #PSFV-865 - it is now possible to use drag and drop positions in custom controllers using HelperList

This commit is contained in:
tDidierjean
2012-04-18 15:48:38 +00:00
parent 0a9aaee6b9
commit 45ea9fdaae
14 changed files with 340 additions and 432 deletions
@@ -649,6 +649,32 @@ class AdminCarriersControllerCore extends AdminController
if ($list['name'] == '0')
$this->_list[$key]['name'] = Configuration::get('PS_SHOP_NAME');
}
public function ajaxProcessUpdatePositions()
{
$way = (int)(Tools::getValue('way'));
$id_carrier = (int)(Tools::getValue('id'));
$positions = Tools::getValue($this->table);
foreach ($positions as $position => $value)
{
$pos = explode('_', $value);
if (isset($pos[2]) && (int)$pos[2] === $id_carrier)
{
if ($carrier = new Carrier((int)$pos[2]))
if (isset($position) && $carrier->updatePosition($way, $position))
echo 'ok position '.(int)$position.' for carrier '.(int)$pos[1].'\r\n';
else
echo '{"hasError" : true, "errors" : "Can not update carrier '.(int)$id_carrier.' to position '.(int)$position.' "}';
else
echo '{"hasError" : true, "errors" : "This carrier ('.(int)$id_carrier.') can t be loaded"}';
break;
}
}
}
}