Categories listing - search and sort

  • Posts: 429
  • Thank you received: 19
1 month 1 day ago #364600

Hello, is it possible to add a search and sorting function to the category list like in the product list (filters)? If there are multiple categories, it can be very difficult to find a given category.

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

  • Posts: 4763
  • Thank you received: 647
  • MODERATOR
1 month 19 hours ago #364602

Hello,

You have to create a Module Filter specific for your Category listing, with only filter entries (HikaShop Configuration, Display dropdown => Filters) restricted on your required Category (if needed).
And in your required Item Menu, your category listing settings and activate in Product features display part, the Filters options.

Follow my configuration, especially red bordered part, but maybe you have to adapt to your relative needs.


Regards

Last edit: 1 month 21 hours ago by Philip.
The following user(s) said Thank You: neo191987

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

  • Posts: 429
  • Thank you received: 19
1 month 17 hours ago #364610

Hi, thanks for the reply. The product filters are working fine. My goal is to add category search and not necessarily sorting by name. This is the page I want to add, if I have over 100 categories, it will be difficult for the customer to find the given category.

Attachments:

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

  • Posts: 83022
  • Thank you received: 13403
  • MODERATOR
1 month 12 hours ago #364612

Hi,

Unfortunately, there is no already available mechanism for categories listings.

Now, if you want to build your own filter system for categories, that's totally possible. You need two things:
1. create a module, which would allow the user to apply some filtering with dropdown, or input field, or other interfaces.
2. a plugin of the type "hikashop" implementing the onBeforeCategoryListingLoad event:
www.hikashop.com/support/documentation/6...eCategoryListingLoad
This event will be called each time HikaShop loads a listing of categories. First, you want to check that you're on a categories listing menu by checking the parameters. Then, you can read parameters relative to your module interface (for example, if you have a link to the same page with an extra parameter ?categorysearch=xxx added to it for a search on the category name with the text "xxx"), and then you can add custom conditions to the $filters parameter of the event to actually apply the filter to the loading of the categories. For example:

public function onBeforeCategoryListingLoad(&$filters) {
 // ....
 $search = hikaInput::get()->getString('categorysearch');
 if(!empty($search)) {
  $db = JFactory::getDBO();
  $filters[] = 'a.category_name LIKE '.$db->quote($db->escape('%'.$search.'%'));
 }
}

The following user(s) said Thank You: neo191987

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

Time to create page: 0.060 seconds
Powered by Kunena Forum