0

Id like to make this work inside themeName/template/page/html/head.phtml

<?php echo $_product->getId()

I'm trying to add a script in head section and it requires productID, but it only works inside catalog/product.

Is there a way to make it work in head section?

Cleyton
  • 2,338
  • 6
  • 23
  • 39

1 Answers1

3

Try

if($_product = Mage::registry('current_product')){
   echo $_product->getId()
}

See Magento - Passing data between a controller and a block

Community
  • 1
  • 1
MagePal Extensions
  • 17,646
  • 2
  • 47
  • 62