Mobile-only pagination for categories on homepage

  • Posts: 359
  • Thank you received: 10
  • Hikashop Business
2 days 5 hours ago #369160

Hello,

On my homepage I display almost 40 product categories (HikaShop categories listing).
I would like that only on mobile this block uses pagination (e.g., 8–12 categories per page with a page menu or a “load more”), while on desktop the full grid remains visible.

Questions:

Does HikaShop natively support pagination for a categories listing (menu/module) only on mobile—via any parameter or setting?

If not, what’s your recommended approach to achieve it (override of the category / listing view, menu settings, or duplicating the module with CSS show/hide by breakpoint)?

Are there any known limitations for paginating categories (not products) when the listing is placed on the homepage?

Is there a recommended hook/event to implement an accessible <nav> pagination without breaking updates?

Please Log in or Create an account to join the conversation.

  • Posts: 84586
  • Thank you received: 13757
  • MODERATOR
1 day 21 hours ago #369167

Hi,

You can configure a category listing menu item with pagination. As long as the number of rows and columns of the menu item is lower than the total number of elements, HikaShop will automatically display a pagination for the listing.
And if the number is lower, the pagination won't be displayed.
However, it's not possible to change the number of columns / rows of a menu item based on the device type of the user displaying the menu item.
What is possible is to create two different menu items, configure each one differently so that one has the pagination and not the other, and then use CSS to hide / display the menu items based on the user's device:
www.facebook.com/groups/joomlanospam/posts/10160353155880997/
While this would work for most menu items, it wouldn't help for the homepage.

So, up to this point, that's what I would say for someone who doesn't / can't code.
If you're a developer, I would recommend making an override of the category / listing_div view file via the menu Display>Views.
There, you can add :
- some CSS code to hide the rows of categories you don't want to be displayed by default on mobile devices. For example:

<style>
@media (max-width:962px)  {
.hikashop_category_row_2, .hikashop_category_row_3, .hikashop_category_row_4, .hikashop_category_row_5 {
 display:none;
}
}
</style>
- a "load more" button with a bit of javascript to display more rows. For example:
<a href="#" class="loadmorebutton" onclick="document.querySelector('.hikashop_category_row_2').display = 'block'; return false;">
load more
</a>
<style>
@media (min-width:963px)  {
.loadmorebutton { display: none;}
}
</style>
That's of course a simplified solution to get you started. The real code will need more complex javascript and proper coding.

Since this won't be a real pagination, I don't think you should add a nav tag.

If you want to add a nav tag around the categories listing pagination displayed by HikaShop, in that same category / listing_div view file, you can add the tag around the pagination near the bottom of the view file:
		<?php echo $this->pagination->getListFooter($this->params->get('limit')); ?>
		<span class="hikashop_results_counter"><?php echo $this->pagination->getResultsCounter(); ?></span>

Please Log in or Create an account to join the conversation.

Time to create page: 0.056 seconds
Powered by Kunena Forum