From d16cd5a3bffee038830cb867fefaf7502f8cbf19 Mon Sep 17 00:00:00 2001 From: PrestaEdit Date: Tue, 27 Nov 2012 22:55:57 +0100 Subject: [PATCH] [-] FO : show mobile theme if you have click "Broswe the mobile site" on a PC --- classes/Context.php | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/classes/Context.php b/classes/Context.php index 7790dc27c..e33a91dd9 100644 --- a/classes/Context.php +++ b/classes/Context.php @@ -111,22 +111,27 @@ class ContextCore $this->mobile_device = false; if ($this->checkMobileContext()) { - require_once(_PS_TOOL_DIR_.'mobile_Detect/Mobile_Detect.php'); - $this->mobile_detect = new Mobile_Detect(); - switch ((int)Configuration::get('PS_ALLOW_MOBILE_DEVICE')) + if(Context::getContext()->cookie->no_mobile == false AND (int)Configuration::get('PS_ALLOW_MOBILE_DEVICE') != 0) + $this->mobile_device = true; + else { - case 1: // Only for mobile device - if ($this->mobile_detect->isMobile() && !$this->mobile_detect->isTablet()) - $this->mobile_device = true; - break; - case 2: // Only for touchpads - if ($this->mobile_detect->isTablet() && $this->mobile_detect->isMobile()) - $this->mobile_device = true; - break; - case 3: // For touchpad or mobile devices - if ($this->mobile_detect->isMobile() || $this->mobile_detect->isTablet()) - $this->mobile_device = true; - break; + require_once(_PS_TOOL_DIR_.'mobile_Detect/Mobile_Detect.php'); + $this->mobile_detect = new Mobile_Detect(); + switch ((int)Configuration::get('PS_ALLOW_MOBILE_DEVICE')) + { + case 1: // Only for mobile device + if ($this->mobile_detect->isMobile() && !$this->mobile_detect->isTablet()) + $this->mobile_device = true; + break; + case 2: // Only for touchpads + if ($this->mobile_detect->isTablet() && $this->mobile_detect->isMobile()) + $this->mobile_device = true; + break; + case 3: // For touchpad or mobile devices + if ($this->mobile_detect->isMobile() || $this->mobile_detect->isTablet()) + $this->mobile_device = true; + break; + } } } }