Question: Hide Categories when filtering
In Virtuemart 2 when using filters you may wish to hide displayed categories:
It usually happens when you use filters on the homepage. In this case there is no any particular category id present in the URL and Virtuemart "decides" to show all available categories you have in the store.
To change this behavior you may either disable this option in VM itself:
Virtuemart > Configuration (menu) > Configuration > Templates
Or add a few lines to the VM code to "tell" it to not display categories when there are filters applied.
File:
/components/com_virtuemart/views/category/tmpl/default.php
There is a line that goes:
.. if ( VmConfig::get('showCategory',1) ) { ..
We will edit this part to look like the following:
.. $filtersApplied = JRequest::getVar('custom_parent_id', ''); // if ( VmConfig::get('showCategory',1) ) { if ( VmConfig::get('showCategory',1) && !$filtersApplied ) { ..