Issue
I need add a custom code in Prestashop 1.7 only for Mobile visits. Css display none is not the solution I am looking for. In previous PS 1.6 the code what works was {if $isMobile} and checking PS 1.7 file classes/Context.php yet is included the variable "isMobile".
I tried add a {if $isMobile} or {if $mobile_device} in .tpl files but it is not working
Solution
Into the getWidgetVariables()
function of your controller module, you can add the following line into array returned:
'mobile_device' => Context::getContext()->isMobile(),
And check into your .tpl:
{if isset($mobile_device) && $mobile_device}
<p>Displayed only on mobile</p>
{/if}
Answered By - Klemart3D Answer Checked By - Mary Flores (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.