Tips for Magento site speed up

Tips for Magento site speed up Summary:

  • Enable all Magento caching layers.
  • Configure your web server to enable Connection Keep-Alive, enable mod_expire, gzip compression.
  • Enable MySQL Query caching.
  • Install APC or XCache to cache PHP opcode.
  • Install Memcache and configure Magento to store session and cache to memory.
  • Install third-party Full Page Cache Magento extension.
  • Install Varnish cache server for full page caching on system layer.

Getting The Amount Of Items in the Cart in Magento

To get the amount of line items (i.e. 10 of 1 product is 1):


To get the total number of items (i.e. 10 of 1 product is 10):


How to show maintenance mode page in magento (website under construction)

If you want your Magento website to show in maintenance mode, you will have to do two things.
1. Create a file name maintenance.flag in your magento root directory. Contents under this file doesn’t matter, you can keep it empty.
2. Change the maintenance file (located in magento root -> errors -> default directory) to show proper message when user visits your website.

How to join EAV collection with Flat table in Magento

Joining tables in Magento when it comes to EAV with Flat table is quite complicated. Consider you want to join sales_flat_order table with customer EAV tables to get Customer’s firstname and lastname, it becomes difficult as customer’s name comes from customer_entity_varchar table.
Here is code for customer EAV to get customer’s full name in the collection along with all the order details.

$value = Mage::getModel('sales/order')->getCollection();
$fn = Mage::getModel('eav/entity_attribute')->loadByCode('1', 'firstname');
$ln = Mage::getModel('eav/entity_attribute')->loadByCode('1', 'lastname');
    ->join(array('ce1' => 'customer_entity_varchar'), 'ce1.entity_id=main_table.customer_id', array('firstname' => 'value'))
    ->join(array('ce2' => 'customer_entity_varchar'), 'ce2.entity_id=main_table.customer_id', array('lastname' => 'value'))
    ->columns(new Zend_Db_Expr("CONCAT(`ce1`.`value`, ' ',`ce2`.`value`) AS fullname"));

Click Here to know more

Add New Custom Page Layout in Magento 1.7

Here is the Solution for adding New Custom Page Layout in Magento.
You have to create one Module for this Extra Custom Layout.

1. Create Your Module File called Love_Home.xml in app/etc/modules

Insert the following code into the file:

<?xml version="1.0"?>

2. Now create Config File of your Module called config.xml and put this file in the Following directory Structure.


Insert the following code into the file:

<?xml version="1.0" encoding="UTF-8"?>
<love_home module="page" translate="label">
<label>Home Layout</label>

3. Now you have to create Template File of your Module called home.phtml and put this file in the Following directory Structure.


Write Your Code Here... For Example

<h1><?php echo "New Custom Page Layout Successfully Created.";?></h1>

4. Finally go to CMS->Pages->Home Page->Design. You can see your New additional Custom Layout in dropdown.

Now Select "Home Layout" and Press Save Page.