Magento provides a convenient mechanism for the detection and redirection of the user if they’re not enabled. Magento’s preDispatch() method in Mage_Core_Controller_Varien_Action is responsible for this functionality where the current action name is compared against the _cookieCheckActions and the user is redirected if necessary.
To add particular actions to the cookie check, simply add them to the _cookieCheckActions array in the controller’s preDispatch method:
<?php public function preDispatch() { $this->_cookieCheckActions[] = 'index'; $this->_cookieCheckActions[] = 'guest'; parent::preDispatch(); }
And voilĂ , the user will be redirected to the enable cookies page!