Mage_Rss_Block_List Class Reference

Inheritance diagram for Mage_Rss_Block_List:

Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 getRssFeeds ()
 addRssFeed ($url, $label, $param=array(), $customerGroup=false)
 resetRssFeed ()
 getCurrentStoreId ()
 getCurrentCustomerGroupId ()
 getRssCatalogFeeds ()
 getRssMiscFeeds ()
 NewProductRssFeed ()
 SpecialProductRssFeed ()
 SalesRuleProductRssFeed ()
 CategoriesRssFeed ()

Public Attributes

const XML_PATH_RSS_METHODS = 'rss'

Protected Attributes

 $_rssFeeds = array()


Detailed Description

Definition at line 34 of file List.php.


Member Function Documentation

addRssFeed ( url,
label,
param = array(),
customerGroup = false 
)

Add new rss feed

Parameters:
string $url
string $label
Returns:
Mage_Core_Helper_Abstract

Definition at line 58 of file List.php.

00059     {
00060         $param = array_merge($param, array('store_id' => $this->getCurrentStoreId()));
00061         if ($customerGroup) {
00062             $param = array_merge($param, array('cid' => $this->getCurrentCustomerGroupId()));
00063         }
00064 
00065         $this->_rssFeeds[] = new Varien_Object(
00066             array(
00067                 'url'   => Mage::getUrl($url, $param),
00068                 'label' => $label
00069             )
00070         );
00071         return $this;
00072     }

CategoriesRssFeed (  ) 

Definition at line 163 of file List.php.

00164     {
00165         $path = self::XML_PATH_RSS_METHODS.'/catalog/category';
00166         if((bool)Mage::getStoreConfig($path)){
00167             $category = Mage::getModel('catalog/category');
00168 
00169             /* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */
00170             $treeModel = $category->getTreeModel()->loadNode(Mage::app()->getStore()->getRootCategoryId());
00171             $nodes = $treeModel->loadChildren()->getChildren();
00172 
00173             $nodeIds = array();
00174             foreach ($nodes as $node) {
00175                 $nodeIds[] = $node->getId();
00176             }
00177 
00178             $collection = $category->getCollection()
00179                 ->addAttributeToSelect('url_key')
00180                 ->addAttributeToSelect('name')
00181                 ->addAttributeToSelect('is_anchor')
00182                 ->addAttributeToFilter('is_active',1)
00183                 ->addIdFilter($nodeIds)
00184                 ->addAttributeToSort('name')
00185                 ->load();
00186 
00187             foreach ($collection as $category) {
00188                 $this->addRssFeed('rss/catalog/category', $category->getName(),array('cid'=>$category->getId()));
00189             }
00190         }
00191     }

getCurrentCustomerGroupId (  ) 

Definition at line 84 of file List.php.

00085     {
00086         return Mage::getSingleton('customer/session')->getCustomerGroupId();
00087     }

getCurrentStoreId (  ) 

Definition at line 79 of file List.php.

00080     {
00081         return Mage::app()->getStore()->getId();
00082     }

getRssCatalogFeeds (  ) 

Retrieve rss catalog feeds

array structure:

Returns:
array

Definition at line 96 of file List.php.

00097     {
00098         $this->resetRssFeed();
00099         $this->CategoriesRssFeed();
00100         return $this->getRssFeeds();
00101 
00102 /*      $section = Mage::getSingleton('adminhtml/config')->getSections();
00103         $catalogFeeds = $section->rss->groups->catalog->fields[0];
00104         $res = array();
00105         foreach($catalogFeeds as $code => $feed){
00106             $prefix = self::XML_PATH_RSS_METHODS.'/catalog/'.$code;
00107             if (!Mage::getStoreConfig($prefix) || $code=='tag') {
00108                 continue;
00109             }
00110             $res[$code] = $feed;
00111         }
00112         return $res;
00113 */
00114     }

getRssFeeds (  ) 

Retrieve rss feeds

Returns:
array

Definition at line 46 of file List.php.

00047     {
00048         return empty($this->_rssFeeds) ? false : $this->_rssFeeds;
00049     }

getRssMiscFeeds (  ) 

Definition at line 116 of file List.php.

00117     {
00118         $this->resetRssFeed();
00119         $this->NewProductRssFeed();
00120         $this->SpecialProductRssFeed();
00121         $this->SalesRuleProductRssFeed();
00122         return $this->getRssFeeds();
00123     }

NewProductRssFeed (  ) 

Definition at line 139 of file List.php.

00140     {
00141         $path = self::XML_PATH_RSS_METHODS.'/catalog/new';
00142         if((bool)Mage::getStoreConfig($path)){
00143             $this->addRssFeed($path, $this->__('New Products'));
00144         }
00145     }

resetRssFeed (  ) 

Definition at line 74 of file List.php.

00075     {
00076         $this->_rssFeeds=array();
00077     }

SalesRuleProductRssFeed (  ) 

Definition at line 155 of file List.php.

00156     {
00157         $path = self::XML_PATH_RSS_METHODS.'/catalog/salesrule';
00158         if((bool)Mage::getStoreConfig($path)){
00159             $this->addRssFeed($path, $this->__('Coupons/Discounts'),array(),true);
00160         }
00161     }

SpecialProductRssFeed (  ) 

Definition at line 147 of file List.php.

00148     {
00149         $path = self::XML_PATH_RSS_METHODS.'/catalog/special';
00150         if((bool)Mage::getStoreConfig($path)){
00151             $this->addRssFeed($path, $this->__('Special/Discount Products'),array(),true);
00152         }
00153     }


Member Data Documentation

$_rssFeeds = array() [protected]

Definition at line 38 of file List.php.

const XML_PATH_RSS_METHODS = 'rss'

Definition at line 36 of file List.php.


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