hungryfrank Posted June 8, 2020 Share Posted June 8, 2020 4 hours ago, burt said: I completely forgot to give you the PROTO-code I used. PROTO-code is code that is made to test a concept and should not be used in a production environment, but it might give you ideas... <script> $('select').change(function() { a = $(this).find('option:selected').attr('value'); img = (a) ? "images/<?php echo $product_info['products_id']; ?>_" + a + ".jpg" : "images/<?php echo $product_info['products_image']; ?>"; $('.pi-gallery img:first').attr('src', img); }); </script> thanks Burt. I will play with this it seems that it answers a lot not my questions. thinking a simpler way would be to just add an active class to the image that is to be used. but this neccessitates to have the option-images to be in product_images. db while your way allows for a ftp upload of the images so they won't be in the thumbs. I like it better 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...
hungryfrank Posted June 8, 2020 Share Posted June 8, 2020 (edited) 5 hours ago, LeeFoster said: When put inside my existing hook this doesn't work for me. That said you did say you had it hard coded. dose it work for u? I have almost solved the last part. I will post it when t is cleaned out. I am going to use a header tag instead of a hook. I will eventualy add a button that will give the final image if the shop owner decides to implement a multi option images. maybe if I figure out the exact sort order of attributes and options, have not looked at all can u post your header tag Edited June 8, 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 8, 2020 Author Share Posted June 8, 2020 I have this code working as a hook but if the image is not there it shows the missing image icon. Once I get that sorted I'm happy. <script> $(function() { $("#input_1").change(function(){ var selectedImage = $(this).find(':selected').val(); val = $("#input_1 option:selected").text(); $("a.lb:first").html( "<img src=images/"+ {$prod_id} + "_" + selectedImage + ".jpg>"); $('a.lb:first img').addClass( "img-fluid" ); }); }); </script> Quote Link to comment Share on other sites More sharing options...
hungryfrank Posted June 8, 2020 Share Posted June 8, 2020 (edited) @LeeFoster $.get("images/sample/"+text) .done(function() { if( value > 0) { $("a.lb:first").html( "<img src=images/"+ {$prod_id} + "_" + selectedImage + ".jpg>"); $('a.lb:first img').addClass( "img-fluid" );$('a.lb:first img').addClass( "img-fluid" );} }).fail(function() { }); this is the part that checks if image exist. change the image source and get image first line looks for the image value>0 is so it docent change when it is switched to --select-- this is the part in mine $.get("images/sample/"+text) .done(function() { if( value > 0) $("a.lb:first").html(`<img src="${source}" style="width: 100%" class="img-fluid" />`); }).fail(function() { // if( value > 0) $("a.lb:first").html(`<img src="${source}" style="width: 350px" class="img-fluid" />`); }); Edited June 8, 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...
hungryfrank Posted June 12, 2020 Share Posted June 12, 2020 (edited) @LeeFoster @burt I uploaded the header tag it is functioning correctly. both the main image changes and the gallery is acting as I wanted. it woks even if u simply upload the images directly https://apps.oscommerce.com/Wo1Q8&options-with-images-show-in-main-image Edited June 12, 2020 by hungryfrank peterpil19 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...
satelliteiptv Posted August 3, 2020 Share Posted August 3, 2020 thanks and good 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.