Protected Member Functions | |
_toHtml () |
Definition at line 34 of file Wishlist.php.
_toHtml | ( | ) | [protected] |
Render block HTML
Reimplemented from Mage_Core_Block_Template.
Definition at line 36 of file Wishlist.php.
00037 { 00038 $descrpt = Mage::helper('core')->urlDecode($this->getRequest()->getParam('data')); 00039 $data = explode(',',$descrpt); 00040 $cid = (int)$data[0]; 00041 00042 $rssObj = Mage::getModel('rss/rss'); 00043 00044 if ($cid) { 00045 $customer = Mage::getModel('customer/customer')->load($cid); 00046 if ($customer && $customer->getId()) { 00047 00048 $wishlist = Mage::getModel('wishlist/wishlist') 00049 ->loadByCustomer($customer, true); 00050 00051 $newurl = Mage::getUrl('wishlist/shared/index',array('code'=>$wishlist->getSharingCode())); 00052 $title = Mage::helper('rss')->__('%s\'s Wishlist',$customer->getName()); 00053 $lang = Mage::getStoreConfig('general/locale/code'); 00054 00055 $data = array('title' => $title, 00056 'description' => $title, 00057 'link' => $newurl, 00058 'charset' => 'UTF-8', 00059 'language' => $lang 00060 ); 00061 $rssObj->_addHeader($data); 00062 00063 $collection = $wishlist->getProductCollection() 00064 ->addAttributeToSelect('url_key') 00065 ->addAttributeToSelect('name') 00066 ->addAttributeToSelect('price') 00067 ->addAttributeToSelect('thumbnail') 00068 ->addAttributeToFilter('store_id', array('in'=> $wishlist->getSharedStoreIds())) 00069 ->load(); 00070 00071 $product = Mage::getModel('catalog/product'); 00072 foreach($collection as $item){ 00073 $product->unsetData()->load($item->getProductId()); 00074 $description = '<table><tr>'. 00075 '<td><a href="'.$item->getProductUrl().'"><img src="' . $this->helper('catalog/image')->init($item, 'thumbnail')->resize(75, 75) . '" border="0" align="left" height="75" width="75"></a></td>'. 00076 '<td style="text-decoration:none;">'. 00077 $product->getDescription(). 00078 '<p> Price:'.Mage::helper('core')->currency($product->getPrice()). 00079 ($product->getPrice() != $product->getFinalPrice() ? ' Special Price:'. Mage::helper('core')->currency($product->getFinalPrice()) : ''). 00080 ($item->getDescription() && $item->getDescription() != Mage::helper('wishlist')->defaultCommentString() ? '<p>Comment: '.$item->getDescription().'<p>' : ''). 00081 '</td>'. 00082 '</tr></table>'; 00083 $data = array( 00084 'title' => $product->getName(), 00085 'link' => $product->getProductUrl(), 00086 'description' => $description, 00087 ); 00088 $rssObj->_addEntry($data); 00089 } 00090 00091 } 00092 00093 } else { 00094 $data = array('title' => Mage::helper('rss')->__('Cannot retrieve the wishlist'), 00095 'description' => Mage::helper('rss')->__('Cannot retrieve the wishlist'), 00096 'link' => Mage::getUrl(), 00097 'charset' => 'UTF-8', 00098 ); 00099 $rssObj->_addHeader($data); 00100 } 00101 return $rssObj->createRssXml(); 00102 }