There are different important functions that you can implement in your
Collection object. The functions are present in
Varien_Data_Collection_Db class. The class file is present in
lib/Varien/Data/Collection/Db.php
Here are some of the functions that you can use in your collection object:-
$collection ->getSelect(); |
$collection ->getSelect()->getSize(); |
$collection ->getSelect()->getSelectSql(); |
$collection ->getSelect()->setOrder( $field , $direction ); |
$collection ->getSelect()->setOrder( $field , $condition ); |
$collection ->getSelect()->distinct( $flag ); |
$collection ->getSelect()->getData(); |
$collection ->getSelect()->resetData(); |
$collection ->getSelect()->printLogQuery(true, true); |
More functions below:-
Varien_Data_Collection_Db class extends
Varien_Data_Collection class. Here are some more functions present in
Varien_Data_Collection class:-
$collection ->getSelect()->getCurPage(); |
$collection ->getSelect()->getLastPageNumber(); |
$collection ->getSelect()->getPageSize(); |
$collection ->getSelect()->getSize(); |
$collection ->getSelect()->getFirstItem(); |
$collection ->getSelect()->getLastItem(); |
$collection ->getSelect()->getItems(); |
$collection ->getSelect()->clear(); |
You can also use the select functions as present in
Zend_Db_Select class. This class file is present in
lib/Zend/Db/Select.php
Hope this helps. Thanks.
(0) comments