public function addItem(Mage_Wishlist_Model_Item $item)
{
$superAttributes = Mage::app()->getRequest()->getParam('super_attribute');
if ($item instanceof Mage_Wishlist_Model_Item && isset($superAttributes)) {
$simpleItem = Mage::getModel('catalog/product_type_configurable')->getProductByAttributes($superAttributes, $item->getProduct());
}
return parent::addItem($simpleItem);
}
Now my problem is that i want to call the parent function which needs to receive an Mage_Wishlist_Model_Item
not a Mage_Catalog_Model_Product
MyCustom_Wishlist_Model_Wishlist extends Mage_Wishlist_Model_Wishlist
How can i get the wishlistitem for the Product $simpleItem
2
Answers
This works for me now but i didn't figure out how to set the
$qty
yetHave you checked this URL?
https://magento.stackexchange.com/questions/19678/how-do-i-add-to-wishlist-programatically
It’s the native way to add a product to wishlist.
If you don’t want to change the parameter type then you may remove the $item type check from your code (it’s not necessary):
Hope it helps you.