How to optimize Magento site

If you enable Gzip compression by changing .htaccess, you can speed up Magento significantly. Assuming that you have Gzip enabled on your server. Uncomment the part of the code in your htaccess file that matches the code below. You uncomment by removing the #.


############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip

     # Insert filter on all content
     SetOutputFilter DEFLATE
     # Insert filter on selected content types only
     AddOutputFilterByType DEFLATE text/html text/plain text/xml
text/css text/javascript

     # Netscape 4.x has some problems...
     BrowserMatch ^Mozilla/4 gzip-only-text/html

     # Netscape 4.06-4.08 have some more problems
     BrowserMatch ^Mozilla/4\.0[678] no-gzip

     # MSIE masquerades as Netscape, but it is fine
     BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

     # Don't compress images
     SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzipdont-vary

     # Make sure proxies don't deliver the wrong content
     Header append Vary User-Agent env=!dont-vary



Copy HTTP Request by Expires Headers
When a customer visits your website for the first time, the site will load lots of HTTP requests. How to minimize these requests? We will use Expires Headers function to save unnecessary HTTP requests for the next visits. Simply add this code to your .htaccess file:


############################################
## Add default Expires header
##http://developer.yahoo.com/performance/rules.html#expires

     ExpiresActive On
     ExpiresDefault "access plus 1 year"


Reduce the file size of images to be uploaded

As far as you know, Magento is used for e-commerce website; therefore, all images on the site particular product images are essential. We need eye-catching images, of course, those are sometimes too big to fully load and time-costing. As a result, it is crucial for a store owner to find out a sensible solution to reduce the file size of images to be uploaded but still restrain the quality of the images. It will be critically helpful to reduce site’s capacity when you run it. We suggest a few feasible tips and directions for this issue. Trust us, it is completely simple and all you need is uploading your images to a system and it will return you re sized ones while the quality is kept. Now you can post similar-quality-shrunk images instead of old stone-sized ones. Below are our tips:
https://tinypng.com/ (PNG images accepted only) http://www.smushit.com/ysmush.it/ (all images accepted)

Turn off unnecessary modules
There are thousands of Modules available in Magento to be used or shelved. For the medium-sized e-commerce website, it is not always necessary to use all these extensions and modules. You need to list all Modules that your system won’t use and turn them off. It helps to improve the site loading time when unused extensions are disabled. Simply go to Admin > System >Configuration> Tab Advanced>Advanced>Disable Modules Output, it shows all available Modules and their status. Select unnecessary modules and disable them.

Utilize Magento Compilation
Magento compilation will collect all functions in one place, which will decrease steadily site loading time up to 25-50% depending on each system. It is a brilliant feature that helps improve the speed of your site. Go to Admin > System > Tools >Compilation, click Run Compilation Process. When the process is done, you can Disable it.

Enable Fat Catalog in Admin panel
This function accelerates products queries and returns time-saving results. Go to Admin >Sytem>Configuration > Catalog: In Frontend section, change 2 values of “Use Flat Catalog Category” and “Use Flat Catalog Product” to Yes:

And remember to Clear cache before it takes effect.
Enable Merge CSS and JS
Magento utilizes a lot of JS and CSS files. Loading each of those files is time-costing, therefore, to minimize the loading time, you can enable Merge function to compress CSS and JS files in one file and it will load at speed of light. Go to Admin >System >Configuration >Developer: Select “JavaScript Settings” and change the value of “Merge JavaScript Files” to Yes. In “CSS Settings”, select Yes for “Merge CSS Files”.

Clean Database Log
A Magento website generates a huge amount of logs, so we need to clear these logs regularly to save space of your database and improve the loading time. Go to Admin > System > Configuration >System: In Log cleaning, select Yes for “Enable Log Cleaning” and enter the time frame for logs saving, eg. 14 days.

When you have applied those above listed solutions, be notified that you need to refresh and enable cache in the Magento back end so that they take effect.
I hope those methods do help you improve the current site loading time. Besides, you can look for some other utilities to enhance your site optimization, for instance:
http://www.magentocommerce.com/magento-connect/gtspeed.html http://www.magentocommerce.com/magento-connect/turpentine-varnish-cache.html http://www.magentocommerce.com/magento-connect/full-page-cache-pro.html
Applying one of these open utilities will partly or mostly accelerate the loading speed of your site, however, be careful as they can conflict with other ready-installed files and make errors in performing your website. Therefore, saving a backup version of your website is always a “lifebuoy” for you before you implement any of those optimizations.

How to check If is home Page in Magento

Check If Home Page Magento If you need to determine if the the current page is the homepage in Magento, the below code works.
<?php
 if(Mage::getSingleton('cms/page')->getIdentifier() == 'home'  && Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms') {
echo 'i am home page';
}
?>

How to show product’s rating any where in Magento

Reviews are another one of numerous excellent features in Magento. Usage of reviews can increase visitors’ trust in your brand, which, in return boosts your sales by a significant amount. Sometimes there is a need for showing star ratings outside the products’ review page. That’s what I’ll be addressing with this article.

The following code snippet works just about anywhere you have a product loaded (or if you know it’s ID) – cart being one of the examples.

How to add custom tabs into Magento Product Page

How to add custom tabs into Magento Product Page The product page is one of the most important parts of your store. That’s why so much attention is paid to make this page look perfect. Tabs is a good way to display a lot of data inside a compact block. It helps to avoid huge scroll bars and also looks much nicer on portable devices. You can find tons of Magento templates with tabs on the product view page and we are going to tell you the easiest way to add them there. All examples are applicable to the default Magento theme, but with practice you can use following methods to customize your own theme. First, go to your store theme folder and find there the following file app/design/frontend/default/yourtheme/layout/catalog.xml. If the file does not exist, you can always copy it from app/design/frontend/base/default/layout/. Note that your own theme can be located within a different path. In the file catalog.xml, find the section:

 

    
       
            product.tierprices
            
            product.info.addtocart
            product.info.addto
         
		

How to add new tab on product view page

After Magento 1.9 has been released people started asking how to handle the product page tabs since the previous method caused different troubles. The reason is in the modern RWD theme, which goes out of the box with Magento 1.9. It uses slightly different method for adding tabs than in the previous versions. So, let's review how you can easily add own tabs on the product page for RWD-based themes in Magento CE 1.9. First of all, let's make our implementations as clean as possible. To avoid copying of unnecessary pieces of code we will make our changes in the layout file that is being used for custom theme's modifications. You can find this file here: app/design/frontend/[theme_package]/[theme]/layout/local.xml There [theme_package] - it's your package's name and [theme] - it's your theme's name. If there's no such file – just create a clean one. Then, paste the following content in the newly created file:
<?xml version="1.0"?> version="1.0"?>

    
        
            
                detailed_info
                The New Tab
            
        
    

In case if this file already exists – just add the content between (including them) inside of node. As you can see, we have added a block with the class 'core/template' (Mage_Core_Block_Template) inside of the group called 'detailed_info'. That group is a built-in templates group for the product page tabs. You can use any name for your tab, just ensure that it's unique ('the_new_tab' in our example). Then, we have assigned the template file for our tab where the tab's content is placed – 'atwix/newtab.phtml'. Finally, we have set the name for our tab using the standard method 'setTitle()', so the name is 'The New Tab'. On the last step, we need to check if our product view template contains the tabs output logic. Open the following file: app/design/frontend/[theme_package]/[theme]/template/catalog/product/view.phtml