Seperate Store for Desktop and Handheld Devices

I need to create separate website for handheld devices and desktop. For that I created a module to make an observer for the event of controller_action_predispatch. My config.xml observer snippet is as follows.

<global>
  <events>
    <controller_action_predispatch>
       <observers>
         <Company_Module_Model_Observer>
            <type>singleton</type>
            <class>Company_Module_Model_Observer</class>
            <method>switchStore</method>
         </Company_Module_Model_Observer>
       </observers>
     </controller_action_predispatch>
   </events>
 </global>

In Observer.php I've written script to check device type and based on result I set the store. Code snippet is as follows

if($handheldDevice) {
Mage::app()->setCurrentStore('mobile_view'); //It's my store view code
}  

It's switching store fine. I can set different home page for each store and categories too. All cms pages, cart page also seem good. But when I click a category, I'm getting oops error page. Why is it so? (Category is active in admin).

Can anyone help here?

Solutions

Try going to the category url with the normal Magento way to change storeviews: www.url.com/?___store=storecode.

If that also fails, it is certainly a configuration issue and not something related to yourmodule.

Similar questions

Is it possible Custom theme for desktop and Luma theme for mobile and ipad
Is it possible to use blank or luma theme for mobile and custom theme for desktop in magento2.
Configuring Design "Exception" Strings for "Mobile" Devices
What Exception strings are "state of the art" for redirecting iPhone, iPad, Android, tablet, etc. users to a different design? That is, I realize in the user interface, there's a feature that allows me to create a regular expression that's matched against the user agent string. What I'm looking for is what specific strings people are using to redir...
Magento Redirect to mobile website when on Smart Devices
so I have two websites example.com and example.com/mobile , when a user visits my site on a mobile device or tablets etc I would like for them to be redirected to the mobile.example.com. I have tried editing my .htacess file but it doesn't seem to have any effect, I have also tried adding a JavaScript in the HTML head misc scripts but to no avail. ...
Turn Magento Footer Links into togglable List for Mobile Devices
Lets assume this is my footer link markup: (Basically I just added unique ids to each title div and ul in the links template.) Here is my js code: I am hiding the ul element for specific resolutions and am turning the title into a clickable element which will toggle the hidden ul. While this is generally working, for some reason I am experiencing a...
How to create a special website for mobile devices?
I have a 'responsive theme' on my Magento 1.9.1 store but it's not good enough...What is the best way to setup for mobile devices (tablets, mobile phones) so that both the customers and Google be happy?
Grid view column count for mobile devices
For desktop websites I've configured Magento to have 3 columns on category pages due to which when I see it on mobile devices, it shows 2 products in a row and 1 product in next row and it repeats the same again. In list.phtml <?php $_columnCount = $this->getColumnCount(); ?> I can update $_columnCount with 2 but again it will affect deskt...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.