Does anyone know if there is a method to tell the system to not Full Page Cache a specific store or website? And just to be clear, using EE FPC out of the box.
1 Answer
In system.xml
create config value which can be configurable per store view:
<enabled translate="label">
<label>Enable FPC</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>10</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</enabled>
Do not forget to set default value for it in config.xml
to 1.
Than in the <frontend>
section register observer on controller_action_predispatch
event:
<events>
<controller_action_predispatch>
<observers>
<namespace_module>
<class>namespace_module/observer</class>
<method>processPreDispatch</method>
</namespace_module>
</observers>
</controller_action_predispatch>
</events>
Now create observer with processPreDispatch
method where you can check config value and disable FPC.
public function processPreDispatch(Varien_Event_Observer $observer)
{
if (!Mage::getStoreConfigFlag('path/to/enabled')) {
// Tell Magento to 'ban' the use of FPC for current sore view
$cache = Mage::app()->getCacheInstance()->banUse('full_page');
}
}
Clear all cache types.