So I'm trying to add a bundled product to a quote programmatically in a module. When I add an item to the cart directly from the front-end, it works just fine. However, when I do it programmatically, I get an error message:
Please specify product option(s).
The function invocation I'm doing looks a little like this:
$productID = Mage::getModel('catalog/product')->getIdBySku('PKGTEST');
$product = Mage::getModel('catalog/product')->load($productID);
$result = $quote->addProduct($product, new Varien_Object([
'product' => $productID,
'qty' => 1,
]));
if ($result) {
throw new Exception($result);
}
What is going on here? How do I add this bundled product to my quote?
As an aside, I did notice that some answers to questions about bundled products on this site have bundle_option
as a part of the Varien_Object
. However, the way I have my bundled product set up - the bundle actually has no user-selectable options - means I can skip that field.