Public Member Functions | |
getTags () | |
getMaxPopularity () | |
getMinPopularity () | |
Protected Member Functions | |
_loadTags () | |
Protected Attributes | |
$_tags | |
$_minPopularity | |
$_maxPopularity |
Definition at line 35 of file Tags.php.
_loadTags | ( | ) | [protected] |
Definition at line 41 of file Tags.php.
00042 { 00043 if (empty($this->_tags)) { 00044 $this->_tags = array(); 00045 00046 $tags = Mage::getResourceModel('tag/tag_collection') 00047 ->addPopularity() 00048 ->setOrder('popularity', 'DESC') 00049 #->addStatusFilter(Mage_Tag_Model_Tag::STATUS_APPROVED) 00050 ->addCustomerFilter(Mage::getSingleton('customer/session')->getCustomerId()) 00051 ->setActiveFilter() 00052 ->load() 00053 ->getItems(); 00054 } else { 00055 return; 00056 } 00057 00058 if( isset($tags) && count($tags) == 0 ) { 00059 return; 00060 } 00061 00062 $this->_maxPopularity = reset($tags)->getPopularity(); 00063 $this->_minPopularity = end($tags)->getPopularity(); 00064 $range = $this->_maxPopularity - $this->_minPopularity; 00065 $range = ( $range == 0 ) ? 1 : $range; 00066 00067 foreach ($tags as $tag) { 00068 $tag->setRatio(($tag->getPopularity()-$this->_minPopularity)/$range); 00069 $this->_tags[$tag->getName()] = $tag; 00070 } 00071 ksort($this->_tags); 00072 }
getMaxPopularity | ( | ) |
getMinPopularity | ( | ) |
getTags | ( | ) |