I am trying to create order programmatically.

There are configurable products having single base attribute i.e. Size. and some of configurable products have multiple (more than one) associated product having same size value.

Now, attempting to add such configurable product with particular size. But magento assigns the sibling/child/associated product which would encountered first! :( and Hence, deserving SKU/sibling dropped to create order with.

I followed code from below links:



Is there any way to add config product with particular SKU ? (something like; acceptable parameters in "addProduct" method etc..).

Please, help me on this asap as I stuck since longer time and still couldn't get any solution. :(

enter image description here

enter image description here


Div, Thanks in advance!!

  • My concern is to add config product with desired size/option in order while creating it. I posted screens to make it more cleared. Kindly, let me know if it is still not cleared. Thanks.. – Div Jun 21 '14 at 6:41

problem seems to be in the size attribute in the second screenshoot. For Example:

You have shirts with the attribute color. What your setup is doing is adding 4 simple Products with the same color for example red. The customer will only have the possibilty to choose the red color in the dropdown. Accordingly when the red color is choosen, the system will return the first match, even if there a 50 shirts with color red and different names.

Right way would be either to change the simple products, so each one has an unique attribute value for color (like yours size), or you add another attribute to the simple products -> then you can have as result the combinations of these. For example we have an attribute size and an attribute color, and we have for each one 4 differnt possible values, so you can have 4*4 = 16 differnt combination which could be recongised by the system, and the right simple product can be matched.

| improve this answer | |
  • Hi Samir, really appreciating your reply! I will try to get some alternative approach to solve this issue in accordance with your suggestion. But still if there is any (code level) solution which could directly allow to address the desired config product (with option) to add it as line item in order while creating the same then it will be more helpful to me! Thanks.. – Div Jun 23 '14 at 4:09

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