Emmanuel Paris Posted June 20, 2010 Share Posted June 20, 2010 In the product page,I want to change the product image when the user CLICK on a thumbnail instead of MOUSEOVER.I see interesting things in product.tpl and mytheme/js/product.jsBut can't make it happen.Please help !:-) Link to comment Share on other sites More sharing options...
rocky Posted June 21, 2010 Share Posted June 21, 2010 It looks like it is the following code on lines 347-351 of product.js (in PrestaShop v1.3.1) that does the hover effect: //hover 'other views' images management $('#views_block li a').hover( function(){displayImage($(this));}, function(){} ); Change it to the following to make it a click event instead of a hover event: //hover 'other views' images management $('#views_block li a').click( function(){displayImage($(this));} ); The only problem is that you now have two click event. One that does the hover effect and one that displays the thickbox image. Both will happen at the same time now. To remove the thickbox popup, change line 118 (in PrestaShop v1.3.1) of product.tpl in your theme's directory from: <a href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox')}" rel="other-views" class="thickbox {if $smarty.foreach.thumbnails.first}shown{/if}" title="{$image.legend|htmlspecialchars}"> to: <a href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox')}" onclick="return false" title="{$image.legend|htmlspecialchars}"> 4 Link to comment Share on other sites More sharing options...
Emmanuel Paris Posted June 21, 2010 Author Share Posted June 21, 2010 This is brillant !Thanks so much, Rocky...It works. Link to comment Share on other sites More sharing options...
Emmanuel Paris Posted June 21, 2010 Author Share Posted June 21, 2010 The only problem is that now clicking on the big image always show the same cover default image of the product.Like if the script didn't knew anymore which thumbnail is currently displayed as the big image.Any idea Mr Rocky ? Link to comment Share on other sites More sharing options...
rocky Posted June 22, 2010 Share Posted June 22, 2010 I've had a closer look at this. It turns out that it's impossible to have the thickbox work for the big image for not for the thumbnail images. I've tried everything I can think of, but nothing worked. The only solution is to disable thickbox altogether. I've updated my code above. Link to comment Share on other sites More sharing options...
Emmanuel Paris Posted June 22, 2010 Author Share Posted June 22, 2010 I will have a more indepth look at this and will post solution here if I find it. Thanks. Link to comment Share on other sites More sharing options...
chows Posted October 15, 2010 Share Posted October 15, 2010 I will have a more indepth look at this and will post solution here if I find it. Thanks. any luck so far? i'm facing this issue as well. Link to comment Share on other sites More sharing options...
ImpulsoTecnologico Posted February 14, 2011 Share Posted February 14, 2011 Thanks rocky, it worked for me. You're always of great help. Link to comment Share on other sites More sharing options...
saurabhdrish Posted May 3, 2012 Share Posted May 3, 2012 thanks alot it also work for me... Link to comment Share on other sites More sharing options...
cmaaga Posted November 21, 2012 Share Posted November 21, 2012 @rocky Ok, so i try everything, too and I can't enable thickbox onclick bigpic. But maybe i can use something another: lightbox plugin? I need full size image gallery but i need change image onclik not mouse hover. Any idea? Link to comment Share on other sites More sharing options...
perusi Posted March 18, 2013 Share Posted March 18, 2013 Mr. Rocky any idea for keeping the mouseover but with a SetTimeOut of 2 seconds? I'm thinking that mouseover is kept and if a visitor keeps the mouse over a thumbnail for a period of 2 seconds then the bigimage is changed, otherwise nothing happens... i think this may be a solution because when there are a lot of thumbnails and they are displayed in a row, a visitor may accidently mouseover another thumbnail if he tries to go with the mouse on the big pic for the zoom efect.... what do you say? Link to comment Share on other sites More sharing options...
mtm Posted June 26, 2013 Share Posted June 26, 2013 You rock, rocky!!! Thanks! That's exactly what i was looking for. 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