Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6954703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:38:24+00:00 2026-05-27T14:38:24+00:00

I have created new configurable products, and attached their simple products with PHP. Now

  • 0

I have created new configurable products, and attached their simple products with PHP.

Now when I edit any configurable product I see this screen:

Magento Select Configurable Attributes screen in admin

So in absence of any Magento documentation, what do I call in PHP to perform the same function as the screen above programatically?

I have seen $configurable_product->setConfigurableProductsData() used in some examples, but don’t think it is what I need.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:38:24+00:00Added an answer on May 27, 2026 at 2:38 pm

    You are right, you are creating the association/link between configurable and child products but what’s happening is that when you are creating your configurable product you are not setting up the setConfigurableAttributesData that basically setups the superattribute information for that configurable product.

        foreach($configAttrCodes as $attrCode){
    
            $super_attribute= Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product',$attrCode->code);
            $configurableAtt = Mage::getModel('catalog/product_type_configurable_attribute')->setProductAttribute($super_attribute);
    
            $newAttributes[] = array(
               'id'             => $configurableAtt->getId(),
               'label'          => $configurableAtt->getLabel(),
               'position'       => $super_attribute->getPosition(),
               'values'         => $configurableAtt->getPrices() ? $configProduct->getPrices() : array(),
               'attribute_id'   => $super_attribute->getId(),
               'attribute_code' => $super_attribute->getAttributeCode(),
               'frontend_label' => $super_attribute->getFrontend()->getLabel(),
            );
        }
    
        $existingAtt = $product->getTypeInstance()->getConfigurableAttributes();
    
        if(empty($existingAtt) && !empty($newAttributes)){
            $configProduct->setCanSaveConfigurableAttributes(true);
            $configProduct->setConfigurableAttributesData($newAttributes);
            $configProduct->save();
    
        }
    

    This is small snippet should get you there, let me know if you have any questions or need further help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created new PDFs many times using Zend and PHP. But Now I
I have created new authentication method and now need to replace the current home
I have created a new database table with the name 'table'. Now i'm trying
Hi i have created new iFrame APP. this is code part: <fb:visible-to-connection>Welcome, fans!<fb:else>Become fan</fb:else></fb:visible-to-connection>
I have created new payment method (gateway). In this gateway I sending information to
We have created a new List View Style that shows thumbnails from a picture
I have created a new solution with a minimal amount of code that represents
I have created a new SharePoint 2007 MOSS Intranet. Our admin people are purchasing
I have created a new method in one of the project's controllers that it
I have created a new table including a column note. The default is varchar(255)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.