This is the blog for getting Idea regarding PHP, Magento, jQuery and JavaScript for Customization.

Monday 24 September 2012

Magento : Check current Page is Category page OR Product page

 Here, Determine Product Page [Product Details page] And  Category Page [List Page] and Home Page

<?php

            $this->getRequest()->getControllerName();

            if($this->getRequest()->getControllerName()=='product')
             {
                    //This is Determine Product Details page.
                   //do something
             }
            if($this->getRequest()->getControllerName()=='category')
            {
                   //This is Determine List page.
                 //do others
            }

?>


<?php
      
         if(Mage::getSingleton('cms/page')->getIdentifier() == 'home'  &&
Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms' ) : 

              //This is Determine Home page.
                 //do others

      endif;

?>



No comments:

Post a Comment