BLOG/Technology
Creating Configurable Products: Magento's Undocumented Requirements for Configurable Attributes
I ran into this issue recently, while trying to create a configurable product in Magento. After clicking the Add Product button and selecting Configurable Product ...
I encountered a dead end and the following message: “This attribute set does not have attributes which we can use for configurable product”
I was surprised because I had already created several eligible attributes, I began double-checking my attribute configuration. Magento provides this helpful(?) tip:
Only attributes with scope "Global", input type "Dropdown" and Use To Create Configurable Product "Yes" are available.Seems simple enough, but it's not quite. After many hours double checking my attributes, creating new attribute sets, disabling modules, reinstalling my database from scratch and attempting all sorts of desperate debugging tactics, I was surprised to learn that there are actually two more requirements: the attribute must be visible (not an issue for me) and the attribute must be set to user defined. The following code from the class Mage_Catalog_Model_Product_Type_Configurable shows the true requirements for a configurable attribute:
The key, for me, was setting the attributes' user_defined property to true. If you create your attributes through the Admin UI, then user_defined will automatically be set to true. However, if you define your attributes in a setup script, as I did, you must set it manually./** * Checkin attribute availability for create superproduct * * @param Mage_Eav_Model_Entity_Attribute $attribute * @return bool */ public function canUseAttribute(Mage_Eav_Model_Entity_Attribute $attribute) { $allow = $attribute->getIsGlobal() == Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL // GLOBAL && $attribute->getIsVisible() // VISIBLE && $attribute->getIsConfigurable() // CONFIGURABLE && $attribute->usesSource() // DROPDOWN && $attribute->getIsUserDefined(); // USER DEFINED return $allow; }
To modify this field for an existing attribute, edit the database table. There is no way to edit this property through Magento's admin interface. UPDATE `eav_attribute` SET `is_user_defined`=1 WHERE `attribute_code`='color';$installer->addAttribute('catalog_product', 'color', array( 'type' => 'int', 'label' => 'Color', 'input' => 'select', // THIS IS NECESSARY FOR ATTRIBUTES USED TO CREATE CONFIGURABLE PRODUCTS 'user_defined' => true, 'required' => true, 'filterable' => 1, ... 'option' => array( 'values' => array( 'Black', 'Brown', 'Grey', ) ), ));



More from the
DO Blog

Designing & Building Product Finder Quizzes for eCommer...
Strategy & Planning / December 23, 2020
View Blog Post
3 Customer Motivation Strategies to Improve Your eCommerce i...
Strategy & Planning / July 27, 2020
View Blog Post