cancel
Showing results for 
Search instead for 
Did you mean: 

Associating a simple product with a configurable product

0 Kudos

Associating a simple product with a configurable product

Feature request from MidnightDesign, posted on GitHub Jun 27, 2016

What is the correct way to associate an existing simple product with an existing configurable product?

I've been struggling with this for a couple of weeks now. I somehow got it to work im 2.0 using the API classes in Magento\ConfigurableProduct\Api, but that's broken in 2.1. The added products don't show up in the configurable's admin page.

I found some blog posts and Stack Overflow questions related to this, but they either don't work or they don't use the API interfaces.

16 Comments
apiuser
New Member
Status changed to: Investigating
 
apiuser
New Member

Comment from antboiko, posted on GitHub Jun 27, 2016

Hi @MidnightDesign , please provide detailed steps to reproduce the issue.

Thanks, Anton.

apiuser
New Member

Comment from MidnightDesign, posted on GitHub Jun 27, 2016

I guess this is more of a documentation issue/question. How is this supposed to work? The code that worked for me in 2.0 is very convoluted and so it's not easy to break it down to a simple reproducable thing here.

Basically, I'm using a combination of Magento\ConfigurableProduct\Api\OptionRepositoryInterface and Magento\ConfigurableProduct\Api\LinkManagementInterface#addChild(). Is this even the right direction? Or are those interfaces meant for something different?

apiuser
New Member

Comment from piatrouski, posted on GitHub Jun 27, 2016

@antboiko @MidnightDesign https://github.com/magento/magento2/issues/5243

apiuser
New Member

Comment from MidnightDesign, posted on GitHub Jun 27, 2016

@piatrouski Yes, your issue might be connected to this. But here I'm asking in general how configurable products are supposed to work.

apiuser
New Member

Comment from develpr, posted on GitHub Jun 28, 2016

@MidnightDesign in 1.x you could create a product, then associated simple products to the configurable product by using the standard filter grid to filter / find simple products to associated. With M2 you need to first use the "generation" tool to create the simple products to associate, then you need to replace the auto-generated versions with the simple products you actually want. As I see it there is a completely unneeded first step of creating the autogenerated products.

I would say that you should be able to select simple products to relate to the configurable product without having to first generate the simple products.

apiuser
New Member

Comment from MidnightDesign, posted on GitHub Jun 28, 2016

@develpr This can't be the only way right now, can it? If it is, then that's a massive oversight.

Magento, what's the plan here? Is this even planned? @benmarks maybe?

apiuser
New Member

Comment from antboiko, posted on GitHub Jun 29, 2016

Hi @MidnightDesign , we have internal ticket MAGETWO-50639 in our backlog to revise the flow for the configurable product.

As for now, the flow described by @develpr is correct. "Add products manually" isn't available until user defines attributes within "Create/Edit Configurations" wizard.

https://github.com/magento/magento2/issues/2564

Best, Anton.

apiuser
New Member

Comment from MidnightDesign, posted on GitHub Jun 29, 2016

@antboiko Thanks for the clarification, but just to be sure: you know I'm talking about doing this in code, not in the admin backend, right? I can't imagine there's no way to do this programmatically. (I've done it in 2.0 - the 2.1 update just broke my hacky code.)

apiuser
New Member

Comment from develpr, posted on GitHub Jun 30, 2016

Sorry @MidnightDesign I may have led the discussion on a wild goose chase / off course! I was referring to the admin interface, not code / API.