Mage_Rss_Block_Catalog_Tag Class Reference

Inheritance diagram for Mage_Rss_Block_Catalog_Tag:

Mage_Rss_Block_Abstract Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 addTaggedItemXml ($args)

Protected Member Functions

 _construct ()
 _toHtml ()


Detailed Description

Definition at line 34 of file Tag.php.


Member Function Documentation

_construct (  )  [protected]

Internal constructor, that is called from real constructor

Please override this one instead of overriding real __construct constructor

Please override this one instead of overriding real __construct constructor

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 36 of file Tag.php.

00037     {
00038         /*
00039         * setting cache to save the rss for 10 minutes
00040         */
00041         $this->setCacheKey('rss_catalog_tag_'.$this->getStoreId());
00042         $this->setCacheLifetime(600);
00043     }

_toHtml (  )  [protected]

Render block HTML

Returns:
string

Reimplemented from Mage_Core_Block_Template.

Definition at line 45 of file Tag.php.

00046     {
00047         //store id is store view id
00048         $storeId = $this->_getStoreId();
00049         $tagModel = Mage::registry('tag_model');
00050         $newurl = Mage::getUrl('rss/catalog/new');
00051         $title = Mage::helper('rss')->__('Products tagged with %s', $tagModel->getName());
00052         $lang = Mage::getStoreConfig('general/locale/code');
00053 
00054         $rssObj = Mage::getModel('rss/rss');
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 = $tagModel->getEntityCollection()
00064             ->addTagFilter($tagModel->getId())
00065             ->addStoreFilter($storeId);
00066 
00067         $product = Mage::getModel('catalog/product');
00068 
00069         Mage::getSingleton('core/resource_iterator')
00070                 ->walk($_collection->getSelect(), array(array($this, 'addTaggedItemXml')), array('rssObj'=> $rssObj, 'product'=>$product));
00071 
00072         return $rssObj->createRssXml();
00073     }

addTaggedItemXml ( args  ) 

Definition at line 75 of file Tag.php.

00076     {
00077         $product = $args['product'];
00078         $product->unsetData()->load($args['row']['entity_id']);
00079         $description = '<table><tr>'.
00080         '<td><a href="'.$product->getProductUrl().'"><img src="'. $this->helper('catalog/image')->init($product, 'thumbnail')->resize(75, 75) .'" border="0" align="left" height="75" width="75"></a></td>'.
00081         '<td  style="text-decoration:none;">'.$product->getDescription().
00082         '<p> Price:'.Mage::helper('core')->currency($product->getFinalPrice()).'</p>'.
00083         '</td>'.
00084         '</tr></table>';
00085         $rssObj = $args['rssObj'];
00086         $data = array(
00087                 'title'         => $product->getName(),
00088                 'link'          => $product->getProductUrl(),
00089                 'description'   => $description,
00090 
00091                 );
00092         $rssObj->_addEntry($data);
00093     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:38 2009 for Magento by  doxygen 1.5.8