available, sold, coming soon categories

10 posts by 3 authors in: Forums > CMS Builder
Last Post: March 8, 2018   (RSS)

By TheSeen - January 16, 2018

Hi all ...

Have a new client on board and will be setting up CMSB for them.

They will be selling cars and will have the sub pages Available, Sold and Coming Soon within their main Cars section of website.

Is it possible to set up CMS so that a car detail page is created once and then can appear listed in each particular sub page area if a drop down menu category is selected in the car detail page in the CMS?

In essence I want to add the car details once in CMS. When it is added I want to be able to select which category it is in and as such it is then displayed in that category area in the website. Then when for example the car has been sold I want to be able to change the category in the CMS car detail page to the sold category and the the page will be automatically moved to the Sold area on the actual website.

Hope that makes sense.


By TheSeen - March 2, 2018

Hi Leo ... yes interested to learn how this can be done now, what's the best way forward?

By leo - March 2, 2018


According to the description, I assume you want to be able to filter cars based on their status (sold/new etc.) when getting the records from the database. You can add a new field "status" to the cars section, make it a pulldown with the possible status you want. And on the front-end pages you can add a where statement to filter the records you get from getRecords like this:

list($carsRecords, $carsMetaData) = getRecords(array(
  'tableName' => 'cars',
  'where' => 'status = ' . $status,

In this example, the $status variable will be the value of the status field that you want of the cars records.

Hope this helps and let me know if you have any questions!


Leo - PHP Programmer (in training)

By TheSeen - March 5, 2018 - edited: March 5, 2018

Hi Leo ... I tried that but I'm getting an error on the test page.

I've uploaded the head code and also code in the html calling in records and also screen grab of the error when visiting the page.

Is there anything you can see that I need to do?

I added the new field called 'statuss' in the CMS as it said 'status' was a reserved field. This is running from a multiple section call 'available'.




01.jpg 320K

02.jpg 239K

03.jpg 162K

By leo - March 5, 2018

Hi Adrian,

Sorry for the confusion. Basically you need to define $statuss first before passing in to the where statement. For example, your statuss field in CMS is a list that contains following values:


* This is the default CMS list value format, the number on the left represents the actual value of the option and the text on the right represents the label

And on the page with records that marked as "Available", you can do this:

$statuss = 1 // 1 is the value of "Available" option
list($carsRecords, $carsMetaData) = getRecords(array(
  'tableName' => 'cars',
  'where' => 'status = ' . $status,

Or even more straightforward if you think this page won't need to get other records:

list($carsRecords, $carsMetaData) = getRecords(array(
  'tableName' => 'cars',
  'where' => 'status = 1',

Hope this helps you get what you want and let me know if you have any questions!


Leo - PHP Programmer (in training)

By Dave - March 6, 2018

Hi Adrian, 

Another option is to use the built-in searching features: 

So for example if your field was called 'status' and the value was 'sold' you could add this to the URL to only show sold listings: 


This way, you can create multiple links to the same page that show different listings.

Hope that helps!

Dave Edis - Senior Developer

By TheSeen - March 7, 2018

Thanks both.

I've noticed that it's not going to be suitable for the website as the sold and available sections have some different graphic markings in their html template. So I will simply recreate the car when it becomes sold.

I'm sure the advise will come in useful for future sites though so thanks.

By Dave - March 7, 2018

Hi Adrian, 

Ok, sounds good.  For future reference, one other thing you can do when using these kinds of queries: ?status=sold

Is to check for them and show different images or headings, eg: 

<?php if (@$_REQUEST['status'] == 'sold'): ?>
  <h1>Sold Listings</h1>
<?php else: ?>
  <h1>Default Title</h1>
<?php endif ?>

Dave Edis - Senior Developer

By TheSeen - March 8, 2018

Very useful .. thanks David.

You are legends.