title: Magento get current product
body: <p>I have a magento 1.7.0.2 , with varnish cache. I am trying to create an uncached block and to get the current product id on product view page, however neither <code>Mage::registry('current_product')-&gt;getId();</code> , nor <code>$this-&gt;getProduct()-&gt;getId();</code> seems to be working. My custom block looks like this, in catalog.xml :</p>
  
  <pre><code>        &lt;catalog_product_view translate="label"&gt;
          ...
            &lt;reference name="content"&gt;
            ...
              &lt;block type="catalog/product_view" name="product.info.frz" template="catalog/product/view/frz.phtml"&gt;
                  &lt;action method="setEsiOptions"&gt;
                      &lt;params&gt;
                          &lt;method&gt;ajax&lt;/method&gt;
                          &lt;access&gt;private&lt;/access&gt;
                      &lt;/params&gt;
                  &lt;/action&gt;
              &lt;/block&gt;
            ...
            &lt;/reference&gt;
          ...
          &lt;/catalog_product_view&gt;
  </code></pre>
  
  <p>And I am displaying the block in product/view.phtml with 
  <code>&lt;?php echo $this-&gt;getChildHtml('product.info.frz'); ?&gt;</code>
  Everything is working fine and the block doesnt get cached. However, when I'm trying to get the current product id , I get <code>PHP message: PHP Fatal error:  Call to a member function getId() on a non-object</code>. </p>
  
  <p>From what I know, <code>Mage::registry('current_product')-&gt;getId();</code> should work on catalog/navigation blocks. Can you please poing me in the right direction ? What am I doing wrong ?</p>
  
  <p>Thank you.</p>