Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Attribute Images


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

Link to comment
Share on other sites

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

Link to comment
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>

 

Link to comment
Share on other sites

@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

Link to comment
Share on other sites

  @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

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...