$newProduct = Mage::getModel('catalog/product');
$newProduct->setSku('testsku');
$newProduct->setPrice(100);
$newProduct->setAttributeSetId(4);
$newProduct->setCategoryIds(array(3,4));
$newProduct->setTypeId("grouped");
$newProduct->setName('Product Name');
$newProduct->setDescription('The Product Description');
$newProduct->setShortDescription('Brief Description');
$newProduct->setStatus(1);
$newProduct->setTaxClassId('2');
$newProduct->setCreatedAt(strtotime('now'));
$newProduct->save();
But I don't know how to add Associated products to my new Grouped product. I tried this code:
$new_product = Mage::getResourceModel('catalog/product_type_grouped')
->setUsedProducts($newProduct->getId(), array(7390));
It is not correct. I hope somebody can help me.
Greetings, Rapi