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?

3 REPLIES 3

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

Hi @gkrauthamer,

 

Is it possible for you to share the custom code?

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.

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

Hi @gkrauthamer,

 

That file seems to be part of a custom module or a 3rd-party extension.

Is hard to know/understand why is failing.

Maybe you can show the layout definition?