First, I overwrote how configurable products are added to the wishlist. The parameters for the configured child are stripped and they then replace the configurable product itself to emulate a simple product.
<?php
require_once(Mage::getModuleDir('controllers', 'Enterprise_Wishlist') . DS . 'IndexController.php');
class nameSpace_Wishlist_IndexController extends Enterprise_Wishlist_IndexController
{
public function addAction()
{
$productId = (int)$this->getRequest()->getparam('product');
$product = Mage::getModel('catalog/product')->load($productId);
if ($product->getTypeId() == 'configurable') {
$params = $this->getRequest()->getParams();
$child = $product->getTypeInstance(true)->getProductByAttributes($params['super_attribute'], $product);
$product = Mage::getModel('catalog/product')->load($child->getId());
$this->getRequest()->setParam('product', $product->getId());
if (isset($_POST['super_attribute'])) {
unset($_POST['super_attribute']);
}
}
$customerId = $this->_getSession()->getCustomerId();
$name = $this->getRequest()->getParam('name');
$visibility = ($this->getRequest()->getParam('visibility', 0) === 'on' ? 1 : 0);
if ($name !== null) {
try {
$wishlist = $this->_editWishlist($customerId, $name, $visibility);
$this->_getSession()->addSuccess(
Mage::helper('enterprise_wishlist')->__('Wishlist "%s" was successfully saved', Mage::helper('core')->escapeHtml($wishlist->getName())));
$this->getRequest()->setParam('wishlist_id', $wishlist->getId());
} catch (Mage_Core_Exception $e) {
$this->_getSession()->addError($e->getMessage());
} catch (Exception $e) {
$this->_getSession()->addException($e, Mage::helper('enterprise_wishlist')->__('Error happened during wishlist creation'));
}
}
if (!$this->_validateFormKey()) {
return $this->_redirect('*/*');
}
$this->_addItemToWishList();
}
}
Then, I overwrote the wishlist model getItemCollection method to include 'invisible' products in the item collection. This took care of the issue where other products would overwrite the position of the configured 'invisible' product in the data structure.
class nameSpace_Wishlist_Model_Wishlist extends Mage_Wishlist_Model_Wishlist
{
public function getItemCollection()
{
if (is_null($this->_itemCollection)) {
/** @var $currentWebsiteOnly boolean */
$currentWebsiteOnly = !Mage::app()->getStore()->isAdmin();
$this->_itemCollection = Mage::getResourceModel('wishlist/item_collection')
->addWishlistFilter($this)
->addStoreFilter($this->getSharedStoreIds($currentWebsiteOnly));
if (Mage::app()->getStore()->isAdmin()) {
$customer = Mage::getModel('customer/customer')->load($this->getCustomerId());
$this->_itemCollection->setWebsiteId($customer->getWebsiteId());
$this->_itemCollection->setCustomerGroupId($customer->getGroupId());
}
}
return $this->_itemCollection;
}
}