Hi. As you see, I'm a newbie in this forum, although I've found some pretty great stuff here already, so I'm sure I'll be sticking around for quite some time. Now I've been doing web-development for about 4 years, as a full-time job, and played with it for the last 12 years. So, I'm not new to the web or how it works. I specialize in Zen-Cart.
O.k. Now that that's out of the way I'll explain my situation. I've never learned Java, and I know I need to. This looks like a great place to start. But, what I need to do is display an image based on an attribute selection from a dropdown menu.
To explain a little more in detail:
On a products page, the user must select a font to be used. The dropdown (attribute ID 49) is set to "5 year Old" font (option value 336) by default. I need this to display "5yrold.jpg"....which I can do. Now, the user selects the last font on the list....Wedding Text BT (option value 385), in which the image needs to change appropriately to "wed_txt.jpg" upon selection so the user can see the font they're getting. I also have a link for them to view all fonts all at once, using Java (although I can't get the image to come up full size in the new window.....it's small with a magnifying glass. Maybe somebody could tell me how to fix this, as well?), but I really need to get this done, if somebody could show me an example, or point me to the right place on this site......as this place is HUGE! and there's so many scripts for so many things.
I would really appreciate any info on this. And if you look me up in the Zen-Cart Forums (same user Nick), you'll see that I'm not one of those "come get what I need and leave types". I'll be here for years to come, and when I learn Java......and I WILL.....I will be right here sharing what I've learned. As that's how a forum like this is supposed to be.......in MY opinion.
07-13-2010, 09:35 AM
Java can also be used to design websites, so try to separate both.
So you're looking for a way to make the selection of a dropdown-list item display the right image.
var vSelection = "5yrold.jpg";
case "385": vSelection = "wed_txt.jpg";
//add all images here
document.getElementById("imagethathastochange").src = vSelection;
where imagethathastochange is the ID of the image you want to use.
It'd be a lot easier if you would use the image-filenames as values for the selectionbox, though...
07-13-2010, 06:34 PM
Get Em Fast
I really appreciate this. I will try this and let you know how it goes.
Now, what exactly did you mean here: "use the image-filenames as values for the selectionbox"? Change the image name from "5yrold.jpg" to........what, something "f001.jpg"?
07-14-2010, 02:57 PM
You can make the values of the selection box so that you can use this value to compose the filename directly, without writing a separate piece of code for each selection item.
You could use the filename as value:
<option value="wed_txt.jpg">Wedding Text BT</option>
You though I was gone for good, didn't you? This just got put on the back burner for a little while. :)
Just letting you know that I DID get this accomplished with your help and the help of a Zen-Cart forum member. They knew ZC's files pretty good, and that always helps.
I just wanted to drop in and say thank you so much for your help in this.
If anybody here wants/needs to know exactly how this is done in a Zen-Cart, I'd be happy to post the proper steps involved.
09-27-2010, 02:41 PM
Well, I'll be honest, I'm a bit too active online to keep track of who does and who doesn't react to the messages I write on forums.
I'm glad to hear that your problem was solved, though.
Good luck with your journey.