Reputation: 383
In a vanilla install of Magento 1.5.1.0 I have created simple products COLOR-RED, COLOR-BLUE and created a configurable product COLOR that has these products associated with it. This works all fine, except for the fact that the names of the associated products are not shown in the backend in the Configurable product's 'Super product attributes configuration' table. I have added a simple debug statement to htdocs/app/design/adminhtml/default/default/template/widget/grid.phtml to display the item's data before display. See below, the name attribute is not there. Does anybody have an idea why? Is it a bug in Magento, or is something else wrong?
Array
(
[entity_id] => 1
[entity_type_id] => 4
[attribute_set_id] => 9
[type_id] => simple
[sku] => COLOR-RED
[has_options] => 0
[required_options] => 0
[created_at] => 2011-12-13 15:08:36
[updated_at] => 2011-12-13 15:08:36
[is_saleable] => 0
[inventory_in_stock] => 0
[color] => 3
[price] => 12.0000
[stock_item] => Varien_Object Object
(
[_data:protected] => Array
(
[is_in_stock] =>
)
[_hasDataChanges:protected] =>
[_origData:protected] =>
[_idFieldName:protected] =>
[_isDeleted:protected] =>
)
)
Upvotes: 2
Views: 1175
Reputation: 255
You're probably using the Simple Configurable Products module. In the file app/code/community/OrganicInternet/SimpleConfigurableProducts/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid.php the developers of Organic Internet left a nice little hint;
#Copied from Magento v1.3.1 code. #Only need to comment out addFilterByRequiredOptions but there's no #nice way of doing that without cutting and pasting the method into my own #derived class. Boo. #This change stops the filtering-out of any configurable product's 'associated products' that have compulsory custom options #Have also replaced parent::_prepareCollection with Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
I figured the code that was used in 1.3.1 was outdated so this file would be outdated if you're using >1.3.1. So I just looked at the contents of the core file app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid.php and looked for differences, and found the culprit.
All you have to do is add this line;
->joinAttribute('name', 'catalog_product/name', 'entity_id', null, 'inner')
between these two lines;
->addFieldToFilter('attribute_set_id',$product->getAttributeSetId())
->addFieldToFilter('type_id', $allowProductTypes);
And you're all set!
Upvotes: 3