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

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...

Important Information

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