Recently I noticed that when we go to the edit form for a product entity, the image is missing. The button is present to add an image, and no thumbnail is displayed showing one assigned to the product. However this is the case for Product entities that DO have an image already assigned.

This problem has not always been present. A few months ago we could see any product image assigned to a product, retired, active, inactive, or otherwise. At some point that changed and I don't know what changed it. The field is still assigned to the entity type.

When you go to the Product Display node for the product, it shows the image that was already assigned to the product before this issue occurred. But there's no way to see the image assigned on the Product view.

Any ideas what is going on?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rszrama’s picture

Category: bug » support
Status: Active » Closed (cannot reproduce)

No clue. Sounds like your image cache lost some images or its directories suddenly became inaccessible. Could've happened in a filesystem move or something. Not sure of any modules that would interfere with that, but I doubt it's specific to Commerce. You might widen the search to see if anyone's reported it for other content types / image field instances.

andor.koza’s picture

Same problem...

Here are the details:

case 1:
Updated to Drupal Commerce 1.4, installed Commerce Backoffice.
Added new product with Feeds.

With the old product everything is fine, but the newly imported products has the same problem, and that is when I on produc listing page I could see the images but when I edit the product the image in not linked.

case 2:
Fresh intall of Drupal 7 and Drupal commerce and Drupal Backoffice (+required mudules). I migrated data from an Ubercart site. And the same situation happend.
I cold list product images with views, but when I edit a product there are no image.

Conclusion:

I think that there is an issue with Commerce Backoffice, because it is the only one "new" modul what is installed. Because previously I also imported products and everything works as normal.

but, anyhow I need to figure it out so, I will report if we succeded to fix it.

rszrama’s picture

Project: Commerce Core » Commerce Backoffice
Version: 7.x-1.4 » 7.x-1.x-dev
Component: Product » Code
Status: Closed (cannot reproduce) » Active

Sounds like a good lead; let's move this issue to that queue.

andor.koza’s picture

Forgot to mention, that if I add product manually than everything is ok in booth cases.

So there is the chance that the problem is with the booth (migrate and feed) import module image import party on product entity.
Because other content types with image field are imported correctly.

I will keep you updated.

andor.koza’s picture

Update:

I checked the database if it has the problem, and sadly not a database issue. The product imported and the product manually added has the same database records. Just the uid field is 0 for the imported fid and 1 if I add it as admin. But even If I change the value, empty the caches, nothing happens.

so from the database side every piece of record is where it need to be...

andor.koza’s picture

hmmm, found the same issue, with a fix, but it sounds a little strange to me

http://drupal.org/node/1840486

andor.koza’s picture

Good news guys, the problem is located and it is very easy to fix, but for complete fix with import may be Ryan could help.

The problem is in the database (I know that I wrote that it is not.. I was wrong). To be more specific, I think that the problem is with the Migrate module set and also with the Commerce Feeds.

look at the screenshot, the image field (in my case because of migration tha name is: field_data_field_image_cache) table has a column language: http://gyazo.com/367b0bf2aba66ac9e1b41df8fa97056a

The imported products in language field all have "und" value, the manually added product has "en" value.
Fix:
Just edited the row, changed from und to en, after need toflush all cache and voila the image is appear on the product edit form.

I hope that it will help to others too.

I also noticed that Migration module could map image filed language too, so it will probably solve the problem, it might be that the Feeds has a similar option.

bojanz’s picture

Status: Active » Fixed

Good to know this is fixed :)

ressa’s picture

After migrating a D6 Ubercart site to Commerce, using Commerce Migrate Ubercart I was facing the same problem. These two SQL commands fixed it:

UPDATE `ubercart_to_commerce_d7`.`field_revision_field_image_cache` SET `language` = 'en' WHERE `field_revision_field_image_cache`.`entity_type` = 'commerce_product' AND `field_revision_field_image_cache`.`language` = 'und';

UPDATE `ubercart_to_commerce_d7`.`field_data_field_image_cache` SET `language` = 'en' WHERE `field_data_field_image_cache`.`entity_type` = 'commerce_product' AND `field_data_field_image_cache`.`language` = 'und';

Remember to flush caches afterwards. A better way would be to map the language field in a migrate module, but this also works.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

somatics’s picture

I know this is issue it closed, so it may not matter for anyone to know this, but since I started this issue, I wanted to report back that I was finally able to implement this fix too (just the other day) and it worked.

I used Navicat to view the table field_data_field_image (that's the field Commerce Migrate put our old Ubercart product images into), saw the language was "und" for most rows, and ran the query to change them all to "en". I cleared the cache and immediately the product entity edit form started showing the product image thumbnail.

Thanks for this fix!

ressa’s picture

Project: Commerce Backoffice » Commerce Migrate
Version: 7.x-1.x-dev » 7.x-1.1

That's great, thanks for sharing your success story :-)

Since this issue is not related to Commerce Backoffice, I think moving it to Commerce Migrate makes more sense.

somatics’s picture

You're welcome. I always feel really bad when I have an onslaught of bugs (the joys of a Drupal 7 site that started in D5 or 6!) and then get too caught up in fixing them all tobe able to stay current with the threads that helped me do so. I feel like I'm being an irresponsible participant in the community process, so I want to at least report closure as soon as I can, even if it is after everyone else does!

By the way, I understand it's a problem that Commerce Migrate doesn't change language to English, but isn't it really a problem with the core Commerce package itself if it won't display image records marked as universal instead of English? Shouldn't the records marked "und" display in English sites (maybe I'm misunderstanding what "und" means; I think it means universal for all languages)? If so, it seems like the issue belongs in the Commerce project. No skin off my nose either way -- I'm just trying to offer a (hopefully) helpful suggestion.

ressa’s picture

No no, don't feel bad! Both reporting bugs and offering feedback (even if it's later on :-) is super important. Whenever a bug is reported, other people (like me) might stumble upon them when searching for solutions to a problem, get some hints from the original report, or confirm that the issue is real, and pinpoint the problem. Some other users might then provide a patch to resolve the issue, somebody else will test the patch, and so on.

Webchick has a great example of the process in her Slides for her epic "hook_future_alter()" talk, from this page: http://webchick.net/drupal-8-slides

How improvements are made - One Drupal 8 Slide Deck To Rule Them All

I think "und" stands for undefined, but I am not sure where this issue really should live, perhaps even in core, so that images will be shown, even with language undefined for the image?