My configurable product has four attributes - each attribute has up to 36 options resulting in thousands of options for the customer to choose from.

How can I create all the associated products without doing it one by one?

Or is there a better way to make all the choices available?

1 Answer 1


Try using this

private function _attachProductToConfigurable( $_childProduct, $_configurableProduct ) {
   $loader = Mage::getResourceModel( 'catalog/product_type_configurable' )->load( $_configurableProduct, $_configurableProduct->getId() );

   $ids = $_configurableProduct->getTypeInstance()->getUsedProductIds(); 
   $newids = array();
   foreach ( $ids as $id ) {
      $newids[$id] = 1;

   $newids[$_childProduct->getId()] = 1;

   //$loader->saveProducts( $_configurableProduct->getid(), array_keys( $newids ) );                
   $loader->saveProducts( $_configurableProduct, array_keys( $newids ) );                

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.