Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Change product image with option selected


Guest

Recommended Posts

Posted

Problem:

want to be able to change the product image when selecting an option from the drop down box.

 

Status:

the images change...but the names are the actual product attribute filenames...ie 1.jpeg, 2.jpeg and so on...the images change though!

 

What needs to be done: [need help on]

1. pass some other identifier to the function so that I can name the pictures unique for each product

 

2. get the "Add to basket" button working. it seems to have died

 

Resources:

1. I have been using this site extensively:

http://www.oscdox.com/crossx/nav.html?_functions/index.html

 

2. Previous posts:

http://www.oscommerce.com/forums/index.php?showtopic=122735

 

Code: product_info.php

 

head:

<script LANGUAGE="JavaScript">
function JumpTo(theMenu){
 var theDestination = theMenu.options[theMenu.selectedIndex].value;
document.mypic.src=('/catalog/images/' + theDestination + '.jpeg')
} 
</SCRIPT>

 

body:

replace this line:

<td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>

 

with these lines:

<td class="main">
   <FORM METHOD="POST" ACTION="">
<select name="JUMP" onChange="JumpTo(this)">
         <option value="<?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?>
       </select>
   </FORM>

 

any help or tips would greatly be appreciated from the community!

 

thank you,

RobertG...

Posted

Robert,

 

It seems you need a different file naming convention. Something like p-a.jpg where p is the product code and a is the attribute code. You already have a solved. p should be easily available as the product number is known to display the product.

 

ed

Posted
Robert,

 

It seems you need a different file naming convention.  Something like p-a.jpg where p is the product code and a is the attribute code.  You already have a solved. p should be easily available as the product number is known to display the product.

 

ed

 

Thats the problem, I am not sure how to pass the product ID to the Javascript function that handles the image change.

 

I need serious PHP and Javascript help to solve this.

 

 

thank you,

RobertG...

Posted

Can anyone help me on the code for this. I am not sure how to pass the correct variables.

 

Thank you,

RobertG...

Posted

Robert,

 

I've been mulling this over for the last day or 2. Can you PM me your current version of the code (the whole file)? I'd like to work on it tonight.

 

ed

Posted
Robert,

 

I've been mulling this over for the last day or 2.  Can you PM me your current version of the code (the whole file)?  I'd like to work on it tonight.

 

ed

 

I sent you a PM with the product_info.php code in it. I just copied and pasted. Thank you for your help on this. I am thinking of making this a contribution once it is working.

 

Thank you,

RobertG...

Posted

Are there any experts out there that can save me?

  • 1 month later...
Posted
Are there any experts out there that can save me?

 

I wish people on this board were more responsive. When I first started using OSC I would really get fustrated with this board. But now I understand that people do this for money. Anything that can be added to this already excellent (and free) script is most appreciated.

It would have been great if this could have been a contribution. I really needed something like this. Wish I understood PHP more. I gave up on all the multi - image contributions and decided just to use animated gifs...Now aint that something!?!

:rolleyes:

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...