Magento showing wrong result for dynamic data in product listing page due to FPC.

If I disable full page cache its showing perfect. I am facing problem to show the wishlist icon on the product listing page. Please suggest me how can I fix that issue, I have tried to fix that issue using magento hole-punching , but unfortunately it did not work.

Same issue I am facing in product details page as well for wishlist icon. If user clicks on the 'add to wish list' button after refreshing that page its again showing the same button instead of 'added to wishlist' due to page cache.

1 Answer 1


You will have to customize full page cache.

Create a simple module.

Create a file called etc/cache.xml

<?xml version="1.0" encoding="UTF-8"?>

Then create a file Model/Container/Cachetest.php

class Namespace_ModuleName_Model_Container_Cachetest extends Enterprise_PageCache_Model_Container_Abstract { 

    protected function _getCacheId()
        return 'CACHE_TEST' . $this->_getIdentifier());

    protected function _getIdentifier()
        return microtime();

    protected function _renderBlock()
        $blockClass = $this->_placeholder->getAttribute('block');
        $template = $this->_placeholder->getAttribute('template');

        $block = new $blockClass;
        return $block->toHtml();

protected function _saveCache($data, $id, $tags = array(), $lifetime = null) { return false; }  


Your Block/Catalog/Product/View/Addto.php

class Namespace_ModuleName_Block_Catalog_Product_View_Addto extends Mage_Catalog_Block_Product_View


Now, template/layout/your_layout.xml

       <reference name="product.info.addto">
           <action method="setTemplate">
           <block type="block_name/catalog_product_view_addto" name="product.info.addto.custom" as="addto_custom" template="your_folder/catalog/product/view/addto_custom.phtml"/>

Make duplicate template/catalog/product/view/addto.phtml file in your template/your_folder/catalog/product/view/addto.phtml and call this function in that <?php echo $this->getChildHtml('addto_custom');?> removing everything else.

Then create another file in that folder called addto_custom.phtml and have all your addto.phtml content.

Now this should turn off your FPC for addto_custom block.


I had a mistake in extends Catalog_Product_View section, it should be Mage_Catalog_Block_Product_View.

  • thanks for your ans. ) I have followed your solution. In details page its taking my template & block for addto.phtml. Model also works fine & cache.xml..But I am getting an error for $_product->getId();, showing is not an object, means in my new block template $_product is null.I think my block is not correct.I have extend it from Mage_Catalog_Block_Product_View, and didn't write anything inside the class like ur post & in config.xml i have used <rewrite>tag for my block class. Plz tell me what to do now !!! Sep 3, 2015 at 18:39
  • Can u add your new template in your qst plez. Sep 3, 2015 at 21:55
  • I also had a mistake in extends Catalog_Product_View section in Block/Catalog/Product/View/Addto.php page, it should be Mage_Catalog_Block_Product_View. Sep 4, 2015 at 0:25
  • my new template is same as core template of rwd theme. Top of the page there is code like <?php $_product = $this->getProduct(); ?> for some certain purpose i have used $product_id = $_product->getId(); after prv line and its showing an error like not an object getId etc for my new block template...If I disable cache its working, & also working in main template as well, somehow for my block when cache is enabled its getting $_product as null. Sep 4, 2015 at 19:33
  • Did u check with correcting extends Mage.... Line too? Sep 4, 2015 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.