Fix currentIndex

This commit is contained in:
Michael RICOIS 2017-09-15 16:19:44 +02:00
parent e8fbfd92af
commit bfae895cf1

View File

@ -102,6 +102,8 @@ class AdminCategories extends AdminTab
protected function displayListTree()
{
global $currentIndex;
if ($this->_category->id_category == 1) {
echo "";
}
@ -589,6 +591,20 @@ class AdminCategories extends AdminTab
echo $this->displayError($this->l('An error occured during the image upload.'));
}
}
if($id_lang == 3
&& (!isset($_FILES['image_mobile_'.$id_lang]) || $_FILES['image_mobile_'.$id_lang]['name'] == '')
&& (isset($_FILES['image_mobile_2']) && $_FILES['image_mobile_2']['name'] != '')
){
if(!copy($_FILES['image_mobile_2']['tmp_name'], _PS_CAT_IMG_DIR_.$id_category.'_mobile_vp_'.$id_lang.'.jpg')) {
echo $this->displayError($this->l('An error occured during the image upload.'));
}
}
elseif(isset($_FILES['image_mobile_'.$id_lang]) && $_FILES['image_mobile_'.$id_lang]['name'] != '') {
if(!copy($_FILES['image_mobile_'.$id_lang]['tmp_name'], _PS_CAT_IMG_DIR_.$id_category.'_mobile_vp_'.$id_lang.'.jpg')) {
echo $this->displayError($this->l('An error occured during the image upload.'));
}
}
}
}
// @End Antadis
@ -610,6 +626,13 @@ class AdminCategories extends AdminTab
unlink(_PS_ROOT_DIR_.'/img/c/'.$object->id.'_thumb_vp_'.(int)$id_lang.'.jpg');
}
}
public function deleteImageMobile($object, $id_lang)
{
if(file_exists(_PS_ROOT_DIR_.'/img/c/'.$object->id.'_mobile_vp_'.(int)$id_lang.'.jpg')) {
unlink(_PS_ROOT_DIR_.'/img/c/'.$object->id.'_mobile_vp_'.(int)$id_lang.'.jpg');
}
}
// @End Antadis
public function displayForm($token = NULL)
@ -729,6 +752,26 @@ class AdminCategories extends AdminTab
echo '<p class="clear"></p>
</div>';
// @Override Antadis
echo '<label>'.$this->l('Image app mobile:').'</label>
<div class="margin-form translatable">';
foreach($this->_languages as $language) {
echo '
<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">';
if(file_exists(_PS_ROOT_DIR_.'/img/c/'.$obj->id.'_mobile_vp_'.$language['id_lang'].'.jpg')) {
echo '<div id="image">
<img src="'.__PS_BASE_URI__.'img/c/'.$obj->id.'_mobile_vp_'.$language['id_lang'].'.jpg" alt="" class="imgm">
<p></p>
<a href="'.$currentIndex.'&id_category='.$obj->id.'&token='.Tools::getAdminTokenLite('AdminCatalog').'&deleteImageMobile=1&id_lang='.$language['id_lang'].'">
<img src="../img/admin/delete.gif" alt="Supprimer"> Supprimer</a>
</div>';
}
echo '<input id="image_thumb_'.$language['id_lang'].'" type="file" name="image_mobile_'.$language['id_lang'].'" />
</div>';
}
echo '<p class="clear"></p>
</div>';
// echo ' <label>'.$this->l('Image logo:').' </label>
// <div class="margin-form">';
// if(file_exists(_PS_ROOT_DIR_.'/img/c/'.$obj->id.'_thumb_vp.jpg')) {