Answer the question
In order to leave comments, you need to log in
How to change Opencart template if user logged in from mobile phone?
Hello. How to change Opencart template if user logged in from mobile phone?
In the /system/startup.php file, I included the mobile detect library.
// Библиотека определения мобильных устройств
require_once(DIR_SYSTEM . 'library/Mobile_Detect.php');
$detect = new Mobile_Detect();
define('isMobile', $detect->isMobile(), false);
define('isTablet', $detect->isTablet(), false);
//Mobile
if(isMobile && !isTablet && $_COOKIE['ver'] !== 'full'){
$this->config->set('config_template', 'default_mobile');
}elseif(isMobile && !isTablet && $_COOKIE['ver'] == 'full'){
$this->config->set('config_template', 'default');
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question