LeeFoster Posted June 6, 2020 Author Share Posted June 6, 2020 3 minutes ago, hungryfrank said: all the way at the end of product_info.php for now after closing bracket ?> Yeah that works, only issue is the image goes out of the constraints of the gallery. Quote Link to comment Share on other sites More sharing options...
PiLLaO Posted June 6, 2020 Share Posted June 6, 2020 Select the container to jquery an put the image inside Quote Link to comment Share on other sites More sharing options...
hungryfrank Posted June 6, 2020 Share Posted June 6, 2020 13 minutes ago, PiLLaO said: Select the container to jquery an put the image inside I don't see a container 16 minutes ago, LeeFoster said: Yeah that works, only issue is the image goes out of the constraints of the gallery. I think it has to do with the size of the image. the product lime is in the same way to me Quote you can cut up to 4 pages of your checkout by using my three add_ons login create account in one page Express checkout login pop up modal Link to comment Share on other sites More sharing options...
PiLLaO Posted June 6, 2020 Share Posted June 6, 2020 6 minutes ago, hungryfrank said: I don't see a container $('.pi-gallery') must to work Quote Link to comment Share on other sites More sharing options...
hungryfrank Posted June 6, 2020 Share Posted June 6, 2020 (edited) 2 minutes ago, PiLLaO said: $('.pi-gallery') must to work it covers the thumbnails. of course I can write a replacment for pi_gallery Edited June 6, 2020 by hungryfrank PiLLaO 1 Quote you can cut up to 4 pages of your checkout by using my three add_ons login create account in one page Express checkout login pop up modal Link to comment Share on other sites More sharing options...
LeeFoster Posted June 6, 2020 Author Share Posted June 6, 2020 <script> $(function() { var img_option = "<?php echo $_GET['products_id']; ?>"; $("#input_1").change(function(){ var selectedImage = $(this).find(':selected').val(); val = $("#input_1 option:selected").text(); $("a.lb:first").html( "<img src=images/"+ img_option + "_" + selectedImage + ".jpg>"); }); }); </script> This works to change the image to the products_id and the selected value, just needs restricting to the container. Quote Link to comment Share on other sites More sharing options...
burt Posted June 6, 2020 Share Posted June 6, 2020 Nice to see you guys having a go, rather than just talking and more talking 👍 When you get it to a "happy" conclusion, I'll post what I coded yesterday (PROTO code, not really tested etc). Quote Link to comment Share on other sites More sharing options...
LeeFoster Posted June 6, 2020 Author Share Posted June 6, 2020 2 minutes ago, burt said: Nice to see you guys having a go, rather than just talking and more talking 👍 When you get it to a "happy" conclusion, I'll post what I coded yesterday (PROTO code, not really tested etc). We're sat here struggling and you coded it yesterday!!😀 Quote Link to comment Share on other sites More sharing options...
hungryfrank Posted June 6, 2020 Share Posted June 6, 2020 1 minute ago, LeeFoster said: We're sat here struggling and you coded it yesterday!!😀 <script> $(function() { var img_option='images/sample/'+'lime-1'+'.jpg'; $("#input_1").change(function(){ val = $("#input_1 option:selected").text(); $("a.lb:first").html( "<img src="+ img_option+">"); $('a.lb:first img').css({'width' : '150px' , 'height' : '150px'}); }); }); </script> try this and change the size Quote you can cut up to 4 pages of your checkout by using my three add_ons login create account in one page Express checkout login pop up modal Link to comment Share on other sites More sharing options...
burt Posted June 6, 2020 Share Posted June 6, 2020 You're not struggling. You have workable code and you probably (hopefully) learned some javascript tricks. Quote Link to comment Share on other sites More sharing options...
hungryfrank Posted June 6, 2020 Share Posted June 6, 2020 5 minutes ago, burt said: Nice to see you guys having a go, rather than just talking and more talking 👍 When you get it to a "happy" conclusion, I'll post what I coded yesterday (PROTO code, not really tested etc). that is where the difference between a real coder and copy and paster like me😡 Quote you can cut up to 4 pages of your checkout by using my three add_ons login create account in one page Express checkout login pop up modal Link to comment Share on other sites More sharing options...
LeeFoster Posted June 6, 2020 Author Share Posted June 6, 2020 Just now, hungryfrank said: <script> $(function() { var img_option='images/sample/'+'lime-1'+'.jpg'; $("#input_1").change(function(){ val = $("#input_1 option:selected").text(); $("a.lb:first").html( "<img src="+ img_option+">"); $('a.lb:first img').css({'width' : '150px' , 'height' : '150px'}); }); }); </script> try this and change the size The issue is we're losing the class and other src details. We change - <img src="images/11_1.jpg" alt="Objective Marker Bases" title="Objective Marker Bases" width="4123" height="2276" class="img-fluid"> To <img src="images/11_2.jpg"> Quote Link to comment Share on other sites More sharing options...
LeeFoster Posted June 6, 2020 Author Share Posted June 6, 2020 2 minutes ago, burt said: You're not struggling. You have workable code and you probably (hopefully) learned some javascript tricks. Was just highlighting the difference between someone with experience like you and the copy and paste coders like us. Quote Link to comment Share on other sites More sharing options...
burt Posted June 6, 2020 Share Posted June 6, 2020 (edited) Edited June 6, 2020 by burt Omar_one 1 Quote Link to comment Share on other sites More sharing options...
LeeFoster Posted June 6, 2020 Author Share Posted June 6, 2020 Just now, burt said: https://www.youtube.com/watch?v=2gAIIn1-fS8&feature=youtu.be Says video unavailable Quote Link to comment Share on other sites More sharing options...
hungryfrank Posted June 6, 2020 Share Posted June 6, 2020 <script> $(function() { var img_option='images/sample/'+'lime-1'+'.jpg'; $("#input_1").change(function(){ val = $("#input_1 option:selected").text(); $("a.lb:first").html( "<img src="+ img_option+">"); $('a.lb:first img').css({'width' : '150px' , 'height' : '150px'}); $('a.lb:first img').addClass( "img-fluid" ); }); }); </script> you can add the class also Quote you can cut up to 4 pages of your checkout by using my three add_ons login create account in one page Express checkout login pop up modal Link to comment Share on other sites More sharing options...
LeeFoster Posted June 6, 2020 Author Share Posted June 6, 2020 Just now, hungryfrank said: <script> $(function() { var img_option='images/sample/'+'lime-1'+'.jpg'; $("#input_1").change(function(){ val = $("#input_1 option:selected").text(); $("a.lb:first").html( "<img src="+ img_option+">"); $('a.lb:first img').css({'width' : '150px' , 'height' : '150px'}); $('a.lb:first img').addClass( "img-fluid" ); }); }); </script> you can add the class also I just added the class, lol <script> $(function() { var img_option = "<?php echo $_GET['products_id']; ?>"; $("#input_1").change(function(){ var selectedImage = $(this).find(':selected').val(); val = $("#input_1 option:selected").text(); $("a.lb:first").html( "<img src=images/"+ img_option + "_" + selectedImage + ".jpg class='img-fluid'>"); }); }); </script> Quote Link to comment Share on other sites More sharing options...
LeeFoster Posted June 6, 2020 Author Share Posted June 6, 2020 3 minutes ago, burt said: Is this hard coded or hooked? Quote Link to comment Share on other sites More sharing options...
hungryfrank Posted June 6, 2020 Share Posted June 6, 2020 you have to put the script in a hook or module. Quote you can cut up to 4 pages of your checkout by using my three add_ons login create account in one page Express checkout login pop up modal Link to comment Share on other sites More sharing options...
LeeFoster Posted June 6, 2020 Author Share Posted June 6, 2020 3 minutes ago, hungryfrank said: you have to put the script in a hook or module. Yeah that's my preference but where to hook? Or do we need a new one? Quote Link to comment Share on other sites More sharing options...
hungryfrank Posted June 6, 2020 Share Posted June 6, 2020 (edited) like jquerry.php shop/sitewide/ and condition it for if php_self= product_info.php or maybe you can make a pi module. or header_tag module I think u can put it Edited June 6, 2020 by hungryfrank Quote you can cut up to 4 pages of your checkout by using my three add_ons login create account in one page Express checkout login pop up modal Link to comment Share on other sites More sharing options...
burt Posted June 6, 2020 Share Posted June 6, 2020 Hard coded. 20 minutes ago, LeeFoster said: Is this hard coded or hooked? Hook advice: make a product_info hook utilising the injectBodyEnd listener. hungryfrank 1 Quote Link to comment Share on other sites More sharing options...
LeeFoster Posted June 6, 2020 Author Share Posted June 6, 2020 25 minutes ago, burt said: Hard coded. Hook advice: make a product_info hook utilising the injectBodyEnd listener. This is the hook I got to but it doesn't appear to work. class hook_shop_siteWide_changeImage { var $site_end = null; var $safe_pages = ['product_info.php']; function listen_injectSiteEnd() { $changeImageScript = <<<eod <script> $(function() { var img_option = "<?php echo $_GET['products_id']; ?>"; $("#input_1").change(function(){ var selectedImage = $(this).find(':selected').val(); val = $("#input_1 option:selected").text(); $("a.lb:first").html( "<img src=images/"+ img_option + "_" + selectedImage + ".jpg>"); $('a.lb:first img').addClass( "img-fluid" ); }); }); </script> eod; if (in_array(basename($_SERVER['PHP_SELF']), $this->safe_pages)) { $this->site_end .= '<!-- changeImage hooked -->' . PHP_EOL; $this->site_end .= $changeImageScript . PHP_EOL; return $this->site_end; } } Quote Link to comment Share on other sites More sharing options...
hungryfrank Posted June 6, 2020 Share Posted June 6, 2020 (edited) global $PHP_SELF; Edited June 6, 2020 by hungryfrank Quote you can cut up to 4 pages of your checkout by using my three add_ons login create account in one page Express checkout login pop up modal Link to comment Share on other sites More sharing options...
LeeFoster Posted June 6, 2020 Author Share Posted June 6, 2020 20 minutes ago, hungryfrank said: global $PHP_SELF; Nope, this didn't make a difference. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.