Public Member Functions | |
addSummary () | |
setOrder ($attribute, $dir='desc') | |
addFieldToFilter ($field, $condition=null) | |
Protected Attributes | |
$_idFieldName = 'link_id' |
Definition at line 35 of file Collection.php.
addFieldToFilter | ( | $ | field, | |
$ | condition = null | |||
) |
Add filtering
Reimplemented from Mage_Eav_Model_Entity_Collection_Abstract.
Definition at line 91 of file Collection.php.
00092 { 00093 if ($field == 'link_title') { 00094 $conditionSql = $this->_getConditionSql('l.title', $condition); 00095 $this->getSelect()->where($conditionSql); 00096 } else { 00097 parent::addFieldToFilter($field, $condition); 00098 } 00099 return $this; 00100 }
addSummary | ( | ) |
Add downloads summary grouping by product
Definition at line 44 of file Collection.php.
00045 { 00046 $this->getSelect() 00047 ->joinInner( 00048 array('d' => $this->getTable('downloadable/link_purchased_item')), 00049 'e.entity_id=d.product_id', 00050 array( 00051 'purchases' => 'd.number_of_downloads_bought', 00052 'downloads' => 'd.number_of_downloads_used' 00053 ) 00054 ) 00055 ->joinInner( 00056 array('l' => $this->getTable('downloadable/link_title')), 00057 'd.link_id=l.link_id', 00058 array('l.link_id') 00059 ) 00060 ->joinLeft( 00061 array('l_store' => $this->getTable('downloadable/link_title')), 00062 $this->getConnection()->quoteInto('l.link_id=l_store.link_id AND l_store.store_id=?',$this->getStoreId()), 00063 array('link_title' => 'IFNULL(l_store.title, l.title)') 00064 ) 00065 ->where('d.number_of_downloads_bought>0 OR d.number_of_downloads_used>0') 00066 ->group('d.link_id'); 00067 00068 return $this; 00069 }
setOrder | ( | $ | attribute, | |
$ | dir = 'desc' | |||
) |
Add sorting
Reimplemented from Mage_Eav_Model_Entity_Collection_Abstract.
Definition at line 76 of file Collection.php.
00077 { 00078 if ($attribute == 'purchases' || $attribute == 'downloads' || $attribute == 'link_title') { 00079 $this->getSelect()->order($attribute . ' ' . $dir); 00080 } else { 00081 parent::setOrder($attribute, $dir); 00082 } 00083 return $this; 00084 }
$_idFieldName = 'link_id' [protected] |