Tag 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

GZIP Compression

When a user hits your website a call is made to your server to deliver the requested files.

The bigger these files are the longer it’s going to take for them to get to your browser and appear on the screen.

Gzip compresses your webpages and style sheets before sending them over to the browser. This drastically reduces transfer time since the files are much smaller.

In terms of cost versus benefit, gzip compression should be near the top of your page speed optimizations if you don’t have it setup already.

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