cancel
Showing results for 
Search instead for 
Did you mean: 

Full page cache: $this->getProduct is null with page refresh

Full page cache: $this->getProduct is null with page refresh

Our install will load product pages correctly on initial load, but will give a 500 error in-browser on reload. When this occurs, we see errors such as "Call to a member function getMetaTitle() on null". We have custom PHTML templates that use "$this->getProduct()" to load product data, and we're seeing that this function returns null when the page is reloaded. Would there be any changes we'd need, possibly to layout XML or $this variable declarations in the template, in order to get things loading correctly?

2 REPLIES

Re: Full page cache: $this->getProduct is null with page refresh

Hi @gkrauthamer,

 

Is it possible for you to share the custom code?

--
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"

Re: Full page cache: $this->getProduct is null with page refresh

The file path is:

app/design/frontend/{theme}/default/template/{module}/catalog/product/view/zoom/lightbox.phtml

 

The relevant portion of the code is:

 

<?php
/**
* Magento
*
* NOTICE OF LICENSE
...
/**
* Product media data template
* @see Mage_Review_Block_Product_View_Media
*/
?>
<?php
$_helper = $this->helper('catalog/output');

$_product = $this->getProduct();
?>

 

We see error messages showing $this->getProduct() returning as null after the first page load, which don't get resolved until the full page cache is refreshed.