Why doesn't the Category List Filter field work?

From Joomla! Documentation

Revision as of 16:41, 12 January 2009 by Dextercowley (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

In a Section Layout Menu Item, a list of Categories is displayed. When you drill into a Category, you get a Category List layout. This includes a Filter box that allows you to filter the list based on Title.

However, if you have defined a Filter in the Article Manager → Parameters screen under "Filtering Options", then two problems arise: (1) the Filter box will be labeled incorrectly (for example, "BL Filter" instead of "Title Filter") and (2) entering a value in the Filter box will have no effect. The first issue is new with version 1.5.9 (since the label for the Filter box is new). The second issue has been present in all 1.5.x versions.

There are several ways to correct the problem.

1. Create a Category List Menu Item for each Category in the Section (for example, on a hidden menu). If you do this, the parameter for "Filter Field" from this Menu Item will be used and the problem will not occur. (This also allows you to override the default parameters for the Category List drill down.)

2. Download and apply the patch from the Joomla! tracker at this location.

3. Manually make the following program modifications:

In the file <joomla_root>/components/com_content/models/category.php, insert a new line after line 494 that reads "default :". So the resulting lines 494 - 497 will now read:

    case 'title' :
    default : 
        $where .= ' AND LOWER( a.title ) LIKE '.$filter;

In the file <joomla_root>/components/com_content/views/category/view.html.php, insert the following 3 lines after line 59:

if (($params->def('filter_type', 'title') != 'hits') && ($params->def('filter_type', 'title') != 'author')) {
    $params->set('filter_type', 'title');

Note that this problem does not occur in Category List Menu Items. It only occurs in Section Layouts where you are drilling down to a Category for which a Category List Menu Item does not exist.

Also note that the underlying cause of this problem is a duplicate parameter name for two different parameters. These parameters will be renamed in Joomla! version 1.6 to resolve this issue. Since there may be extensions that rely on the existing parameter names, it was decided not to change the parameter names for version 1.5.