Merge branch 'ticket-9895' into develop

This commit is contained in:
Marion Muszynski 2016-08-25 17:04:47 +02:00
commit bcd33c882e

View File

@ -1146,6 +1146,8 @@ class AdminProducts extends AdminTab
/* Adding new product images */
elseif (isset($_FILES['image_product']['name']) && is_array($_FILES['image_product']['name'])) {
$success = true;
// reorganise the array into an indexed array
$images_product = [];
for ($i=sizeof($_FILES['image_product']['error']); $i>0; $i--) {
@ -1171,6 +1173,7 @@ class AdminProducts extends AdminTab
$this->_errors[] = Tools::displayError('Cannot add image because product add failed.');
}
else {
$is_first_uploaded_image_cover = Tools::getValue('cover') == 1;
$cover_already_associated = false;
@ -1518,13 +1521,22 @@ class AdminProducts extends AdminTab
$preview_url .= 'adtoken='.$token.'&ad='.$admin_dir;
}
Tools::redirectAdmin($preview_url);
} elseif (Tools::isSubmit('submitAdd'.$this->table.'AndStay') OR ($id_image AND $id_image !== true)) // Save and stay on same form
}
// Save and stay on same form
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay'))
Tools::redirectAdmin($currentIndex.'&id_product='.$object->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&addproduct&conf=4&tabs='.(int)(Tools::getValue('tabs')).'&token='.($token ? $token : $this->token));
elseif (Tools::isSubmit('submitAdd'.$this->table.'AndStay')
OR ($id_image AND $id_image !== true))
{
// Save and stay on same form
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay'))
{
Tools::redirectAdmin($currentIndex.'&id_product='.$object->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&addproduct&conf=4&tabs='.(int)(Tools::getValue('tabs')).'&token='.($token ? $token : $this->token));
}
}
// Default behavior (save and back)
Tools::redirectAdmin($currentIndex.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&conf=4&token='.($token ? $token : $this->token).'&onredirigeici');
}
}
else