Jump to content

Recommended Posts

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

 


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

Share this post


Link to post
Share on other sites
Posted (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 by hungryfrank

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

Share this post


Link to post
Share on other sites

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>

 

Share this post


Link to post
Share on other sites
Posted (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 by hungryfrank

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

Share this post


Link to post
Share on other sites
Posted (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&amp;options-with-images-show-in-main-image

 

Edited by hungryfrank

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×