Difference between revisions of "How to change the default ordering to a custom field"

From JReviews Documentation
Jump to: navigation, search
 
Line 1: Line 1:
== JReviews 2.3 ==
 
 
 
To set the default ordering to a custom field, go the JReviews Global Configuration, tab List page and enter the name of the field here:
 
To set the default ordering to a custom field, go the JReviews Global Configuration, tab List page and enter the name of the field here:
  
Line 10: Line 8:
 
[[File:FieldOrdering2.png]]
 
[[File:FieldOrdering2.png]]
  
 +
Replace jr_price with the name of your field. If you want descending order, add an "r" in front of the field name so it looks like this rjr_price.
  
 
== JReviews 2.2 ==
 
 
Edit <span style="color: blue">/components/com_jreviews/jreviews/controllers/my_controller.php</span>
 
 
In the '''beforeFilter''' function add the line shown below to override the global setting:
 
 
<source lang="php">
 
function beforeFilter()
 
    {   
 
        $this->Config->list_order_default = 'jr_price';
 
</source>
 
 
Replace jr_price with the name of your field. If you want descending order, use rjr_price.
 
  
  
 
[[Category:JReviews]]
 
[[Category:JReviews]]
 
[[Category:Fields]]
 
[[Category:Fields]]

Latest revision as of 19:00, 9 February 2016

To set the default ordering to a custom field, go the JReviews Global Configuration, tab List page and enter the name of the field here:

FieldOrdering1.png


If you want to do that for certain listing types only, go to the Listing Type Manager, edit your listing type and set the field name here:

FieldOrdering2.png

Replace jr_price with the name of your field. If you want descending order, add an "r" in front of the field name so it looks like this rjr_price.