I am using Magento's design exceptions to set the theme as mobile for mobile devices.

enter image description here

Since I am not using a separate store view or website, is it possible to provide to the user a 'Switch to Desktop' link? I guess I would need to override a controller somewhere, would appreciate anyone that can help me out with a starting point.

2 Answers 2


The short answer here is no, though, you could drop a javascript cookie called forcedesktop and set it to true. This would be set onclick for the switcher link.

Then rewrite the design exception method to sniff for existence of the cookie:


<?xml version="1.0"?>



class YourCompany_YourModule_Model_Design_Package extends Mage_Core_Model_Design_Package

    protected function _checkUserAgentAgainstRegexps($regexpsConfigPath)
            return false;

  • 1
    will try it out, cheers. Commented Oct 22, 2013 at 4:12
  • This answer is correct, though there is a return missing before the parent::_checkUserAgentAgainstRegexps($regexpsConfigPath);. Otherwhise it would always show the desktop version when the cookie isn't set.
    – Schwierig
    Commented Jan 29, 2014 at 9:05

Earlier this year we put together a quick module to implement this functionality complete with support for use behind the Enterprise Edition FPC. Since then it's been used on a number of sites we've built. When I saw this question posted I decided to polish it up and publish it on GitHub. @philwinkle beat me to posting an answer though... ;) And it does actually use the same basic technique he mentions. I.e. it sets a cookie which is then used to determine if the design exception should be honored or not.

In this case we are using setcookie and $_COOKIE directly for performance and/or compatibility with the FPC processor which EE uses on a cache hit:

class CLS_DesignSwitcher_Model_Core_Design_Package extends Mage_Core_Model_Design_Package
     * Get regex rules from config and check user-agent against them. We override to
     * determine if the design exception should be ignored based on presence of a cookie.
     * @param string $regexpsConfigPath
     * @return mixed
     * @see Mage_Core_Model_Design_Package
    protected function _checkUserAgentAgainstRegexps($regexpsConfigPath)
        $ignoreException = null;
        if (isset($_COOKIE[CLS_DesignSwitcher_Helper_Data::FULL_SITE_COOKIE])) {
            $ignoreException = $_COOKIE[CLS_DesignSwitcher_Helper_Data::FULL_SITE_COOKIE];
        return $ignoreException ? false : parent::_checkUserAgentAgainstRegexps($regexpsConfigPath);

I'll spare posting the full code for it here, but feel free to take it and use it verbatim or alter to suite what you need… You can grab a copy from here: https://github.com/davidalger/CLS_DesignSwitcher.

  • I used CLS_DesignSwitcher...But it shows error like " <b>Fatal error</b>: Class 'Mage_Cls_Designswitcher_Helper_Data' not found " Commented Jan 12, 2016 at 14:51

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.