Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Can I get some documentation for Magento 1.5’s import system (regarding gallery and media_image)? 
 
Graphtek_Darren
Jr. Member
 
Avatar
Total Posts:  8
Joined:  2011-03-22
 

Hi, I saw Magento added support for categories. What is the format for gallery and media_gallery, more specifically what is the difference between gallery and media_gallery?

Thanks,
Darren

 
Magento Community Magento Community
Magento Community
Magento Community
 
Bing Dicklepuss
Sr. Member
 
Total Posts:  91
Joined:  2010-07-26
 

Actually, no, you can’t.  Magento doesn’t really do documentation.  They announce updates and then provide no guidelines whatsoever.

Are you using 1.5 or 1.5.0.1?  As far as I understood, they are not supporting multiple images now.

Take a look at this:

http://www.magentocommerce.com/blog/comments/magento-ce-1501-stable-now-available/

I’m also interested in using the multiple-image feature but am currently having so many problems with basic import that I can’t even worry about multiple images yet.

And now let’s see if they finally resolved their forum bug that won’t let anyone post a message unless they fight with the system all day.

Edit:
With version 1.5.1.0 (click here) I believe they say that the multiple-image function has been restored.

Also, I have been able to post to the forum lately, but not if it takes me more than 5-10 minutes to compose my post.  Then I get an error, “Message field was empty”.  It was pretty neat yesterday when I spent an hour composing a post only to have it thrown away.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Bing Dicklepuss
Sr. Member
 
Total Posts:  91
Joined:  2010-07-26
 

Here’s some information that may help someone.  I did some research on table structure (v. 1.5.0.1) relating to the image tables

1.) Table `catalog_product_entity_media_gallery`
Fields: `value_id` (auto_increment primary key), `attribute_id`, `entity_id`, `value`

`attribute_id` is a foreign key from the table `eav_attribute` that matches the `attribute_id` in that table for `attribute_code` “media_gallery”.
`entity_id` is a foreign key from the table `catalog_product_entity` that matches the `entity_id` (product id) in that table (where you can also see the product sku).

This table should contain all the product images for every item.  So if you have a main image and 3 gallery images for an item, you would have 4 entries in this table for that product.  It stores the image location and filename, and it links to the corresponding `product_id` in product tables.  I have managed to import images for items and not get the main image into this table and yet it still appears in the front end, but that was using an importing extension that made errors.  By default it seems that Magento stores ALL images in this table (as well as perhaps elsewhere?).

Each entry corresponding to the images for a single product should have the same `entity_id` - the `entity_id` being the database product id.  If you’re wondering, you would most easily find in `catalog_product_flat_1`, since it’s a flat table and you can see both the id field and the sku field on one line.  Or you could just select a product in the admin and the id should appear somewhere in the url.

It seems like the `attribute_id` is the same for all images in your database, but not necessarily the same for different magento installations.  I have one installation where they are all “73” and another where they are all “77”.  I imported some images with the wrong `attribute_id` and those images didn’t show up.  I manually changed one value in the database to the correct value and the image instantly appeared on the front end.  Of course, manually changing the database is usually a bad idea, so I didn’t do this experiment on the production site.

Each entry has a unique `value`, which is the image location and filename (e.g. /4/3/4327abc.jpg).

Each entry has a unique `value_id` that corresponds to an entry in `catalog_product_entity_media_gallery_value`.

2.) Table `catalog_product_entity_media_gallery_value`
Fields: `value_id`, `store_id`, `label`, `position`, `disabled`

`value_id` is the foreign key from the previous table, `catalog_product_entity_media_gallery`.
`store_id` is the foreign key linking to the `core_store` table.

For single store installations, this table has a 1-to-1 correspondence with the 1st table. It’s linked to the last table on `value_id`.
It also contains the field `store_id`, which for my single-store installations always contains “0”. 

For multi-store installations, the `value_id` values in this table could be duplicated, since the primary key for this table is a composite of `value_id` and `store_id`.  This means that, based on the previous table (`catalog_product_entity_media_gallery` ) you could have a single set of images for a product, but give them different labels, put them in a different order, and have different images disabled (not showing) depending on which website store it is assigned to.

Changing `label` or `position` manually should instantly change the mouse-over label (title) for the images, and the order in which they’re presented, on the front-end.  If two images have the same position value then I think they’re arranged in alphabetical order, though it could be in order of `value_id`.

 
Magento Community Magento Community
Magento Community
Magento Community
 
chiefair
Mentor
 
Avatar
Total Posts:  1848
Joined:  2009-06-04
 

@Buck Dinglepuss

Before the downside, thanks for the research, I’m in the research stage on upgrading.

Forum rule --> Cursor in text box, CTL-A, CTL-C before filling in the CAPTCHA and submitting.

This forum software hates well researched, well thought out, proofread and edited posts. As you noted, if it’s longer than a no-content tweet, you get the beautiful message and half the time when you return, either one of two things, your content is gone, or all your code has had every quote escaped with two to ten backslashes, rendering a simple cut’n paste impossible for anyone who tries to use it.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top