123julien Posted July 6, 2010 Share Posted July 6, 2010 Hi everyone,I tried to find the solution on this forum but I couldn't find anything that would suit to my issue.I'm trying to display in the 'In the same category' module a different image than the default one.I have actually 4 images1. Default for the category page2 & 3. For the product page4. For the 'In the same category' module.So my objective is to find a piece of code that would help my display the image number 4 in this module and not the default (number 1) one. Here is how I integrate my image getProductLink($categoryProduct.id_product, $categoryProduct.link_rewrite, $categoryProduct.category)}" title="{$categoryProduct.name|htmlspecialchars}" style="background:url({$link->getImageLink($categoryProduct.link_rewrite, $categoryProduct.id_image, 'samecat')})"> link text Thanks a lot for your time and helpJEDIT: Weird, but the [ code ] part is not displaying properly. My link starts with a href of course Link to comment Share on other sites More sharing options...
123julien Posted July 6, 2010 Author Share Posted July 6, 2010 I haven't find any solution for this one yet.I tried to use smarty conditions but I couldn't succeed at all.Any help is very welcome.Thanks in advance,J. Link to comment Share on other sites More sharing options...
123julien Posted July 8, 2010 Author Share Posted July 8, 2010 May I up this one...Sorry but I really can't figure how to get this image.Cheers,J. Link to comment Share on other sites More sharing options...
razaro Posted July 8, 2010 Share Posted July 8, 2010 By default it is 'medium' size image in productcategory module code and you want to change it to 'samecat' ?And do you have samecat defined in Back Office >> Preferences >> Image and in img/p/ folder images with same in file-name ?Or maybe I didn't understand question ? Link to comment Share on other sites More sharing options...
123julien Posted July 9, 2010 Author Share Posted July 9, 2010 Hi razaro,Thanks for your answer. What I'm trying to to do is to display in the "samecategory" module the fourth image that I have uploaded for the products. (see the screenshoot i uploaded)I already changed to property in the img to make it display in the "samecat" size but I can't suceed in getting this image number 4 and not the number 1 (default one).I hope you'll understand what I mean...Thanks for your helpJ Link to comment Share on other sites More sharing options...
razaro Posted July 9, 2010 Share Posted July 9, 2010 Yes i was thinking that but wasn't sure :-)In attachment you have productscategory.php and productscategory.tpl.In php file I added array that contains pair imageID and 4th product image ex 1-37 and 40. (This could be done better i think) foreach ($categoryProducts as $key => $categoryProduct) { $image4[$categoryProduct['id_image']]=intval(substr($categoryProduct['id_image'],-2))+3; } Also added this line $smarty->assign('image4', $image4); In tpl few variables are added {assign var=key value=$categoryProduct.id_image} {assign var=i value=$image4.$key} {assign var=imageIds value=`$categoryProduct.id_product`-$i} and then call for image src <img src="{$link->getImageLink($categoryProduct.link_rewrite, $imageIds, 'medium')}" alt="{$categoryProduct.name|htmlspecialchars}" /> There is maybe a better way to do all this but this is working for me. image4.zip Link to comment Share on other sites More sharing options...
123julien Posted July 10, 2010 Author Share Posted July 10, 2010 Thanks very much razaro, it works perfectly. I just had to upload the images again because some of them were not named right after each other but after that it worked perfectly.Thanks for your help, your time and your excellent tips!JCase [sOLVED] ;-) 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