How to differentiate category and product page in magento

Topics focus on Web Developments, Programming, Database, Digital Marketing Tutorials, Code Snippets, SEO, Social Media Marketing and Inspirational articles.

How to differentiate category and product page in magento

How to differentiate category and product page in magento

Here, We will explain How to differentiate category and product page in magento?

The code for category page:

1
2
3
4
5
6
$_category = Mage::registry('current_category');
if ($_category->getId()) {
      // Now the page is a category browsing page.
} else {
      // Now the page is not a category browsing page.
}

The code for product page:

1
2
3
4
5
6
$_product = Mage::registry('current_product');
if ($_product->getId()) {
      // Now the page is a product view page.
} else {
      // Now the page is not a product view page.
}

Add comment


 

Pin It on Pinterest

Share This