Difference between revisions of "Why doesn't the Category List Filter field work?"

From Joomla! Documentation

(document issue with duplicate filter_type parameter)
 
m (add clarification to when the issue started)
Line 1: Line 1:
 
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.
 
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.
+
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.  
 
There are several ways to correct the problem.  

Revision as of 00:00, 12 January 2009

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, replace line 492 with the following:

// work-around for duplicate 'filter_type' parameter name
// filter_type must be title, author, or hits (default=title)
$filter_type =  $params->get('filter_type');
if (($filter_type != 'author') && ($filter_type != 'hits')) { 
    $filter_type = 'title'; 
}
switch ($filter_type)

In the file <joomla_root>/components/com_content/views/category/tmpl/default_items.php, replace line 23 with the following:

<?php /* work-around for duplicate filter_type parameter */ ?>
<?php /* filter_type must be title, author, or hits (default=title) */ ?>
<?php $filter_type = $this->params->get('filter_type');?>
<?php if (($filter_type != 'author') && ($filter_type != 'hits')) : 
	$filter_type = 'title'; 
	endif; ?>
<?php echo JText::_($filter_type . ' Filter').'&nbsp;'; ?>

If you are using the "beez" template, in the file <joomla_root>/templates/beez/html/com_content/category/default_items.php, replace line 23 with the following:

<?php /* work-around for duplicate filter_type parameter */ ?>
<?php /* filter_type must be title, author, or hits (default=title) */ ?>
<?php $filter_type = $this->params->get('filter_type');?>
<?php if (($filter_type != 'author') && ($filter_type != 'hits')) : 
	$filter_type = 'title'; 
	endif; ?>
<?php echo JText::_($filter_type . ' Filter').'&nbsp;'; ?>

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.