Jump to content

How to detect device in smarty in prestashop 1.7


Designinfo.in

Recommended Posts

I want the following:

{if isset($products) AND $products}
             {$tabname=rand()+count($products)}
            {if isset($display_mode) && $display_mode == 'carousel'}
                {include file="{$items_owl_carousel_tpl}" items=$products image_size=$image_size}
            {else}
                {if device is MOBILE}  
                    {include file="{$items_normal_tpl}" items=$products image_size="homepage_default"}
                {else device is NOT MOBILE}
                    {include file="{$items_normal_tpl}" items=$products image_size="home_default"}
                {/if}
            {/if}
        {/if}

What codes should I enter in the IF condition to make sure it detects mobile and not mobile.

Also is the IF condition written properly, what should i change in this code?

This is TPL File.

Edited by Designinfo.in
Tags Added. (see edit history)
Link to comment
Share on other sites

  • 10 months later...

Hi,

Have look on this post or this thread.

From my point of view, I tried to do image displaying based on this check, but it does not work every time. So I moved with a front solution like "<img>" with "srcset" or "<picture>" with "srcset".

Hope this helps

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
×
×
  • Create New...