Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Let customer switch from mobile to desktop theme in magento
 
tbousiou
Jr. Member
 
Total Posts:  4
Joined:  2012-05-12
 

One of my client asked me to enable a mobile friendly version of the site. So i followd the instructions in this article

This works well, but my client asked me to enable an option for users to switch to desktop version of the site.  The problem with the above method is that some android tablets are recognised as \"smartphones\" and the users are \"traped\" in the mobile theme of the site. We all know that many users prefer to use desktop versions of sites they visit.

My magento configuration is \"main site\"->\"main store\"->\"english\" and \"greek\" store views

One solution (method 1) i can think of is that of having 2 more views \"english_mobile\" and \"greek_mobile\" and find a way have two separate view switchers on the frontend, one for language and one for theme
or (method 2)
a second \"mobile\" store with the two language views.
In any of the above solutions i will still have to duplicate product and cms blocks information for the extra store or view.
I think the ideal solution would be to have a functionality for the user to just select the \"iphone\" theme from the frontend.

Do you know if that\’s possible and how, or should i follow one of the methods i described above, do you have any other recommendations?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nohart
Member
 
Total Posts:  62
Joined:  2012-10-09
California
 

Have a look here - http://www.learnmagento.org/magento-tips-tricks/how-to-switch-to-mobile-template-in-magento/#

 
Magento Community Magento Community
Magento Community
Magento Community
 
Towering Media
Sr. Member
 
Total Posts:  77
Joined:  2011-02-08
Seattle, WA
 

I’m working on my clients store, building a mobile theme for them. Problem here is this - I need the switcher working so the customer can switch back and forth between the mobile and the full store.

I originally set up the mobile theme with exceptions but that will not work since you cant switch back and forth with exceptions.

I then setup the mobile as another store view. Now the switch link i use ?___store=mobile&___from_store=default does work. The problem now is that there is no auto detection for if the store is being accessed from a mobile device.

I found this snippet of code online to auto detect (here’s the link as well http://stackoverflow.com/questions/9062166/best-way-to-detect-mobile-users-in-magento)

function is_mobile() {
  $user_agent
=strtolower(getenv('HTTP_USER_AGENT'));
  
$accept=strtolower(getenv('HTTP_ACCEPT'));

  if ((
strpos($accept,'text/vnd.wap.wml')!==false) ||
      (
strpos($accept,'application/vnd.wap.xhtml+xml')!==false)) {
    
return 1
  
}

  
if (isset($_SERVER['HTTP_X_WAP_PROFILE']) ||
      isset(
$_SERVER['HTTP_PROFILE'])) {
    
return 2;
  

  
return 0;
}

But it didn’t work. After some research online I worked up this code

$ua strtolower($_SERVER['HTTP_USER_AGENT']);
if (
stristr($ua"Windows CE") or
stristr($ua"AvantGo") or
stristr($ua,"Mazingo") or
stristr($ua"Mobile") or
stristr($ua"T68") or
stristr($ua,"Syncalot") or
stristr($ua,"android") or
stristr($ua"Blazer") ) {
  $DEVICE_TYPE
="MOBILE";
}
if (isset($DEVICE_TYPE) and $DEVICE_TYPE=="MOBILE"{ Mage::run('mobile'); else { Mage::run($mageRunCode$mageRunType); }

it works. It auto detects the device and switches to the mobile theme and my manual switch in the footer will work with this. Problem here is that I need this php statement to only run once for the customers session so if the customer switches back to the full site with the manual link it will STAY on the full site instead of rerunning that script and switching back to mobile.

Basically i need this to only run once per user visit. Maybe with a cookie or maybe with sessions. ughhhhhh. Please help!!!

Towering Media

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top