Prodcuts per page depending on window width
Posted: Mon Oct 23, 2017 5:48 am
Hi!
I've got a question. My store has 2 versions mobile and desktop. What I need is different number of items per page for desktop version (6 items) and mobile version (3 items). So I've try to use javascript to change the form with limits in category.tpl
of course I've made changes in category.php : and in back-end template options (default items per page setting on 3)
But unfortunately this didn't works - it's changed the selected items but the trigger onchange="location=this.value" used in form don't see this. So the page shows always 3 items per page. I've tried to use document.location in javascript but I couldn't stop eternal refreshing the page.
So , the question is - how to do this thing working?
I've got a question. My store has 2 versions mobile and desktop. What I need is different number of items per page for desktop version (6 items) and mobile version (3 items). So I've try to use javascript to change the form with limits in category.tpl
Code: Select all
$(function () {
if ($(window).outerWidth()>800) {
document.getElementById('input-limit').selected = 1;
} else {
document.getElementById('input-limit').selected = 0;
}
});
of course I've made changes in category.php :
Code: Select all
$limits = array_unique(array($this->config->get($this->config->get('config_theme') . '_product_limit'), 6, 25, 50, 75, 100));
But unfortunately this didn't works - it's changed the selected items but the trigger onchange="location=this.value" used in form don't see this. So the page shows always 3 items per page. I've tried to use document.location in javascript but I couldn't stop eternal refreshing the page.
So , the question is - how to do this thing working?