Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Как сменить шаблон на мобильных устройствах?


kuripka2222
 Share

Recommended Posts

Здравствуйте, форумчане. В связи с полным редизайном мобильной версии сайи, перегделкой почти всего, что только можно, требуется автоматический переход с основного шаблона на мобильный. Я нашел в интернете вариант с использованием Mobile_Detect.php, но почему то сайи падает на мобильных устройствах

 

в файле system/startup.php  добавить 
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');
}

Может икая конструкция не рилииет на 3 версии опенкари? 

Link to comment
Share on other sites


2 часа назад, kuripka2222 сказал:

Здравствуйте, форумчане. В связи с полным редизайном мобильной версии сайи, перегделкой почти всего, что только можно, требуется автоматический переход с основного шаблона на мобильный. Я нашел в интернете вариант с использованием Mobile_Detect.php, но почему то сайи падает на мобильных устройствах

 

в файле system/startup.php  добавить 
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');
}

Может икая конструкция не рилииет на 3 версии опенкари? 

а может надо вклюлить отображение ошипотому чток и увигдеть в чем проблема?

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.