Public Member Functions | |
getTags () | |
getMaxPopularity () | |
getMinPopularity () | |
Protected Member Functions | |
_loadTags () | |
_toHtml () | |
Protected Attributes | |
$_tags | |
$_minPopularity | |
$_maxPopularity |
Definition at line 35 of file Popular.php.
_loadTags | ( | ) | [protected] |
Definition at line 42 of file Popular.php.
00043 { 00044 if (empty($this->_tags)) { 00045 $this->_tags = array(); 00046 00047 $tags = Mage::getModel('tag/tag')->getPopularCollection() 00048 ->joinFields(Mage::app()->getStore()->getId()) 00049 ->limit(20) 00050 ->load() 00051 ->getItems(); 00052 00053 if( count($tags) == 0 ) { 00054 return $this; 00055 } 00056 00057 00058 $this->_maxPopularity = reset($tags)->getPopularity(); 00059 $this->_minPopularity = end($tags)->getPopularity(); 00060 $range = $this->_maxPopularity - $this->_minPopularity; 00061 $range = ( $range == 0 ) ? 1 : $range; 00062 foreach ($tags as $tag) { 00063 if( !$tag->getPopularity() ) { 00064 continue; 00065 } 00066 $tag->setRatio(($tag->getPopularity()-$this->_minPopularity)/$range); 00067 $this->_tags[$tag->getName()] = $tag; 00068 } 00069 ksort($this->_tags); 00070 } 00071 return $this; 00072 }
_toHtml | ( | ) | [protected] |
Render block HTML
Reimplemented from Mage_Core_Block_Template.
Definition at line 90 of file Popular.php.
00091 { 00092 if (count($this->getTags()) > 0) { 00093 return parent::_toHtml(); 00094 } 00095 return ''; 00096 }
getMaxPopularity | ( | ) |
getMinPopularity | ( | ) |
getTags | ( | ) |
Definition at line 74 of file Popular.php.
00075 { 00076 $this->_loadTags(); 00077 return $this->_tags; 00078 }
$_maxPopularity [protected] |
Definition at line 40 of file Popular.php.
$_minPopularity [protected] |
Definition at line 39 of file Popular.php.
$_tags [protected] |
Definition at line 38 of file Popular.php.