I am trying to insert bundled products to the Magento database from a PHP script. The version in question is Community 1.5.1.0.
I tried the method described in the
I have tried using your code, but it did not seem to work in Magento 1.7.0.2. Apparently the product could not be saved.
What I did was added the following lines:
Mage::register('product', $product);
Mage::register('current_product', $product);
$product->setCanSaveConfigurableAttributes(false);
$product->setCanSaveCustomOptions(true);
Just before the lines:
// Set the Bundle Options & Selection Data
$product->setBundleOptionsData($optionRawData);
$product->setBundleSelectionsData($selectionRawData);
$product->setCanSaveBundleSelections(true);
$product->setAffectBundleProductSelections(true);
$product->save();
This seemed to fix the issue of not being able to save the file.