Hi,
I'm currently working on a website where we want to insert orders into magento.
Simple products are no problem to insert, only the bundle products are casting problems.
With the follow code i'm trying to add the product
PHP Code:
//$products[$i]['pakket']->entity_id = id of bundle product
$product = Mage::getModel('catalog/product')->load((int)$products[$i]['pakket']->entity_id);
$params = array(
'bundle_option' => array(),
'bundle_option_qty' => array(),
'qty' => 1
);
//get options / bundle item products
$selectionCollection = $product->getTypeInstance(true)->getSelectionsCollection(
$product->getTypeInstance(true)->getOptionsIds($product), $product
);
foreach($selectionCollection as $option)
{
$params['bundle_option'][(int)$option->option_id][] = (int)$option->selection_id;
$params['bundle_option_qty'][(int)$option->option_id][(int)$option->selection_id] = 1;
}
$result = $quote->addProduct($product, new Varien_Object($params));
Can someone help me out.
With best regards,
René
View more threads in the same category:
Bookmarks