1

I checked some existing questions, but none of them explains how to create configurable products without child products data. I don't need to link products, I just need to create configurable product for later use.

So I tried that:

$_prod->setTypeId('configurable');  
$_prod->setConfigurableAttributes('color');

But this is not working. When I click in admin on product, the product is created, but I need to choose first configurable attributes. So setConfigurableAttributes didn't make any action, but it also didn't invoke any error. What is the proper way for that?

1

1 Answer 1

2

I ended up with the below raw query:

$colorAttrId = 92;
$tableName = Mage::getSingleton('core/resource')->getTableName('catalog_product_super_attribute');
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$write->query("INSERT IGNORE INTO $tableName (`product_id`, `attribute_id`) VALUES ($prodId,$colorAttrId)");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.