
Public Member Functions | |
| addItemCountExpr () | |
| getSelectCountSql () | |
| getAllIds ($limit=null, $offset=null) | |
Protected Member Functions | |
| _construct () | |
Definition at line 34 of file Collection.php.
| _construct | ( | ) | [protected] |
Initialize orders collection
Reimplemented from Mage_Eav_Model_Entity_Collection_Abstract.
Definition at line 40 of file Collection.php.
00041 { 00042 $this->_init('sales/order'); 00043 }
| addItemCountExpr | ( | ) |
Add order items count expression
Definition at line 50 of file Collection.php.
00051 { 00052 $orderTable = $this->getEntity()->getEntityTable(); 00053 $orderItemEntityTypeId = Mage::getResourceSingleton('sales/order_item')->getTypeId(); 00054 $this->getSelect()->join( 00055 array('items'=>$orderTable), 00056 'items.parent_id=e.entity_id and items.entity_type_id='.$orderItemEntityTypeId, 00057 array('items_count'=>new Zend_Db_Expr('COUNT(items.entity_id)')) 00058 ) 00059 ->group('e.entity_id'); 00060 return $this; 00061 }
| getAllIds | ( | $ | limit = null, |
|
| $ | offset = null | |||
| ) |
Retrive all ids for collection
Reimplemented from Mage_Eav_Model_Entity_Collection_Abstract.
Definition at line 80 of file Collection.php.
00081 { 00082 $idsSelect = clone $this->getSelect(); 00083 $idsSelect->reset(Zend_Db_Select::ORDER); 00084 $idsSelect->reset(Zend_Db_Select::LIMIT_COUNT); 00085 $idsSelect->reset(Zend_Db_Select::LIMIT_OFFSET); 00086 $idsSelect->reset(Zend_Db_Select::COLUMNS); 00087 $idsSelect->from(null, 'e.'.$this->getEntity()->getIdFieldName()); 00088 $idsSelect->limit($limit, $offset); 00089 $idsSelect->resetJoinLeft(); 00090 return $this->getConnection()->fetchCol($idsSelect, $this->_bindParams); 00091 }
| getSelectCountSql | ( | ) |
Minimize usual count select
Reimplemented from Varien_Data_Collection_Db.
Definition at line 68 of file Collection.php.
00069 { 00070 $countSelect = parent::getSelectCountSql(); 00071 $countSelect->resetJoinLeft(); 00072 return $countSelect; 00073 }
1.5.8