Get Max id from table in Zend Framework

All aggregate function are like an expression for zend framework. So we need to call them by using an instance of Zend_Db_Expr($expr). To get max id from table in zend framework is an simple example for this as explained below. For example If you want to get max id of the table you need to use new Zend_Db_Expr(‘MAX(id) as id’). $this->getMaxId(); will return a max id of the table. Hope …

Continue reading

Useful Collection Functions of Magento

There are many different useful functions that you can implement in your Collection class. These functions are described in Varien_Data_Collection_Db class. This class file is in lib/Varien/Data/Collection/Db.php Here i am listing some important collection functions that you can use in your collection class: To get Zend_Db_Select instance To get select string of sql object To get the size of collection To get distinct selection To get all data array for …

Continue reading

Magento Static Functions

When you open up app/Mage.php, you’ll see that the class declaration of Mage is final. The ‘final’ keyword prevents this class from being overridden. And you’ll see that every function is a magento static function, for example: public static function getVersion(). A static function means that you do not need to instantiate the class to use the method. I will listed out some of most useful methods available here. If …

Continue reading