Added the images to each option and they show
up fine in the product editing edit options page.
Option images DO NOT show up in the product view
page. There is a box there for the option image
but it says "no image"
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | uc_option_image.js_.txt | 2.02 KB | dan3h |
| #4 | uc_option_image.js | 2.03 KB | dan3h |
| #1 | uc_option_image.js.txt | 2.14 KB | KiwiGod |
Comments
Comment #1
KiwiGod commentedI am attaching an updated uc_option_image.js file.
I found the problem to be with the way the DOM was being parsed, at least on my site. I hope this helps folks. Here are the specific pieces I modified to get this to work...
Sorry if I posted this in the wrong place...
Comment #2
Branndon commentedThanks for uploading that. What that did for me was make it reload the "No Image" text but it didn't actually load the uploaded pic I had. It's a point in the right direction though.
Comment #3
TrickerTreater commentedI'm having the exact same issues. It looks perfect up until you actually view the product page, then just "No Image." I've already:
Any help is very much appreciated.
Comment #4
dan3h commentedI was also having a similar problem, and managed to fix it.
The problem for me was this line in the javascript file (where "$(this)" is the image object that we are trying to change):
$(this).attr('src', imagepath).fadeIn(200);That line of code looks like it is setting the "src" attribute of the image. imagepath was something like "sites/default/files/option-images/mypic.jpg"-- a relative URL. My guess is that when you set the "src" to a relative URL, it treats it as if you are clicking a relative link.
The problem is that the page I was viewing at the time was "http://www.mysite.com/node/20". So after executing this line in the javascript file, the image's URL was switched to http://www.mysite.com/node/sites/default/files/option-images/mypic.jpg
So I simply edited it to read:
$(this).attr('src', "/" + imagepath).fadeIn(200);Note that I also incorporated some of the fixes from @KiwiGod, above in the first comment. I'll attach the resulting file.
(One other problem I was having is that it seems to want to load the "noimage" image from the module, not the theme, and it is getting it from the wrong directory. So I made an "images" dir in the module, and copied the "noimage" image in there too. A hack, but it works.)
Comment #5
dan3h commentedI found and fixed one more problem with this. I found that it was working, until I started having 3-digit node-IDs, and then it was failing. I traced the problem to this line of javascript, which was attempting to get the node id from a form element label:
And I fixed it by changing to this:
The complete, revised file is attached. (Be sure to rename it back to "uc_option_image.js".)
Comment #6
dan3h commented