Jump to content
laserloui

Product List - Different limit for mobile

Recommended Posts

Hi there!

My shop currently displays several product lists on its frontpage. 
I have a list for each product category displaying 5 products in total as well as 5 per line (1x5).

Of course for mobile, i have to reduce it so i changed it to 2 products per line.
The problem now is that i now end up having 3 lines on mobile: 2 / 2 / 1 

I would prefer changing the limit/amount of items of the list to 4 for mobile, so i only end up having 2 lines (2/2).

Is that possible? If so, how? 
I am familiar with PHP, so if some changes to the code are necessary, thats ok as well.

Maybe if possible adding some code like this would make sense:
If limit is an uneven number -> limit = limit - 1

if mobile { 
 if(($limit % 2) != 0){ $limit = $limit -1; }
}

Thanks in advance! ❤️

Edited by laserloui (see edit history)

Share this post


Link to post
Share on other sites

Are you using a custom template? Some of them, like panda and transformer, have a setting for that in the theme editor

Share this post


Link to post
Share on other sites

Yes i am using Iqit Theme Editor which comes with a bunch of Themes but it does not offer this setting.
For now i solved the problem by making a duplicate of each product listing. 

Product Category A: 5 products (hidden on mobile)
Product Category A: 4 products (hidden on desktop/tablet)

This way i pretty much achieved what i wanted, although its a pretty dirty fix.
Would have loved to know how i may can fix it within the code myself.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More