Vous pouvez essayer de la manière suivante :
- Créez une nouvelle boutique pour votre site Web avec votre propre vue de la boutique, configurée pour utiliser le pack de thèmes mobiles souhaité.
- allez dans index.php et ajoutez-y du code pour vérifier si l'utilisateur actuel utilise un appareil mobile (cette question a déjà été posée). comment vérifier si la requête provient d'un mobile ou d'un ordinateur en php )
- ajouter ce contrôle AVANT la ligne
Mage::run($mageRunCode, $mageRunType);
-
puis utiliser la condition comme ceci
if (is_mobile()) { Mage::run('mobile_store_code') ; } else { Mage::run($mageRunCode, $mageRunType) ; }
Tout comme la variante.
UPD : par exemple la méthode decet elle-même :
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;
}
Code tiré de http://www.manhunter.ru/webmaster/272_opredelenie_mobilnih_brauzerov_na_php.html
Ou celui-là
function isMobile()
{
$regex_match = "/(nokia|iphone|android|motorola|^mot\-|softbank|foma|docomo|kddi|up\.browser|up\.link|"
. "htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|"
. "blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam\-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|"
. "symbian|smartphone|mmp|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte\-|longcos|pantech|gionee|^sie\-|portalmmm|"
. "jig\s browser|hiptop|^ucweb|^benq|haier|^lct|opera\s*mobi|opera\*mini|320x320|240x320|176x220"
. ")/i";
if (preg_match($regex_match, strtolower($_SERVER['HTTP_USER_AGENT']))) {
return TRUE;
}
if ((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml') > 0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))) {
return TRUE;
}
$mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 4));
$mobile_agents = array(
'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
'newt','noki','oper','palm','pana','pant','phil','play','port','prox',
'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',
'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',
'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',
'wapr','webc','winw','winw','xda ','xda-');
if (in_array($mobile_ua,$mobile_agents)) {
return TRUE;
}
if (isset($_SERVER['ALL_HTTP']) && strpos(strtolower($_SERVER['ALL_HTTP']),'OperaMini') > 0) {
return TRUE;
}
return FALSE;
}
Code tiré de http://snippy.ru/snippet/1864-Prostoy_sposob_opredelit_zahod_na_stranicu_cherez_mobilnyy_brauzer/
De nombreux exemples de ce type peuvent être trouvés avec Google ;)