I found the following code for adding an item to a wishlist with configuration

$wishlist = Mage::getModel('wishlist/wishlist')->loadByCustomer($customerId, true);
$product = Mage::getModel('catalog/product')->load($productId);

//NOTE! I'm not sure this array format is correct so that may be the problem
$buyRequest = new Varien_Object(array('color'=>'blue','size'=>'large')); // any possible options that are configurable and you want to save with the product

$result = $wishlist->addNewItem($product, $buyRequest);

The add to wishlist works successfully, except that either a) the color and size configuration are not stored anywhere, b) they're stored somewhere I don't know or c) they're not correct in syntax. Can someone please narrow this down and clarify?


1 Answer 1


The array to pass the product options in incorrect. You can try like below :

$storeId = Mage::app()->getStore()->getId();
$model = Mage::getModel('catalog/product');
$_product = $model->load($productId);
$params = array('product' => $productId,
        'qty' => 1,
        'store_id' => $storeId,
        'options' => array('optionId'=>'optionValue')
$request = new Varien_Object();
$result = $wishlist->addNewItem($_product, $request);
  • Does the optionId need to correspond to anything database-wise? i.e. to an entity_id in some options_.. table? Jun 25, 2015 at 9:08
  • Also to note, my question is to where the option information is actually stored. Jun 25, 2015 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.