available, sold, coming soon categories
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.
Thanks for your inquiry. And yes, CMS has helper functions to filter records by its parameters. Depending on your website structure, you will have different options to do it.
Let me know if you have any questions about how it can be done!
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!
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'.
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!
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.
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'): ?>
<?php else: ?>
<?php endif ?>