Jump to content

Filter


Recommended Posts

Hello :)
I need to create a module which would be filter products, searched by 'search module'.
Where to begin?
Should I create a new HOOK and call this hook in SearchController?

How can I get data from 'search module' and transfer them to my module and in the module which shows found products?

Link to comment
Share on other sites

There is a hook actionSearch that you can use to perform actions based on search results, but it doesn't appear to let you modify the search results. I think to do that, you'll need to add modules/<your_module>/override/classes/Search.php with the following:

<?php

class Search extends SearchCore
{
    public static function find($id_lang, $expr, $page_number = 1, $page_size = 1, $order_by = 'position',
        $order_way = 'desc', $ajax = false, $use_cookie = true, Context $context = null)

    {
        $return = parent::find($id_lang, $expr, $page_number, $page_size, $order_by, $order_way, $ajax, $use_cookie, $context);

        $total = $return['total'];
        $result = $return['result'];
        
        // Modify search results and total here

        return array('total' => $total, 'result' => $result);
    }
}
Link to comment
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...