A
A
Alexey Vesnin2018-11-17 16:23:17
opencart
Alexey Vesnin, 2018-11-17 16:23:17

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);

Now I want to check and change the template, but I don’t know where to put it.
//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');
}

At what point and where does Opencart check which template is set by default?? OC version 2.3.x

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question