Public Member Functions | |
groupByEmail () | |
addNameToSelect () | |
getSelectCountSql () | |
getAllIds ($limit=null, $offset=null) | |
Protected Member Functions | |
_construct () |
Definition at line 34 of file Collection.php.
_construct | ( | ) | [protected] |
Initialize collection
Reimplemented from Mage_Eav_Model_Entity_Collection_Abstract.
Definition at line 36 of file Collection.php.
00037 { 00038 $this->_init('customer/customer'); 00039 }
addNameToSelect | ( | ) |
Definition at line 52 of file Collection.php.
00053 { 00054 $fields = array(); 00055 foreach (Mage::getConfig()->getFieldset('customer_account') as $code=>$node) { 00056 if ($node->is('name')) { 00057 //$this->addAttributeToSelect($code); 00058 $fields[$code] = $code; 00059 } 00060 } 00061 00062 $expr = 'CONCAT(' 00063 .(isset($fields['prefix']) ? 'IF({{prefix}} IS NOT NULL AND {{prefix}} != "", CONCAT({{prefix}}," "), ""),' : '') 00064 .'{{firstname}}'.(isset($fields['middlename']) ? ',IF({{middlename}} IS NOT NULL AND {{middlename}} != "", CONCAT(" ",{{middlename}}), "")' : '').'," ",{{lastname}}' 00065 .(isset($fields['suffix']) ? ',IF({{suffix}} IS NOT NULL AND {{suffix}} != "", CONCAT(" ",{{suffix}}), "")' : '') 00066 .')'; 00067 00068 $this->addExpressionAttributeToSelect('name', $expr, $fields); 00069 return $this; 00070 }
getAllIds | ( | $ | limit = null , |
|
$ | offset = null | |||
) |
Retrive all ids for collection
Reimplemented from Mage_Eav_Model_Entity_Collection_Abstract.
Definition at line 98 of file Collection.php.
00099 { 00100 $idsSelect = clone $this->getSelect(); 00101 $idsSelect->reset(Zend_Db_Select::ORDER); 00102 $idsSelect->reset(Zend_Db_Select::LIMIT_COUNT); 00103 $idsSelect->reset(Zend_Db_Select::LIMIT_OFFSET); 00104 $idsSelect->reset(Zend_Db_Select::COLUMNS); 00105 $idsSelect->from(null, 'e.'.$this->getEntity()->getIdFieldName()); 00106 $idsSelect->limit($limit, $offset); 00107 $idsSelect->resetJoinLeft(); 00108 00109 return $this->getConnection()->fetchCol($idsSelect, $this->_bindParams); 00110 }
getSelectCountSql | ( | ) |
Get SQL for get record count
Reimplemented from Varien_Data_Collection_Db.
Reimplemented in Mage_Reports_Model_Mysql4_Customer_Collection, Mage_Reports_Model_Mysql4_Tag_Customer_Collection, and Mage_Tag_Model_Mysql4_Customer_Collection.
Definition at line 77 of file Collection.php.
00078 { 00079 $this->_renderFilters(); 00080 00081 $countSelect = clone $this->getSelect(); 00082 $countSelect->reset(Zend_Db_Select::ORDER); 00083 $countSelect->reset(Zend_Db_Select::LIMIT_COUNT); 00084 $countSelect->reset(Zend_Db_Select::LIMIT_OFFSET); 00085 $countSelect->reset(Zend_Db_Select::COLUMNS); 00086 00087 $countSelect->from('', 'COUNT(*)'); 00088 $countSelect->resetJoinLeft(); 00089 00090 return $countSelect; 00091 }
groupByEmail | ( | ) |
Definition at line 41 of file Collection.php.
00042 { 00043 $this->getSelect() 00044 ->from(array('email'=>$this->getEntity()->getEntityTable()), 00045 array('email_count'=>new Zend_Db_Expr('COUNT(email.entity_id)')) 00046 ) 00047 ->where('email.entity_id=e.entity_id') 00048 ->group('email.email'); 00049 return $this; 00050 }