1

I have dynamic content in my block which is cached so I exclude this block from cache in the easiest way. I've created cache.xml which looks like:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <placeholders>
         <my_category_view>
            <block>catalog/category_view</block>
            <placeholder>MY_CATEGORY_VIEW</placeholder>
            <container>Custom_Package_Model_Container_Category_View</container>
            <cache_lifetime>86400</cache_lifetime>
        </my_category_view>
    </placeholders>
</config>

and i've created container:

class My_Package_Model_Container_Category_View extends
  My_Page_Model_Container_Abstract
    {
           const PREFIX = 'MY_CATEGORY_VIEW';
    }

and it works great. the block is excluded from FPC, but the problem is that after refreshing the page I've got exception.

Fatal error: Call to a member function getChild() on a non-object

in this line:

$platform_filter=$this->getLayout()->getBlock('enterprisecatalog.leftnav')->getChild('platform_filter');

any idea how to fix that? I've spent 2 days on it and still cannot resolve it.

  • Good luck, would love to know your solution or anyone else who can help answer. – camdixon Nov 25 '16 at 14:24
0

I resolved this problem this way. I created the observer which exclude category view from FPC. It's not the best way because I needed only to exclude one block from this view but it works...

My observer:

class MyCompany_Catalog_Model_Observer
{
    public function processPreDispatch(Varien_Event_Observer $observer) {
        $action = $observer->getEvent()->getControllerAction();

        if ($action->getFullActionName() === 'catalog_category_view') {
            $cache = Mage::app()->getCacheInstance();         
            $cache->banUse('full_page');
        }
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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