dannyTse Posted May 12, 2011 Share Posted May 12, 2011 Can I add more than one image for a category?how can I do this? Link to comment Share on other sites More sharing options...
shokinro Posted May 12, 2011 Share Posted May 12, 2011 By default, you can only have one image for each category in PrestaShop.But if you really have the need to do this, it is possible.You will need to change a little bit code change on theme file.How t make this possible1. Create your own additional image for each category2. FTP to the folder YourSiteRoot/img/c3. Rename your image to X-category-1.jpg, X-category-2.jpg,..... Where X is the ID of category4. Use your category image at any theme file like category.tpl Link to comment Share on other sites More sharing options...
dannyTse Posted May 12, 2011 Author Share Posted May 12, 2011 Thank you for your help, shokinro.It's helpful.However, what if I would like to upload the image file via the admin panel?Which php file & function shoud I edit? Link to comment Share on other sites More sharing options...
shokinro Posted May 12, 2011 Share Posted May 12, 2011 Quote Which php file & function shoud I edit? I think you need to modify following fileYouSiteRoot/YuurAdminFolder/tabs/AdminCategories.php Link to comment Share on other sites More sharing options...
BigZ Posted May 13, 2011 Share Posted May 13, 2011 easy man ! But this would be hard coded modification since prestashop published a buggy an incomplete version known as A.4 wich does not include ovveride nor tpl for the admin. So this will not be true in some close future, and we'll have to recode that. ( sometimes i'm extremly pissed with prestashop policy in terms of new versions : we've been in the same school guys, didn't you learnd anything ? ) So, back to the point ! Modify AdminCategories.php replace $this->fieldImageSettings = array('name' => 'image', 'dir' => 'c'); with $this->fieldImageSettings = array(); $this->fieldImageSettings[] = array('name' => 'image', 'dir' => 'c'); $this->fieldImageSettings[] = array('name' => 'image2', 'dir' => 'c2'); find '.$this->l('Image:').' '; echo $this->displayImage($obj->id, _PS_IMG_DIR_.'c/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminCatalog'.intval(Tab::getIdFromClassName('AdminCatalog')).intval($cookie->id_employee))); echo ' <input type="file" name="image" /> '.$this->l('Upload category logo from your computer').' add below '.$this->l('Image:').' '; echo $this->displayImage($obj->id, _PS_IMG_DIR_.'c2/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminCatalog'.intval(Tab::getIdFromClassName('AdminCatalog')).intval($cookie->id_employee))); echo ' <input type="file" name="image2" /> '.$this->l('Upload second category logo from your computer').' tricky point you'll have to find out by yourself, the second image will not be deleted when deleting the category don't forget to create c2 directory in img/ and let us know if you have issues with that 1 Link to comment Share on other sites More sharing options...
shokinro Posted May 13, 2011 Share Posted May 13, 2011 Thanks BigZ for follow up. It is great solution, yes use different folder might be easy to implement the one I suggested use different file name. So when you use the image to display, don't forget the to use folder c2. Link to comment Share on other sites More sharing options...
Cvalya Posted July 31, 2012 Share Posted July 31, 2012 Hi guys! This topik help me with my problem to add second image to category. I try solve from post #5, but i still need help with this. After modification: - if upload only second image - all fine, but after uplading first image on catogory edit page in first and second image block show only first image. Not cool to future administation. - Deleting images - delete only first image. And if i puch to delete second image - delete first image. May be you have some tips for this... Thx! Link to comment Share on other sites More sharing options...
anuradha Posted October 18, 2012 Share Posted October 18, 2012 Hi, I also need the same pls its really really argent, Pls help, how Can I add more than one image for a category? Link to comment Share on other sites More sharing options...
arlo Posted April 11, 2013 Share Posted April 11, 2013 Any some have solution for that? Link to comment Share on other sites More sharing options...
codeurWeb Posted August 7, 2013 Share Posted August 7, 2013 There is another solution without touching the code is to use scenes to add an image without elements and associate to the category. Link to comment Share on other sites More sharing options...
kevinquang91 Posted March 15, 2014 Share Posted March 15, 2014 On 5/13/2011 at 9:24 AM, BigZ said: easy man ! But this would be hard coded modification since prestashop published a buggy an incomplete version known as A.4 wich does not include ovveride nor tpl for the admin. So this will not be true in some close future, and we'll have to recode that. ( sometimes i'm extremly pissed with prestashop policy in terms of new versions : we've been in the same school guys, didn't you learnd anything ? ) So, back to the point ! Modify AdminCategories.php replace $this->fieldImageSettings = array('name' => 'image', 'dir' => 'c');with $this->fieldImageSettings = array(); $this->fieldImageSettings[] = array('name' => 'image', 'dir' => 'c'); $this->fieldImageSettings[] = array('name' => 'image2', 'dir' => 'c2');find '.$this->l('Image:').' '; echo $this->displayImage($obj->id, _PS_IMG_DIR_.'c/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminCatalog'.intval(Tab::getIdFromClassName('AdminCatalog')).intval($cookie->id_employee))); echo ' <input type="file" name="image" /> '.$this->l('Upload category logo from your computer').' add below '.$this->l('Image:').' '; echo $this->displayImage($obj->id, _PS_IMG_DIR_.'c2/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminCatalog'.intval(Tab::getIdFromClassName('AdminCatalog')).intval($cookie->id_employee))); echo ' <input type="file" name="image2" /> '.$this->l('Upload second category logo from your computer').' tricky point you'll have to find out by yourself, the second image will not be deleted when deleting the category don't forget to create c2 directory in img/ and let us know if you have issues with that Can i help you?. I need make module. Link to comment Share on other sites More sharing options...
Peter Zarian Posted March 15, 2014 Share Posted March 15, 2014 "AdminCategories.php" is not exist in my "YouSiteRoot/YuurAdminFolder/tabs/AdminCategories.php". How to solve/add it? Link to comment Share on other sites More sharing options...
vekia Posted March 15, 2014 Share Posted March 15, 2014 On 3/15/2014 at 10:25 AM, Peter Zarian said: "AdminCategories.php" is not exist in my "YouSiteRoot/YuurAdminFolder/tabs/AdminCategories.php". How to solve/add it? guide above is related to old prestashop, you probably use 1.5.x release this is why this file doesnt exist. Link to comment Share on other sites More sharing options...
ivan.redegal Posted September 24, 2014 Share Posted September 24, 2014 Hi all! In my case I have prestashop 1.5.3.1, and I have the same problem "AdminCategories.php" is not exist in my "YouSiteRoot/YuurAdminFolder/tabs/AdminCategories.php" Then, what is the post that I need to follow to solve this. Link to comment Share on other sites More sharing options...
vekia Posted September 24, 2014 Share Posted September 24, 2014 1.5.3 use differend catalog structure. check controllers/admin/ directory. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now