*/ class Mage_Rss_Block_Wishlist extends Mage_Wishlist_Block_Abstract { /** * Customer instance * * @var Mage_Customer_Model_Customer */ protected $_customer; /** * Default MAP renderer type * * @var string */ protected $_mapRenderer = 'msrp_rss'; /** * Retrieve Wishlist model * * @return Mage_Wishlist_Model_Wishlist */ protected function _getWishlist() { if (is_null($this->_wishlist)) { $this->_wishlist = Mage::getModel('wishlist/wishlist'); $wishlistId = $this->getRequest()->getParam('wishlist_id'); if ($wishlistId) { $this->_wishlist->load($wishlistId); if ($this->_wishlist->getCustomerId() != $this->_getCustomer()->getId()) { $this->_wishlist->unsetData(); } } else { if($this->_getCustomer()->getId()) { $this->_wishlist->loadByCustomer($this->_getCustomer()); } } } return $this->_wishlist; } /** * Retrieve Customer instance * * @return Mage_Customer_Model_Customer */ protected function _getCustomer() { if (is_null($this->_customer)) { $this->_customer = Mage::getModel('customer/customer'); $params = Mage::helper('core')->urlDecode($this->getRequest()->getParam('data')); $data = explode(',', $params); $cId = abs(intval($data[0])); if ($cId && ($cId == Mage::getSingleton('customer/session')->getCustomerId()) ) { $this->_customer->load($cId); } } return $this->_customer; } /** * Build wishlist rss feed title * * @return string */ protected function _getTitle() { return Mage::helper('rss')->__('%s\'s Wishlist', $this->_getCustomer()->getName()); } /** * Render block HTML * * @return string */ protected function _toHtml() { /* @var $rssObj Mage_Rss_Model_Rss */ $rssObj = Mage::getModel('rss/rss'); if ($this->_getWishlist()->getId()) { $newUrl = Mage::getUrl('wishlist/shared/index', array( 'code' => $this->_getWishlist()->getSharingCode() )); $title = $this->_getTitle(); $lang = Mage::getStoreConfig('general/locale/code'); $rssObj->_addHeader(array( 'title' => $title, 'description' => $title, 'link' => $newUrl, 'charset' => 'UTF-8', 'language' => $lang )); /** @var $wishlistItem Mage_Wishlist_Model_Item*/ foreach ($this->getWishlistItems() as $wishlistItem) { /* @var $product Mage_Catalog_Model_Product */ $product = $wishlistItem->getProduct(); $productUrl = $this->getProductUrl($product); $product->setAllowedInRss(true); $product->setAllowedPriceInRss(true); $product->setProductUrl($productUrl); $args = array('product' => $product); Mage::dispatchEvent('rss_wishlist_xml_callback', $args); if (!$product->getAllowedInRss()) { continue; } $description = '