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 6885331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:37:16+00:00 2026-05-27T05:37:16+00:00

I’m trying to create configurable products programmatically in Magento 1.5.1. I understand I need

  • 0

I’m trying to create configurable products programmatically in Magento 1.5.1.
I understand I need first to create simple related products, what I did. Now I manage to associate these simple products to make a configurable one.

Here is the critical part…
I keep the ids and some of the attributes values in an array, so I can later make my configurable product, but some of them are missing, I don’t know which method to call.
I found this entry in Magento Wiki, that helped me and seems to fit my needs.
However, at the end the author is setting two things :

$product->setConfigurableProductsData($data);
$product->setConfigurableAttributesData($data);

and the values in the arrays have been taken in the admin page source using Firebug….and then translated into PHP arrays (array example for the first call) :

“I’ve harcoded the values for my associated products and attribute
data. You can get attribute data by viewing the source through the
admin interface and using Firebug for Firefox.”

$data = array('5791'=>array('0'=>array('attribute_id'=>'491', // I already got this
                                       'label'=>'vhs',        // this too
                                       'value_index'=>'5',    // but what is value_index ?
                                       'is_percent'=>0,
                                       'pricing_value'=>'')),
              '5792'=>array('0'=>array('attribute_id'=>'491',
                                       'label'=>'dvd',
                                       'value_index'=>'6',
                                       'is_percent'=>0,
                                       'pricing_value'=>'')));

My question is : is there a way to retrieve these values without using Firebug (which in my script won’t help me a lot !), but programmatically. I already found a way to retrieve attribute values, labels, etc… using its code, but one field I don’t know is value_index.
I guess this may be the option position in an option list, but not sure.
Also if someone knows a good/better way to create a configurable product in Magento, please tell me.
Any help is welcome thank you.

  • 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-27T05:37:17+00:00Added an answer on May 27, 2026 at 5:37 am

    It seems you’re asking where to retrieve the value_index value where you already have the label. Here’s what I had: I didn’t test this on 1.5x.

    function get_attribute_id($option, $type) {
       $attributeId      = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('catalog_product', $type);
       $attribute        = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId);
       $attributeOptions = $attribute->getSource()->getAllOptions();
    
       foreach ($attributeOptions as $opts_arr) {
           if (strtoupper($opts_arr['label']) == strtoupper($option)) {
              return $opts_arr['value'];
           }
        }
        return FALSE;
    }
    
    $value_index = get_attribute_id('vhs', 'media_format');
    

    No one else seemed to mention the easiest way to figure out what the value_index of vhs is: In the backend, under
    Catalog > Manage > media_format > Manage Label/Options
    Inspect the source of the individual form inputs. Where you have ‘vhs’ you should have an input named option[value][6]

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to create an if statement in PHP that prevents a single post
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

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.