Category Archives: Magento

Object Relational Mapping

ORM(for Object Relational Mapping) is a programming technique used to convert different types of data to Objects and vice versa.

In Magento, ORM is shown as Model which further breaks down to two types of Models – Simple and EAV.

All Magento Models interacting with database are inherited from Mage_Core_Model_Abstract class, which is further inherited from Varien_Object.

Difference between two Models is, Simple Model is inherited from Mage_Core_Model_Resource_Db_Abstract class,
while EAV is inherited from Mage_Eav_Model_Entity_Abstract.

Share

How Magento MVC Works

  1. When Magento website receive a request,it will be intercepted by index.php file
  2. Index.php will instantiates magento application
  3. Magento application will instantiates Front Controller Object
  4. Front controller object will instantiates Router objects (speciafied in config.xml files.global tag)
  5. Router object check for the frontname in modules
  6. If any match is found corresponding controller function will be called
  7. Controller function can instantiates layout object that calls blocks at the same time it can communicate with model functions too.
  8. Block also can communicate with models which defines business logic + database operation
  9. Block will decide the phtml file to be loaded and phtml file displays output for the URL requested.
Share

Get disabled products Magento

$products = Mage::getModel(‘catalog/product’)->getCollection()
->addAttributeToSelect(‘*’)
->addFieldToFilter(‘status’,Mage_Catalog_Model_Product_Status::STATUS_DISABLED);

$products->load();

foreach($products as $product) {
echo $product->getData(‘sku’).”<br />”;
}

Share