3

For some reason, whenever a product is added to my wish list it only adds the product. It does not add the selected configurable options (size/color). I know that it should be able to handle the configurable....

Can someone point me in the locations of the files that I should overwrite (with the original magento files)? I might have made a change to some file somewhere and overrode that option. I would very much like to have the configurable options be selectable/required for the wish list.

If that doesn't work then if someone could point me in the direction of an extension that will be separate from the base magento wish list that will accomplish the same thing :)

Thank! Jonathan.

3

Please check file app\code\core\Mage\Wishlist\controllers\IndexController.php, method addAction() and print debug information before lines

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

This code is responsible for adding product to the list and the variable $buyRequest contains custom options and configuration params.

You can also download the corresponding magento version and compare files with, say WinMerge or Diff utilities.

I guess something wrong with the product page template, and configuration data just do not transferred to the wishlist controller.

Also you can have older magento version where this feature is not available.

If you are looking for the module that can create multiple wishists and save product configurations in all magento versions, try this one.

1

Something like this should work for adding products (simple and configurable) to a customer's wishlist.

the $options argument should be an array with the following keys e.g. product='99', qty='1', super_attribute[133]='3'

private function addProductToWishlist($productId, $options) {
   $customer = Mage::getSingleton('customer/session')->getCustomer();
   $wishlist = Mage::getModel('wishlist/wishlist')->loadByCustomer($customer, true);

   $product = Mage::getModel('catalog/product')->load($productId);

   try {
      $buyRequest = new Varien_Object($options);
      $result = $wishlist->addNewItem($product, $buyRequest);

      $wishlist->save();

      Mage::dispatchEvent('wishlist_add_product', array(
         'wishlist'  => $wishlist,
         'product'   => $product,
         'item'      => $result
      ));

      Mage::helper('wishlist')->calculate();

      return $result;

   } catch (Mage_Core_Exception $e) {
      Mage::app()->getResponse()->setHeader('HTTP/1.0','503',true);
   } catch (Exception $e) {
      Mage::app()->getResponse()->setHeader('HTTP/1.0','503',true);
   }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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