on import I would like to add imported products as bundled products to a list of bundle products.
I extended Mage_Catalog_Model_Convert_Adapter_Product and used this class in a custom Dataflow, before the imported row is saved the following code is executed:
//Load product model collection filtered by attribute set id
$products = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect('name')
->addFieldToFilter('attribute_set_id', 12);
// loop through products
foreach($products as $p){
// get product options
$options = $p->getTypeInstance(true)->getOptionsCollection($p);
}
What I need to do next is determine what is the right option (by title), and add the product as a selection to it.
$option->addSelection($selection);
But how do I get the option title and how do i create the selection from my product?