This is my first Drupal issue, so I apologize if I'm doing it wrong. Please tell me how to correct it.
I have spent two hours trying to track down a root cause for an issue with option_images. I've applied the patch to show image previews on the product screen and I'm using option_images 6.x-1.x-dev.
This problem is intermittent, which makes it difficult. Some of my products and attribute sets work great, and some do not. I cannot tell why. The ones that work have a populated $node->option_images array. The ones that do not work do not have this array filled (see the debug output near the bottom of the first screenshot).
I can view the filesystem of the webserver and see that images are uploaded to default/files/option-images.
Also, I can see the option images in the preview on the edit product page.
I have searched through existing issues on this site and have not found a fix.
I am absolutely stumped.
This thing is pretty kickass otherwise, btw. Thanks :)
Any ideas?
Screenshots:


| Comment | File | Size | Author |
|---|---|---|---|
| #2 | ScreenShot004.png | 43.27 KB | SimpleAsCouldBe |
| ScreenShot002.png | 129.11 KB | SimpleAsCouldBe | |
| ScreenShot003.png | 318.6 KB | SimpleAsCouldBe |
Comments
Comment #0.0
SimpleAsCouldBe commentedtrying to get inline images to work
Comment #0.1
SimpleAsCouldBe commentedthat didn't do it :)
Comment #0.2
SimpleAsCouldBe commentedtrying again
Comment #0.3
SimpleAsCouldBe commentedimages!
Comment #2
SimpleAsCouldBe commentedUpdate: The module does seem to be querying the database. (screenshot). Too many times though. I see 4 queries for 4 different images, but I only have two option_images for this product. The images it is querying the db for are from a different product which has a different attribute set assigned.
Comment #3
SimpleAsCouldBe commentedI logged out the behavior of uc_option_image_nodeapi and calls to uc_option_image_load.
Here is the difference between working and non working calls:
working
option_image: hook_nodeapi(): $op: load
option_image: load
option_image: 45
option_image: 45
option_image: 45
option_image: 45
option_image: hook_nodeapi(): $op: view
option_image: view
option_image: 379
option_image: 379
option_image: 379
option_image: 379
option_image: 88
option_image: hook_nodeapi(): $op: alter
not working
option_image: hook_nodeapi(): $op: load
option_image: load
option_image: hook_nodeapi(): $op: view
option_image: view
option_image: hook_nodeapi(): $op: alter
After further investigation, I've discovered that my problem attributes are not in the $enabled_attributes variable. How on earth do they get there? I see no UI option to enable this...
$enabled_attributes = variable_get('uc_option_image_attributes', array());
Comment #4
SimpleAsCouldBe commentedOh dear god. This is it: http://drupal.org/node/1087492
After hours turning into days of digging through code entrails... I love when Drupal saves me work, but sometimes the settings are so hidden it causes absurdity like this.
Specifically, attributes must be enabled: /admin/store/settings/attributes
Comment #5
SimpleAsCouldBe commentedI think this should be filed and fixed as a 'usability bug'. I am embarassed to have spent so much time hunting this down as a code bug, but I can't be the only one (just the only one who's publicly recorded the process). What threw me off is that it lets me add and preview option images--why wouldn't it show them? Must be a bug, right?
I suggest:
* disable the uploading and preview of option images for attributes that are not enabled for option images.
Comment #5.0
SimpleAsCouldBe commentedclarification