Presently i am using cscart version 3.0.3
→ Currently in Brand filter section on the left side of the page we are getting all brands list.
→ But i need to modify code so that it should get only brands of the products that are searched.
The query for getting brands list is being written in fn_get_filters_products_count() function. and the variable is $ranges_counts
Now i need to add condition to the query with product ids of serched result products like ex :
$where .= " AND ?:products.product_id IN('1050924','1083996')";
so how can i get searched product information in fn_get_filters_products_count() function?
Hello anilkumar,
I'm afraid, custom modification is required here. You are always welcome to contact us to get a quote http://www.alt-team…st-a-quote.html
But I can give you some useful tips, probably they will help you.
The information about searched products is not passed in the fn_get_filters_products_count() function.
But you can get this info from the template variables this way (CS-Cart 3):
$template_products = Registry::get('view')->get_template_vars('products');
$_product_ids = array_map(function($t_p) {return $t_p['product_id']; }, $template_products);
In the $_product_ids variable will be stored the ids of the products that are searched. But please notice, it's not a good practice to use the template variables in the controller. Nevertheless, it is the only simple way to get the list of searched products in this function without implementing a custom modification to it.
Best regards, Alt-team
This addon might save you some time. Show dynamic filters on search page without core file changes: CS-Cart Dynamic Filters on Search Page