Hi there,
the module shows wrong product images for me.
I am using the latest Version on latest Drupal Version - I use Amazon Local: Germany.
The point is that the Module seems to catch the EU-Energielabel Image instead of the real Product image.
e.g.:
http://up.picr.de/22093039yb.jpg
You can see the label image on amazon also: http://www.amazon.de/Samsung-UE48JU6560-LED-Backlight-Fernseher-Sprachst...
Just search for EU-Energielabel and click on it.
My websites look really wired - all those fancy labels instead of nice product images.
| Comment | File | Size | Author |
|---|---|---|---|
| #32 | 2497913-32-amazon-wrong-image.patch | 1.46 KB | antiorario |
| #22 | amazon-wrong-image-2497913-7.patch | 869 bytes | kamescg |
| #1 | Screen Shot 2015-06-04 at 4.57.03 PM.png | 17.61 KB | epbarta |
Comments
Comment #1
epbarta commentedI'm having a similar situation with about half of the book covers on my sites. Some are showing the back cover, some show the author's image, and some show a icon of a person holding the book.
I'm located in America, so I'm not sure the problem is situated to a specific region.
Comment #2
sejtraav commentedI just noticed the same issue has just appeared on my site. Any ideas? Perhaps the Amazon API changed?
Comment #3
flashon commentedHaving the same issue with back covers showing. It started about a week ago. In /admin/config/services/amazon/test the url used in the array is pointing straight to the back cover image
[smallimage] => Array
(
[url] => http://ecx.images-amazon.com/images/I/51si3vnGEeL._SL75_.jpg
[height] => 75
[width] => 49
)
Comment #4
flashon commentedI'm in Canada BTW.
Comment #5
honylein commentedDamn - it seems to be a general issue.
I have not found a solution so far!
Comment #6
jnycz commentedThis issue is also occurring in D6 if anyone cares. I have books from Amazon returning the second image for some, first for others.
Comment #7
bavramor commentedHi, I have the same Problem with D6, too. Is there any solution so far ?
Comment #8
aharown07 commentedI'm seeing this on several USA book cover images lately... back covers.
Example: [amazon 082543047X thumbnail]
(D7)
Comment #9
Kirk commentedAlso seeing this on D6. Looks like it's related to books that has the animated image on amazon's pages.
Comment #10
gaurishankarI have same issues with D7
Comment #11
shearstock commentedI'm also having the same issue in D6. Any work arounds? Any advice?
Comment #12
kamescg commentedAmazon API is offsetting the image in the returned XML by 1, so to get the first image we need to select the last image in the array.
This patch reverses the ImageSet array, so the correct image is stored in the amazon_item_image table
EDIT: Causes a parse error with Drush, so I need to revise the patch.
Comment #13
smitty commentedMarked as a duplicate of https://www.drupal.org/node/2508265
Comment #14
kamescg commented@smitty The issue request is for 7.x-1.x and the other one is for 6.x-1.x - I think they should be dealt with separately.
To download the correct patch for Drupal 7.x-1.x visit https://www.drupal.org/files/issues/amazon-fix-image-order-2508265-7.patch - smitty do you want to submit the patch to this thread?
Sooo what happened? The Amazon API changed - the primary image is last in the ImageSets array now.
That being said, the primary ImageSet now includes (thanks to smitty for seeing it) the attribute "Category=primary". All other images use "Category=variant". In other words smitty's patch loops over the ImageSets array to find the image with the correct attribute.
It should be noted the XML request returns the primary image (small, medium, large) in three separate arrays right above the ImageSets array, so we could potentially just grab the image information via those arrays instead. It would prevent having to loop over the ImageSets array, which depending on the product could be anywhere from 2-8 images.
Comment #15
gaurishankar@kamescg
Please post seprate patch for D6 and D7.
Currently you submitted path, that has not mentioned about drupal version (D6 or D7).
Comment #16
aharown07 commentedIs the patch in 14 working for anyone? In my tests I'm not seeing any change to the displayed image (ran cron, flushed caches, too).
Comment #17
kamescg commented@aharown07 I was having issues at first when trying to apply the patch. I ended up doing it manually, because I was getting whitespace Git errors. That being said, the code in the patch is right. Maybe try to insert manually and see what happens?
Comment #18
aharown07 commentedThe patch works now... It seemed to take a day or two even though I flushed all the caches. Perhaps there is a table you have to manually truncate to see immediate results? (It is also possible that browser cache was an issue, though I'm pretty sure I flushed that too)
Anyway, patch seems to be good.
Comment #19
kamescg commentedThe "amazon_item_image" table isn't flushed during a clear cache. However, the products will be updated during a cron job or after a certain amount of time (usually 24 hours) for most websites.
For everyone applying the patch remember to run a cron job refresh the Amazon Product Image cache.
Comment #20
smitty commentedThe time it takes to flush the "amazon_item_image" can be configured in admin/config/services/amazon/storage
Maybe reconfiguring this setting will empty the table immediately and force a reload of the images. But I'm not sue about this. Just give it a try ...
Comment #21
AntiNSA commentedIm just getting the default image now for no image provided products... this needs to be moved to Critical, I used the first patch for d6 provided by OP....
Comment #22
kamescg commentedI have uploaded the correct patch for this Drupal 7 thread. Smitty published it in the 6.x thread and we forgot to move it over here.
The patch is practically guaranteed to select the correct image. It will search for an image marked as primary. Unless Amazon is sending the wrong image (which I doubt) it's a problem on our end.
I suspect the problem has to do with cached images in the everyone's existing websites.
The core Amazon module contains the amazon_cron() function. From the way it's structured it's set to only update 50 Amazon Product's at a time. I guessing this function setting is tripping up existing websites with larger product inventories. However, I also can't find a call to this function, so it's not obvious when it's being executed and how exactly...
In addition the amazon_item_expire() function is not defined in the core Amazon module, but it's called in the hook_flush cache function. This may be another issue causing Amazon Product images not to expire.
Time permitting I'll write a patch to add a Product Refresh tab, where administrators can manually update all of the product images via the module dashboard.
Additionally, I'm just cleaning up a fork of the Amazon Module which adds support for images galleries and selecting a product's primary image. I'll be providing the link shortly if anyone feels compelled to help test it. Afterwards a patch will be provided to this thread.
Comment #23
AntiNSA commentedIll get the d6 patch from the other thread and give it a go. The product refresh tab would be an awesome feature!
Thanks for your great efforts.
Comment #24
kamescg commentedI recently published an update to the 7.x-1.x-dev Amazon Module, so it now includes support for product image galleries. For example you if the Amazon Product has 5 images the Amazon Module can display all 5 images using either the Small, Medium and Large gallery sizes.
You can download the update module at https://github.com/KamesCG/Amazon-Core/tree/master if you want to test/add support for image galleries to your website. I'll send the update the a maintainer and see if he's willing to publish the update.
BTW You have to run Drupal Update, because the module adds a new database table.
I'm still working on the Image Refresh function - I'll publish in the next 1-3 days.
Comment #25
AntiNSA commentedThat would be nice. unfortunately I am stuck on D6 untill after our kickstarter.... so if there is a 6 version thats awesome :)
Comment #26
kamescg commentedI was made the maintainer for the Amazon Module yesterday, so I am going to do my best to release backwards compatibility as the project moves forward.
Comment #27
leahmd commentedI had the same issue with odd images, the patch in #22 solved it for me, thank you very much!
Comment #28
AntiNSA commentedany progress? SMittys d6 patch is not working : (
Comment #29
gaurishankarThis patch working for me
/*path for D-7
*amazon.module
*line -574
*/
if (isset($xml->ImageSets->ImageSet)) {
--foreach ((array) $xml->ImageSets->ImageSet as $key => $data) {
++$ImageSets = (array) $xml->ImageSets;
++if (is_array($ImageSets['ImageSet'])) {
++if (isset($ImageSets['ImageSet'][0])) {
++$ImageSets = $ImageSets['ImageSet'];
++foreach ($ImageSets as $number => $set) {
++$set = (array) $set;
++if ($set['@attributes']['Category'] == 'primary') {
++$ImageSet = $set;
++}
++}
++}
++}
++else {
++$ImageSet = $ImageSets['ImageSet'];
++}
++foreach ($ImageSet as $key => $data) {
Comment #30
Denis Waßmann commented#29 works - thx! But you must wait a while for amazon cache (and set it on "Amazon refresh schedule" 1 houre)
Comment #31
smitty commentedThe patch from #22 / #29 works fine, as long as Amazon is providing at least one image. But there are cases, where Amazon dosn't deliver a single image. And in such cases there are two php-Warnings/Notices in the error.log:
These messages disappear if we check if variable $ImageSet exists before trying to read it.
So the enhanced Patch is now (unfortunately I don' have a tool installed to make a true patch):
Comment #32
antiorario commentedThis is the patch for #31.