0

How do I add a 'media_gallery" attribute type to products flat table, so that it can be used in product listing?

srgb
  • 4,783
  • 6
  • 29
  • 45

2 Answers2

1

They can be added by defining "Used in Product Listing" to Yes Once you have done this, you will need to re-index the Product Flat

EDIT: See solution for the final answer.

Source: Can I add other attributes to magento's flat product catalog table?

Solution: Media Images not available in Magento’s product list? Media Images not available in Magento’s product list? - archive

Vern Burton
  • 3,215
  • 1
  • 18
  • 31
  • Media gallery attribute can't be defined as "Used in Product Listing" - Yes, except with a manual sql field modification – srgb Apr 03 '12 at 08:20
  • Yes it can, what version of Magento are you on? I just did it in my dev copy at version 1.7 RC1. I just found it on my flat table with all NULL fields. – Vern Burton Apr 03 '12 at 13:27
  • 1.6.2 - so in 1.7rc1 you can specify "used in product listing" even for media attribute type? can't do that in 1.6.x admin, it's cool if 1.7 can do that – srgb Apr 03 '12 at 16:45
  • I created a 1.6.2 copy as well, and it let me specify the option, I am re-indexing the table now, but it's 300k products so it takes some time. – Vern Burton Apr 03 '12 at 17:10
  • The field is index in my 1.6.2 copy as well. – Vern Burton Apr 03 '12 at 18:07
  • You typed your attribute type incorrectly, you said media_gallery which is a valid attribute in the Manage Attributes. Look at this. http://thedistance.co.uk/journal/2011-10/missing-magento-media-images – Vern Burton Apr 05 '12 at 16:11
  • I appologize for the mistake, as for the solution - it is ingenious indeed :) Simple but effective hack – srgb Apr 11 '12 at 15:12
0

To change it programmatically, you could do.

$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->updateAttribute('catalog_product', '{field_code_here}', 'used_in_product_listing', 1);

Then reindex.

MagePal Extensions
  • 17,646
  • 2
  • 47
  • 62