Skip to main content
deleted 16 characters in body
Source Link
Anshu Mishra
  • 9k
  • 7
  • 41
  • 88

For some reason I want to disable Full Page Cache for CMScategory pages including Home Page.  
I have created my custom module for this but some reason it is not working.
config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Custom_HeaderFix>
            <version>1.0.0</version>
        </Custom_HeaderFix>
    </modules>
    <global>
        <models>
            <headerFix>
                <class>Custom_HeaderFix_Model</class>
            </headerFix>
        </models>
    </global>
    <frontend>
        <events>
            <controller_action_predispatch>
                <observers>
                    <headerCache>
                        <type>singleton</type>
                        <class>headerFix/observer</class>
                        <method>processPreDispatch</method>
                    </headerCache>
                </observers>
            </controller_action_predispatch>
        </events>
    </frontend>
</config>

**Observer.php**
<?php

class Custom_HeaderFix_Model_Observer {

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

        if ($action instanceof Mage_Catalog_CategoryController) {
        $cache = Mage::app()->getCacheInstance();

        // Tell Magento to 'ban' the use of FPC for this request
        $cache->banUse('full_page');
        }
    }

}

I have used similar code for disabling FPC from home page and that worked.

For some reason I want to disable Full Page Cache for CMS pages including Home Page.  
I have created my custom module for this but some reason it is not working.
config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Custom_HeaderFix>
            <version>1.0.0</version>
        </Custom_HeaderFix>
    </modules>
    <global>
        <models>
            <headerFix>
                <class>Custom_HeaderFix_Model</class>
            </headerFix>
        </models>
    </global>
    <frontend>
        <events>
            <controller_action_predispatch>
                <observers>
                    <headerCache>
                        <type>singleton</type>
                        <class>headerFix/observer</class>
                        <method>processPreDispatch</method>
                    </headerCache>
                </observers>
            </controller_action_predispatch>
        </events>
    </frontend>
</config>

**Observer.php**
<?php

class Custom_HeaderFix_Model_Observer {

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

        if ($action instanceof Mage_Catalog_CategoryController) {
        $cache = Mage::app()->getCacheInstance();

        // Tell Magento to 'ban' the use of FPC for this request
        $cache->banUse('full_page');
        }
    }

}

I have used similar code for disabling FPC from home page and that worked.

For some reason I want to disable Full Page Cache for category pages.
I have created my custom module for this but some reason it is not working.
config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Custom_HeaderFix>
            <version>1.0.0</version>
        </Custom_HeaderFix>
    </modules>
    <global>
        <models>
            <headerFix>
                <class>Custom_HeaderFix_Model</class>
            </headerFix>
        </models>
    </global>
    <frontend>
        <events>
            <controller_action_predispatch>
                <observers>
                    <headerCache>
                        <type>singleton</type>
                        <class>headerFix/observer</class>
                        <method>processPreDispatch</method>
                    </headerCache>
                </observers>
            </controller_action_predispatch>
        </events>
    </frontend>
</config>

**Observer.php**
<?php

class Custom_HeaderFix_Model_Observer {

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

        if ($action instanceof Mage_Catalog_CategoryController) {
        $cache = Mage::app()->getCacheInstance();

        // Tell Magento to 'ban' the use of FPC for this request
        $cache->banUse('full_page');
        }
    }

}

I have used similar code for disabling FPC from home page and that worked.

Source Link
Anshu Mishra
  • 9k
  • 7
  • 41
  • 88

Disable Full Page Cache from category Pages

For some reason I want to disable Full Page Cache for CMS pages including Home Page.
I have created my custom module for this but some reason it is not working.
config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Custom_HeaderFix>
            <version>1.0.0</version>
        </Custom_HeaderFix>
    </modules>
    <global>
        <models>
            <headerFix>
                <class>Custom_HeaderFix_Model</class>
            </headerFix>
        </models>
    </global>
    <frontend>
        <events>
            <controller_action_predispatch>
                <observers>
                    <headerCache>
                        <type>singleton</type>
                        <class>headerFix/observer</class>
                        <method>processPreDispatch</method>
                    </headerCache>
                </observers>
            </controller_action_predispatch>
        </events>
    </frontend>
</config>

**Observer.php**
<?php

class Custom_HeaderFix_Model_Observer {

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

        if ($action instanceof Mage_Catalog_CategoryController) {
        $cache = Mage::app()->getCacheInstance();

        // Tell Magento to 'ban' the use of FPC for this request
        $cache->banUse('full_page');
        }
    }

}

I have used similar code for disabling FPC from home page and that worked.