diff --git a/controllers/admin/AdminImagesController.php b/controllers/admin/AdminImagesController.php
index 1df93bbbd..cf941e8f4 100644
--- a/controllers/admin/AdminImagesController.php
+++ b/controllers/admin/AdminImagesController.php
@@ -235,6 +235,14 @@ class AdminImagesController extends AdminController
public function postProcess()
{
+ // When moving images, if duplicate images were found they are moved to a folder named duplicates/
+ if (file_exists(_PS_PROD_IMG_DIR_.'duplicates/'))
+ {
+ $this->warnings[] = $this->l('Duplicate images were found when moving the product images. It is probably caused by unused demonstration images. Please make sure that the folder ').
+ _PS_PROD_IMG_DIR_.'duplicates/'.
+ $this->l(' only contains demonstration images then delete this folder.');
+ }
+
if (Tools::getValue('submitRegenerate'.$this->table))
{
if ($this->tabAccess['edit'] === '1')
@@ -273,6 +281,7 @@ class AdminImagesController extends AdminController
else
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
+
else
parent::postProcess();
}
@@ -284,9 +293,9 @@ class AdminImagesController extends AdminController
}
/**
- * Display form for thumbnails regeneration
+ * Init display for the thumbnails regeneration block
*/
- public function displayRegenerate()
+ public function initRegenerate()
{
$types = array(
'categories' => $this->l('Categories'),
@@ -296,55 +305,15 @@ class AdminImagesController extends AdminController
'products' => $this->l('Products'),
'stores' => $this->l('Stores')
);
- $this->content .= '
-
'.$this->l('Regenerate thumbnails').'
- '.$this->l('Regenerates thumbnails for all existing product images').'.
';
- $this->content .= '
'.$this->l('Please be patient, as this can take several minutes').'
'.$this->l('Be careful! Manually generated thumbnails will be erased by automatically generated thumbnails.').'
';
- $this->content .= '
- ';
+ $this->context->smarty->assign(array(
+ 'types' => $types,
+ 'formats' => $formats,
+ ));
}
/**
@@ -526,41 +495,14 @@ class AdminImagesController extends AdminController
}
/**
- * Display the block for moving images
+ * Init display for move images block
*/
- public function displayMoveImages()
+ public function initMoveImages()
{
- $safe_mode = ini_get('safe_mode');
-
- $this->content .= '
-
'.$this->l('Move images').'
'.
- $this->l('A new storage system for product images is now used by PrestaShop. It offers better performance if your shop has a very large number of products.').'
'.
- '
';
- if (file_exists(_PS_PROD_IMG_DIR_.'duplicates/'))
- {
- $this->content .= '';
- $this->displayWarning($this->l('Duplicate images were found when moving the product images. It is probably caused by unused demonstration images. Please make sure that the folder ').
- _PS_PROD_IMG_DIR_.'duplicates/'.
- $this->l(' only contains demonstration images then delete this folder.'));
- $this->content .= '
';
- }
- if($safe_mode)
- $this->displayWarning($this->l('PrestaShop has detected that your server configuration is not compatible with the new storage system (directive "safe_mode" is activated). You should continue to use the actual system.'));
- else
- $this->content .= '
- ';
+ $this->context->smarty->assign(array(
+ 'safe_mode' => ini_get('safe_mode'),
+ 'link_ppreferences' => 'index.php?tab=AdminPPreferences&token='.Tools::getAdminTokenLite('AdminPPreferences').'#PS_LEGACY_IMAGES_on',
+ ));
}
/**
@@ -592,15 +534,19 @@ class AdminImagesController extends AdminController
if ($this->display == 'list')
{
- $this->context->smarty->assign('list', true);
$helper = new HelperOptions();
$helper->id = $this->id;
$helper->currentIndex = self::$currentIndex;
$this->content .= $helper->generateOptions($this->form_list['options_image_pref']);
- $this->displayRegenerate();
- $this->displayMoveImages();
+ $this->initRegenerate();
+ $this->initMoveImages();
+
+ $this->context->smarty->assign(array(
+ 'display_regenerate' => true,
+ 'display_move' => true
+ ));
}
if ($this->display == 'edit')