Skip to content

Instantly share code, notes, and snippets.

@tiagones
Last active September 4, 2018 15:45
Show Gist options
  • Save tiagones/19c42c34120968564218f58c14d5667d to your computer and use it in GitHub Desktop.
Save tiagones/19c42c34120968564218f58c14d5667d to your computer and use it in GitHub Desktop.
Get and print the page type of a Magento page layout.
<?php
//Identify the page type
$pageIdentifier = Mage::app()->getFrontController()->getAction()->getFullActionName();
echo $pageIdentifier;
?>
<!-- Do something if on the specific page you need -->
<?php if(Mage::getBlockSingleton('page/html_header')->getIsHomePage()): ?>
home page
<?php elseif(Mage::app()->getRequest()->getRouteName()=='cms'): ?>
cms page
<?php elseif($this->getRequest()->getControllerName()=='product'): ?>
product page
<?php elseif($this->getRequest()->getControllerName()=='category'): ?>
category page
<?php elseif(Mage::app()->getRequest()->getRouteName()=='checkout'): ?>
checkout page
<?php elseif(Mage::app()->getRequest()->getRouteName()=='onestepcheckout'): ?>
onestepcheckout page
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment