1

here is an explanation of what we have:

multiple simple products for each t-shirt, we use an attribute set with color, size and sex.

The end product is a designed t-shirt, it has a pattern image and must take the t-shirts from the inventory (that's why we use a configurable product)

So, we have around 100 different simple products - but even more configurable products (each pattern gets it's own so the number is huge).

But what when we create a new simple product - let's say a blue t-shirt L sized which we didn't have prior to creating the configurable products. Is there a way to add the associated product to multiple configurable products at once - and not have to go into all products to add it?

  • 1
    From the backend? No. – Fabian Blechschmidt May 10 '14 at 16:27
  • no, not from the backend - I mean if there is an option GREAT - if not there must be some dynamic way that I can not find :) I am ready to write the module for it, I don't really care about the "method" or "way" of the solution - I just don't want my client to go over hundreds of products each time his inventory upgrades (so to say) :) – Kristijan May 10 '14 at 18:53
1

So what you need is the way to add the simples to the configurable?

// $newids is of form:
$newids = array($id => 1, $id2 => 1);
// $configurableProduct = Mage::getModel('catalog/product);

Mage::getResourceModel('catalog/product_type_configurable')
  ->saveProducts($configurableProduct, array_keys($newids));

Then you can hook into saving of a product. Before save you check wether an ID is given, if not, add a flag. In after_save you check for the flag, if it is set, you load loop over all configurable products and add the new simple one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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