Skip to main content
Format code
Source Link
David Manners
  • 27.3k
  • 9
  • 76
  • 220

Please use registry variable for this case.

    <?php if (Mage::app()->getFrontController()->getRequest()->getControllerName() == 'category') : 
    if ($_category = Mage::registry('current_category')) :
        $_helper    = Mage::helper('catalog/output');
  ?>
    
?>
    <h1 class="title"><?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?></h1>
        <?php echo $_category->getProductCollection()->getFirstItem()->getName(); ?>
    <?php endif; ?>
    <?php endif ;?>

Please use registry variable for this case.

    <?php if (Mage::app()->getFrontController()->getRequest()->getControllerName() == 'category') : 
    if ($_category = Mage::registry('current_category')) :
$_helper    = Mage::helper('catalog/output');
      
?>
    <h1 class="title"><?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?></h1>
    <?php echo $_category->getProductCollection()->getFirstItem()->getName(); ?>
    <?php endif; ?>
    <?php endif ;?>

Please use registry variable for this case.

<?php if (Mage::app()->getFrontController()->getRequest()->getControllerName() == 'category') : 
    if ($_category = Mage::registry('current_category')) :
        $_helper    = Mage::helper('catalog/output');
?>
        <h1 class="title"><?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?></h1>
        <?php echo $_category->getProductCollection()->getFirstItem()->getName(); ?>
    <?php endif; ?>
<?php endif ;?>
added 51 characters in body
Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239

Please use registry variable for this case.

    <?php if (Mage::app()->getFrontController()->getRequest()->getControllerName() == 'category') : 
    if ($_category = Mage::registry('current_category')) :
$_helper    = Mage::helper('catalog/output');
      
?>
    <h1 class="title"><?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?></h1>
    <?php echo $_category->getProductCollection()->getFirstItem()->getName(); ?>
    <?php endif; ?>
    <?php endif ;?>

Please use registry variable for this case.

<?php if (Mage::app()->getFrontController()->getRequest()->getControllerName() == 'category') : 
if ($_category = Mage::registry('current_category')) :
?>
<h1 class="title"><?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?></h1>
<?php echo $_category->getProductCollection()->getFirstItem()->getName(); ?>
<?php endif; ?>
<?php endif ;?>

Please use registry variable for this case.

    <?php if (Mage::app()->getFrontController()->getRequest()->getControllerName() == 'category') : 
    if ($_category = Mage::registry('current_category')) :
$_helper    = Mage::helper('catalog/output');
      
?>
    <h1 class="title"><?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?></h1>
    <?php echo $_category->getProductCollection()->getFirstItem()->getName(); ?>
    <?php endif; ?>
    <?php endif ;?>
Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239

Please use registry variable for this case.

<?php if (Mage::app()->getFrontController()->getRequest()->getControllerName() == 'category') : 
if ($_category = Mage::registry('current_category')) :
?>
<h1 class="title"><?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?></h1>
<?php echo $_category->getProductCollection()->getFirstItem()->getName(); ?>
<?php endif; ?>
<?php endif ;?>