Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Changing picture when attribute is changed


dumbassgeek

Recommended Posts

Hi.

 

I want to change the picture of a product when the attribute is changed. For example if you change the colour attribue from the default black to pink the picture of the item will change to a picture of the item in pink.

 

Has anyone implemented this with oscommerce? I have written javascript code to this for a normal site, and can change the colours when different attributes are selected but I'm not sure how to implement this with oscommerce.

 

Thanks

Link to comment
Share on other sites

If you have done this for a regular site using JavaScript then doing it for osCommerce will be almost as easy (keyword being almost :)...).

 

On the product_info.php page you can find where it draws the drop-down box for the attributes. You could add code in there to switch the images for an onChange event. You would need to id the image as well or put it in a <div>.

 

Hope that helps. It's actually not that hard, more just altering the code correctly and tweaking a little.

Link to comment
Share on other sites

If you have done this for a regular site using JavaScript then doing it for osCommerce will be almost as easy (keyword being almost :)...).

 

On the product_info.php page you can find where it draws the drop-down box for the attributes. You could add code in there to switch the images for an onChange event. You would need to id the image as well or put it in a <div>.

 

Hope that helps. It's actually not that hard, more just altering the code correctly and tweaking a little.

 

OK, Thanks for that.

 

My problem is it draws the attributes from the database. How to you get it to work with that? Any code I should look out for?

 

Thanks

Link to comment
Share on other sites

I'm getting somewhere slowly. I've managed to find where the form is written so I can include the onchange. I've been adpating my code.

 

Current problem is the oscommerce naming of the drop down menus.

E.g.

<select name="id[2]"> etc.

 

When I write

formname.selectname.options[formname.selectname.selectedIndex].value

to return the value of the selected option it does not work because of the [] in the name of the dropdown menu.

 

I've tried this in a simple non-oscommerce example to test it and it seems the [] in the naming is the problem.

 

Any ideas? Anyone implemented anything like this before?

 

Thanks

Link to comment
Share on other sites

  • 2 weeks later...

If you do a search on this you will find zillions of people hoping to implement this. Count me as one of them :rolleyes: Please, please, please, if you get this to work, make it a contribution and you will have the eternal gratitude of the masses

learn...love...laugh...live

Link to comment
Share on other sites

  • 9 months later...
If you do a search on this you will find zillions of people hoping to implement this. Count me as one of them :rolleyes: Please, please, please, if you get this to work, make it a contribution and you will have the eternal gratitude of the masses

I actually managed to have this working for about 6 months then I changed hosts and it wont work anymore though I have note changed the code. I'll have a look again and once I get it working I'll post.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...