// fix adminproducts images
This commit is contained in:
@@ -53,7 +53,7 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
|
|
||||||
protected $tabs_toolbar_save_buttons = array(
|
protected $tabs_toolbar_save_buttons = array(
|
||||||
'Informations' => true,
|
'Informations' => true,
|
||||||
'Images' => true,
|
'Images' => false,
|
||||||
'Prices' => false,
|
'Prices' => false,
|
||||||
'Combinations' => false,
|
'Combinations' => false,
|
||||||
'Features' => true,
|
'Features' => true,
|
||||||
@@ -987,38 +987,53 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
|
|
||||||
public function ajaxProcessUpdateProductImageShopAsso()
|
public function ajaxProcessUpdateProductImageShopAsso()
|
||||||
{
|
{
|
||||||
|
$this->json = true;
|
||||||
if (($id_image = $_GET['id_image']) && ($id_shop = (int)$_GET['id_shop']))
|
if (($id_image = $_GET['id_image']) && ($id_shop = (int)$_GET['id_shop']))
|
||||||
if (Tools::getValue('active') == "true")
|
if (Tools::getValue('active') == "true")
|
||||||
die(Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'image_shop (`id_image`, `id_shop`) VALUES('.(int)$id_image.', '.(int)$id_shop.')'));
|
$res = Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'image_shop (`id_image`, `id_shop`) VALUES('.(int)$id_image.', '.(int)$id_shop.')');
|
||||||
else
|
else
|
||||||
die(Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'image_shop WHERE `id_image`='.(int)$id_image.' && `id_shop`='.(int)$id_shop));
|
$res= Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'image_shop WHERE `id_image`='.(int)$id_image.' && `id_shop`='.(int)$id_shop);
|
||||||
|
|
||||||
|
if ($res)
|
||||||
|
$this->confirmations[] = $this->_conf[27];
|
||||||
|
else
|
||||||
|
$this->_errors[] = Tools::displayError('Error on picture shop association');
|
||||||
|
$this->status = 'ok';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ajaxProcessUpdateImagePosition()
|
public function ajaxProcessUpdateImagePosition()
|
||||||
{
|
{
|
||||||
|
$this->json = true;
|
||||||
|
$res = false;
|
||||||
if ($json = Tools::getValue('json'))
|
if ($json = Tools::getValue('json'))
|
||||||
{
|
{
|
||||||
|
$res = true;
|
||||||
$json = stripslashes($json);
|
$json = stripslashes($json);
|
||||||
$images = Tools::jsonDecode($json, true);
|
$images = Tools::jsonDecode($json, true);
|
||||||
foreach ($images as $id => $position)
|
foreach ($images as $id => $position)
|
||||||
{
|
{
|
||||||
$img = new Image((int)$id);
|
$img = new Image((int)$id);
|
||||||
$img->position = (int)$position;
|
$img->position = (int)$position;
|
||||||
$img->update();
|
$res &= $img->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit();
|
if ($res)
|
||||||
|
$this->confirmations[] = $this->_conf[25];
|
||||||
|
else
|
||||||
|
$this->_errors[] = Tools::displayError('Error on moving picture');
|
||||||
|
$this->status = 'ok';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ajaxProcessUpdateCover()
|
public function ajaxProcessUpdateCover()
|
||||||
{
|
{
|
||||||
if ($this->action == 'UpdateCover')
|
$this->json = true;
|
||||||
{
|
Image::deleteCover((int)$_GET['id_product']);
|
||||||
Image::deleteCover((int)$_GET['id_product']);
|
$img = new Image((int)$_GET['id_image']);
|
||||||
$img = new Image((int)$_GET['id_image']);
|
$img->cover = 1;
|
||||||
$img->cover = 1;
|
if ($img->update())
|
||||||
$img->update();
|
$this->confirmations[] = $this->_conf[26];
|
||||||
}
|
else
|
||||||
|
$this->_errors[] = Tools::displayError('Error on moving picture');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ajaxProcessDeleteProductImage()
|
public function ajaxProcessDeleteProductImage()
|
||||||
|
|||||||
Reference in New Issue
Block a user