// Fix blockcategories
This commit is contained in:
1 parent
537bfb0520
commit
dfa59fa8f7
2 files changed
+16
-6
No files matched your search
@@ -117,9 +117,12 @@ class BlockCategories extends Module
|
|||||||
|
|
||||||
public function hookDisplayBackOfficeCategory($params)
|
public function hookDisplayBackOfficeCategory($params)
|
||||||
{
|
{
|
||||||
|
for ($i=0;$i<3;$i++)
|
||||||
|
$images[$i] = ImageManager::thumbnail(_PS_CAT_IMG_DIR_.Tools::getValue('id_category').'-'.$i.'_thumb.jpg', $this->context->controller->table.'_'.(int)Tools::getValue('id_category').'-'.$i.'_thumb.jpg', 100, 'jpg', true);
|
||||||
|
|
||||||
$this->smarty->assign(array(
|
$this->smarty->assign(array(
|
||||||
'name' => 'thumb',
|
'name' => 'thumb',
|
||||||
'images' => array()
|
'images' => $images
|
||||||
));
|
));
|
||||||
|
|
||||||
return $this->display(__FILE__, 'views/blockcategories_admin.tpl');
|
return $this->display(__FILE__, 'views/blockcategories_admin.tpl');
|
||||||
@@ -152,7 +155,7 @@ class BlockCategories extends Module
|
|||||||
$errors[] = Tools::displayError('Due to memory limit restrictions, this image cannot be loaded. Please increase your memory_limit value via your server\'s configuration settings. ');
|
$errors[] = Tools::displayError('Due to memory limit restrictions, this image cannot be loaded. Please increase your memory_limit value via your server\'s configuration settings. ');
|
||||||
|
|
||||||
// Copy new image
|
// Copy new image
|
||||||
if (empty($errors) && !ImageManager::resize($tmp_name, _PS_CAT_IMG_DIR_.Tools::getValue('id_category').'-'.$i.'_thumb.jpg'))
|
if (empty($errors) && !ImageManager::resize($tmp_name, _PS_CAT_IMG_DIR_.(int)Tools::getValue('id_category').'-'.$i.'_thumb.jpg'))
|
||||||
$errors[] = Tools::displayError('An error occurred while uploading the image.');
|
$errors[] = Tools::displayError('An error occurred while uploading the image.');
|
||||||
|
|
||||||
if (count($errors))
|
if (count($errors))
|
||||||
@@ -161,8 +164,15 @@ class BlockCategories extends Module
|
|||||||
unlink($tmp_name);
|
unlink($tmp_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (($id_thumb = Tools::getValue('deleteThumb', false)) !== false)
|
||||||
|
{
|
||||||
|
if (file_exists(_PS_CAT_IMG_DIR_.(int)Tools::getValue('id_category').'-'.(int)$id_thumb.'_thumb.jpg')
|
||||||
|
&& !unlink(_PS_CAT_IMG_DIR_.(int)Tools::getValue('id_category').'-'.(int)$id_thumb.'_thumb.jpg'))
|
||||||
|
$this->context->controller->errors[] = Tools::displayError('Error while delet');
|
||||||
|
}
|
||||||
|
|
||||||
if (count($total_errors))
|
if (count($total_errors))
|
||||||
;//TODO : Show errors
|
$this->context->controller->errors = array_merge($this->context->controller->errors, $total_errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hookLeftColumn($params)
|
public function hookLeftColumn($params)
|
||||||
|
|||||||
@@ -12,10 +12,10 @@
|
|||||||
</div>
|
</div>
|
||||||
{if isset($images.$foo) && $images.$foo}
|
{if isset($images.$foo) && $images.$foo}
|
||||||
<div class="clearfix"> </div>
|
<div class="clearfix"> </div>
|
||||||
<div id="image" class="thumbnail">
|
<div id="image" class="img-thumbnail">
|
||||||
{$images.$foo.image}
|
{$images.$foo}
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<a class="btn btn-default" href="">
|
<a class="btn btn-default" href="{$current}&token={$token}&deleteThumb={$foo|intval}&id_category={$smarty.get.id_category|intval}">
|
||||||
<i class="icon-remove text-danger"></i> {l s='Delete'}
|
<i class="icon-remove text-danger"></i> {l s='Delete'}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user