Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Want Image to Change


Guest

Recommended Posts

how do I get the image to change when a customer selects another color?

thank you!

RobertG...

 

 

I want to clarify:

I ahve an item for sale that has multiple colors. I want the user to select a color and change the image. Anyone done this before?

 

 

thank you!

Link to comment
Share on other sites

Thank you, I am going to try that solution...I just to be able to do what they apparently could not...if you have any tips, let me know....thanks agian...

 

 

I'm looking to do the same thing with images. If you figure it out please let me know how it went ok.

 

Thanks TJ

 

:'( USMC - 81-93

Link to comment
Share on other sites

I'm looking to do the same thing with images. If you figure it out please let me know how it  went ok.

 

Thanks TJ

 

:'(  USMC - 81-93

 

 

will do...I am testing in a basic html to try to get a java based drop down box to change an image....then i will introduce the PHP...

 

teaching myself JavaScript over lunch @ work :blink:

Link to comment
Share on other sites

will do...I am testing in a basic html to try to get a java based drop down box to change an image....then i will introduce the PHP...

 

teaching myself JavaScript over lunch @ work  :blink:

 

 

This is the one I want to duplicate (eventually)

 

Von Dutch

 

Thanks

 

TJ

Link to comment
Share on other sites

This is the one I want to duplicate (eventually)

 

Von Dutch

 

Thanks

 

TJ

 

I like the beige....oh wait...Javascript...[follow the link to get that!]

 

but I think I have something here:

<html>
<head>
<title>JavaScript Example</title>
<script LANGUAGE="JavaScript">
function JumpTo(theMenu){
 var theDestination = theMenu.options[theMenu.selectedIndex].value;
 document.mypic.src=theDestination
}
</SCRIPT>
</head>
<body>
<table>
 <tr>
	 <td>
   <FORM METHOD="POST" ACTION="">
   <select name="JUMP" onChange="JumpTo(this)">
  	 <option value=""Select a Color>
          <option value="70cam15092-A.jpeg">Red
          <option value="Nova.SS396.blue.1969.jpg">Blue
   </select>
         </FORM>

	 </td>
 </tr>
 <tr>
	 <td>
   <IMG SRC="Nova.SS396.blue.1969.engine.jpg" NAME="mypic"	BORDER=0>

	 </td>
 </tr>
</table>
</body>
</html>

 

the code example starts out with one picture on the page [Nova.SS396.blue.1969.engine.jpg]

 

then when you select from the drop down box, it changes:

for red: 70cam15092-A.jpeg [a red 70 Camaro]

for blue: Nova.SS396.blue.1969.j [a blue '69 Nova]

 

if I could attach pictures I would...these are nice cars, not as nice as beige [again follow that link :thumbsup: ]

 

now I need to get the PHP portion....I dont know PHP that well so this will take some time...this is my mission for tonight...OOHRAH!!!!

 

RobertG...USMC:97-01 [they still own me!]

Link to comment
Share on other sites

I like the beige....oh wait...Javascript...[follow the link to get that!]

 

but I think I have something here:

<html>
<head>
<title>JavaScript Example</title>
<script LANGUAGE="JavaScript">
function JumpTo(theMenu){
 var theDestination = theMenu.options[theMenu.selectedIndex].value;
 document.mypic.src=theDestination
}
</SCRIPT>
</head>
<body>
<table>
 <tr>
	 <td>
   <FORM METHOD="POST" ACTION="">
   <select name="JUMP" onChange="JumpTo(this)">
  	 <option value=""Select a Color>
          <option value="70cam15092-A.jpeg">Red
          <option value="Nova.SS396.blue.1969.jpg">Blue
   </select>
         </FORM>

	 </td>
 </tr>
 <tr>
	 <td>
   <IMG SRC="Nova.SS396.blue.1969.engine.jpg" NAME="mypic"	BORDER=0>

	 </td>
 </tr>
</table>
</body>
</html>

 

the code example starts out with one picture on the page [Nova.SS396.blue.1969.engine.jpg]

 

then when you select from the drop down box, it changes:

for red: 70cam15092-A.jpeg [a red 70 Camaro]

for blue: Nova.SS396.blue.1969.j [a blue '69 Nova]

 

if I could attach pictures I would...these are nice cars, not as nice as beige [again follow that link :thumbsup: ]

 

now I need to get the PHP portion....I dont know PHP that well so this will take some time...this is my mission for tonight...OOHRAH!!!!

 

RobertG...USMC:97-01 [they still own me!]

 

Dig it.

 

I'll wait and see what you come up with there hard charger :)

 

Working on a backround per category statement now.

 

This is the site I'm working on at the moment.

 

http://pacifichostingsolutions.com/Clients...ex.php?cPath=21

 

They owe me a new life :)

 

But, at least we aren't in Falluja. That must be one sand bag fillin' funtime.

 

SF

 

TJ

Link to comment
Share on other sites

Dig it.

 

I'll wait and see what you come up with  there hard charger  :)

 

Working on a backround per category statement now.

 

This is the site I'm working on at the moment. 

 

http://pacifichostingsolutions.com/Clients...ex.php?cPath=21

 

They owe me a new life  :)

 

