title: Magento - get current product
body: <p>I have a sidebar block in my layout that is being displayed on different pages. </p>
  
  <p>In this block I have a list of products, and I want to select the current product when I'm on a product page.</p>
  
  <p>I'm using :</p>
  
  <pre><code>$current_product = Mage::registry('current_product');
  </code></pre>
  
  <p>to get the current product, but this works only for the first time I'm loading the product page. When I select a different product the code above returns the same value (the first product).</p>
  
  <p>I'm assuming this happens because I'm using Magento cache. What can I do to get the right value?</p>
  
  <p>The same thing happens when I use:</p>
  
  <pre><code>$currentCategory = Mage::registry('current_category');
  </code></pre>
  
  <p>The sidebar block is a navigation template I've added here:
  ..\app\design\frontend\default\mytheme\template\catalog\navigation\page_left.phtml. </p>
  
  <p>I'm adding it to the layout with this XML : </p>
  
  <pre><code>&lt;block type="catalog/navigation" name="left.navigation.block" as="left.navigation.block" template="catalog/navigation/page_left.phtml"/&gt;
  </code></pre>