Jump to content

Featured Random Then Title DESC Filter


CMoore

Recommended Posts

I have been asked by a few how I was able to create a filter that changes the order so that the featured listings are randomized and then display the rest in alphabetical order. Please note that this is going to slow down your load time and puts some stress on the server. You will want to be selective with how you use this. I am uploading a copy of the filter, I have also added in more notes to get things started.

  1. Read through the notes on the document, they will guide you through the first few steps. 
  2. Then, you will need to upload the attached "featured_random.php" file to jreviews_overrides/filters
  3. Next, you need to call this filter for use by creating a filter_functions.php file with this: 

<?php
defined('MVC_FRAMEWORK') or die;

require 'featured_random.php';

Place this filter_functions.php file into the same /filters folder.

You may notice that your featured listings initially disappear, that is because they have no value. In order to start the script, run your cron script manually (just click on your cron script link), you should get a success message. You should see your featured listings at this point. If your page's featured listings don't shuffle order on their own after this then check your cron script.

This code works for me but can't guarantee that it will work for you. Make sure to take a full server backup before you begin since the first step has you modifying your database. 

Use this code at your own risk, what worked for me may not work for you.

Good Luck!

 

filter_functions.php

Edited by CMoore
  • Like 1
  • Thanks 2
Link to comment
  • CMoore changed the title to Featured Random Then Title DESC Filter
  • 5 months later...
×
×
  • Create New...