You can easily detect for Desktop and mobile devices with below script in Controller file of prestashop.
require_once(_PS_TOOL_DIR_.'mobile_Detect/Mobile_Detect.php');
$this->mobile_detect = new Mobile_Detect();
$mobile_class = 'desktop';
if ($this->mobile_detect->isMobile() && !$this->mobile_detect->isTablet()){
$mobile_class = 'mobile';
}
// Call Different file for desktop and mobile
if ($mobile_class == 'desktop'){
$template_name = 'postcategory.tpl';
} else {
$template_name = 'postcategorymobile.tpl';
}
// And finally setTemplate HTML.
$this->setTemplate($template_name );

1 Comments
This is a great post and I read a way while back. It really helped me out.Thank you so much for this great article.
ReplyDeleteSEO Tool
wordpress theme