Public Member Functions | |
addUniqueTagedCount () | |
addAllTagedCount () | |
addTagedCount () | |
addGroupByProduct () | |
addGroupByTag () | |
addProductFilter ($customerId) | |
setOrder ($attribute, $dir='desc') | |
Protected Member Functions | |
_joinFields () |
Definition at line 35 of file Collection.php.
_joinFields | ( | ) | [protected] |
Join fields process
Reimplemented from Mage_Tag_Model_Mysql4_Product_Collection.
Definition at line 100 of file Collection.php.
00101 { 00102 $tagTable = Mage::getSingleton('core/resource')->getTableName('tag/tag'); 00103 $tagRelationTable = Mage::getSingleton('core/resource')->getTableName('tag/relation'); 00104 $this->addAttributeToSelect('name'); 00105 $this->getSelect() 00106 ->join(array('relation' => $tagRelationTable), "relation.product_id = e.entity_id") 00107 ->join(array('t' => $tagTable), "t.tag_id =relation.tag_id", array( 00108 'tag_id', 'status', 'tag_name' => 'name' 00109 )); 00110 00111 00112 }
addAllTagedCount | ( | ) |
Definition at line 45 of file Collection.php.
00046 { 00047 $this->getSelect() 00048 ->from('', array('taged' => 'count(relation.tag_id)')); 00049 //->order('taged desc'); 00050 return $this; 00051 }
addGroupByProduct | ( | ) |
Definition at line 61 of file Collection.php.
00062 { 00063 $this->getSelect() 00064 ->group('relation.product_id'); 00065 $this->setJoinFlag('distinct'); 00066 return $this; 00067 }
addGroupByTag | ( | ) |
Add group by tag
Reimplemented from Mage_Tag_Model_Mysql4_Product_Collection.
Definition at line 69 of file Collection.php.
00070 { 00071 $this->getSelect() 00072 ->group('relation.tag_id'); 00073 $this->setJoinFlag('distinct'); 00074 $this->setJoinFlag('group_tag'); 00075 return $this; 00076 }
addProductFilter | ( | $ | customerId | ) |
Definition at line 78 of file Collection.php.
00079 { 00080 $this->getSelect() 00081 ->where('relation.product_id = ?', $customerId); 00082 $this->_customerFilterId = $customerId; 00083 return $this; 00084 }
addTagedCount | ( | ) |
Definition at line 53 of file Collection.php.
00054 { 00055 $this->getSelect() 00056 ->from('', array('taged' => 'count(relation.tag_relation_id)')); 00057 //->order('taged desc'); 00058 return $this; 00059 }
addUniqueTagedCount | ( | ) |
Definition at line 37 of file Collection.php.
00038 { 00039 $this->getSelect() 00040 ->from('', array('utaged' => 'count(DISTINCT(relation.tag_id))')); 00041 //->order('taged desc'); 00042 return $this; 00043 }
setOrder | ( | $ | attribute, | |
$ | dir = 'desc' | |||
) |
Set attribute order
string | $attribute | |
string | $dir |
Reimplemented from Mage_Tag_Model_Mysql4_Product_Collection.
Definition at line 88 of file Collection.php.
00089 { 00090 if ($attribute == 'utaged' || $attribute == 'taged' || $attribute == 'tag_name') { 00091 $this->getSelect()->order($attribute . ' ' . $dir); 00092 } else { 00093 parent::setOrder($attribute, $dir); 00094 } 00095 00096 return $this; 00097 }