Answer the question
In order to leave comments, you need to log in
How to change template on mobile devices?
Hello forumites. In connection with the complete redesign of the mobile version of the site, the alteration of almost everything that is possible, an automatic transition from the main template to the mobile one is required. I found an option on the Internet using Mobile_Detect.php, but for some reason the site crashes on mobile devices
in the system/startup.php file add
require_once(DIR_SYSTEM . 'library/Mobile_Detect.php');
$detect = new Mobile_Detect();
define('isMobile', $detect->isMobile(), false);//We use this
define('isTablet', $detect->isTablet(), false); //We use this and add
//Mobile
in the index file
if(isMobile && !isTablet && $_COOKIE['ver'] !== 'full'){
$this->
}elseif(isMobile && !isTablet && $_COOKIE['ver'] == 'full'){
$this->config->set('config_template', 'default');
}
Maybe this construction does not work on version 3 of opencart?
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