3 posts by 2 authors in: Forums > CMS Builder
Last Post: October 18, 2016   (RSS)

By Toledoh - October 18, 2016

Hey all.

Is there a way, in the admin, to show only records with a date in the future by default?

I've got a section with restaurant bookings, and want to show only future bookings, but also sort those in the future by date.

If no easier way, I was thinking of trying to create a plugin that made an "archive" checkbox ticked if the date is past?  Then sort by archive,date?

Any pointers?

Cheers,



Tim Forrest

Toledoh Enterprises

www.toledoh.com.au

By Damon - October 18, 2016

Hi Tim,

Here is one way you could set up an automatic advanced search filter on the bookings records. Create an advanced search option for date. Add a link to the Booking seciton editor filtering by date that uses PHP to get the current date plus one. Here are the steps:

1. Create an advanced search option for date in the Bookings section editor.

  1. Go to Admin > Section Editors > Bookings and click on the Searching tab.
  2. In the Search Fields text box, in a new link under  _all_  enter Minimum Date|date|min

Now you can go to the Bookings section editor and advanced search by date. Example: 2016-10-18

2. Next, download and install the Modify Homepage Add-On:
http://www.interactivetools.com/add-ons/modify-homepage/

3. Edit the modify_homepage.php to include a link to View future bookings:

<li><a href="?menu=bookings&_defaultAction=list&page=1&showAdvancedSearch=1&&date_min=<?php echo date("Y-m-d"); ?>">View future booking</a></li>

Now a user can click on the top left logo/text in CMS Builder to go to the homepage where the link will appear. Clicking the link will filter the Booking results by minimum date.

Does this sound like a workable solution for what you need?

---------------------------------------------------
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By Toledoh - October 18, 2016

Love that idea. Thanks!

Cheers,



Tim Forrest

Toledoh Enterprises

www.toledoh.com.au