[*] BO : product images can now be dragged and dropped to change position (CC021)

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8542 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2011-09-13 15:22:29 +00:00
parent e4a09c5222
commit feabf30c20
6 changed files with 92 additions and 14 deletions
+29
View File
@@ -335,6 +335,35 @@ if (array_key_exists('ajaxProductsPositions', $_POST))
}
}
if (array_key_exists('ajaxProductImagesPositions', $_POST))
{
$id_image = (int)(Tools::getValue('id_image'));
$way = (int)(Tools::getValue('way'));
$positions = Tools::getValue('imageTable');
if (is_array($positions))
foreach ($positions AS $key => $value)
{
$pos = explode('_', $value);
if ((isset($pos[1])) AND ($pos[1] == $id_image))
{
$position = $key;
break;
}
}
$image = new Image($id_image);
if (Validate::isLoadedObject($image))
{
if (isset($position) && $image->updatePosition($way, $position))
die(true);
else
die('{"hasError" : true, "errors" : "Cannot update image position"}');
}
else
die('{"hasError" : true, "errors" : "This image cannot be loaded"}');
}
if (isset($_GET['ajaxProductPackItems']))
{
$jsonArray = array();