Skip to main content
remove extra will in text
Source Link
David Manners
  • 27.3k
  • 9
  • 78
  • 220

So in principle what you will will need to do is create your own model for the filter and then in this model create a function _getItemsData. This function will create all the filter items that need to be shown, in your case the different ranges. Each item should be in the following format.

$data[] = array( 'label' => 'String To show for the filter', 'value' => $fromValue . '-' . $toValue, 'count' => 'How many items are in this range', ); 

When you create a filter block you can attach a model for calulating it's data via $this->_filterModelName = 'your/layer_filter_model';

How to add new filters I am not completely sure but once that has been sorted the key is getting the data items. You can look into how the price filter works and mirror this.

So in principle what you will will need to do is create your own model for the filter and then in this model create a function _getItemsData. This function will create all the filter items that need to be shown, in your case the different ranges. Each item should be in the following format.

$data[] = array( 'label' => 'String To show for the filter', 'value' => $fromValue . '-' . $toValue, 'count' => 'How many items are in this range', ); 

When you create a filter block you can attach a model for calulating it's data via $this->_filterModelName = 'your/layer_filter_model';

How to add new filters I am not completely sure but once that has been sorted the key is getting the data items. You can look into how the price filter works and mirror this.

So in principle what you will need to do is create your own model for the filter and then in this model create a function _getItemsData. This function will create all the filter items that need to be shown, in your case the different ranges. Each item should be in the following format.

$data[] = array( 'label' => 'String To show for the filter', 'value' => $fromValue . '-' . $toValue, 'count' => 'How many items are in this range', ); 

When you create a filter block you can attach a model for calulating it's data via $this->_filterModelName = 'your/layer_filter_model';

How to add new filters I am not completely sure but once that has been sorted the key is getting the data items. You can look into how the price filter works and mirror this.

Source Link
David Manners
  • 27.3k
  • 9
  • 78
  • 220

So in principle what you will will need to do is create your own model for the filter and then in this model create a function _getItemsData. This function will create all the filter items that need to be shown, in your case the different ranges. Each item should be in the following format.

$data[] = array( 'label' => 'String To show for the filter', 'value' => $fromValue . '-' . $toValue, 'count' => 'How many items are in this range', ); 

When you create a filter block you can attach a model for calulating it's data via $this->_filterModelName = 'your/layer_filter_model';

How to add new filters I am not completely sure but once that has been sorted the key is getting the data items. You can look into how the price filter works and mirror this.