But, at least  we aren't in Falluja.  That must be one sand bag fillin' funtime.

 

SF

 

TJ

 

thats a sweet @$$ site! did you do all the graphics?

Link to comment
Share on other sites

Good resource:

 

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

 

 

I am looking at the tep_draw_pull_down_menu

 

This is our key...

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

 

the

'id[' . $products_options_name['products_options_id'] . ']'

is the Name

 

the

$products_options_array

is the Values

 

the

$selected_attribute

is the Default selected

Link to comment
Share on other sites

Good resource:

 

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

I am looking at the tep_draw_pull_down_menu

 

This is our key...

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

 

the

'id[' . $products_options_name['products_options_id'] . ']'

is the Name

 

the

$products_options_array

is the Values

 

the

$selected_attribute

is the Default selected

 

 

 

Great resource. I should pay attention to the KB more often hehe

 

Thanks

Link to comment
Share on other sites

Ok I need help:

my site: The one item I have assigned a picture

 

in the product_info.php file, I have added the following to the head:

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

 

to line 109: added the NAME="mypic"

document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5" NAME="mypic"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

 

replaced line 150 with:

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

 

 

it changes the picture to a file that it can't find. I need it to pass the name of the color or something so that it will display the correct filename.

 

any help would be greatly appreciated!

 

 

thanx!

RobertG...

Link to comment
Share on other sites

Ok I need help:

my site: The one item I have assigned a picture

 

in the product_info.php file, I have added the following to the head:

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

 

to line 109: added the NAME="mypic"

document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5" NAME="mypic"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

 

replaced line 150 with:

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

it changes the picture to a file that it can't find. I need it to pass the name of the color or something so that it will display the correct filename.

 

any help would be greatly appreciated!

thanx!

RobertG...

Hey Robert.

 

I think we should start a new post with this.

 

A lot of this code is not my forte', I understand most of it, but... Maybe look at the slideshow contrib for reference???

 

http://www.oscommerce.com/community/contri...earch,slideshow

 

Have to think about this one for a while. You've done a LOT of work on it.

 

Looking good, devil dog.

 

 

TJ

Link to comment
Share on other sites

Hey Robert.

 

I think we should start a new post with this.

 

A lot of this code  is not my forte', I understand most of it, but...  Maybe look at  the slideshow contrib for reference???

 

http://www.oscommerce.com/community/contri...earch,slideshow

 

Have to think about this one for a while. You've done a LOT of work on it.

 

Looking good, devil dog.

TJ

 

 

Sounds good! I'll take a look at the contrib you pointed out and use that as reference...if we get this working i'll make a contrib out of it...

 

RobertG...EEERRRR!!! lol its been awhile

Link to comment
Share on other sites

Sounds good! I'll take a look at the contrib you pointed out and use that as reference...if we get this working i'll make a contrib out of it...

 

RobertG...EEERRRR!!! lol its been awhile

 

 

ok, kewl.

 

Just giving you a ration. :thumbsup:

 

I'll do what I can to help.

 

If you need any help on your site LMK

 

TJ

Link to comment
Share on other sites

Status:

the images change...but the names are the actual product attribute filenames...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 uniwue for each product

 

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

 

Resources:

I have been using this site extensively:

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

 

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...

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...