Agency pages are more commonly found on portals, but the idea of an agency as a container for branches, staff etc, exists on every site on the platform. This area will explore output options and general agency functions.
Anything agency related will reside in the agencies
folder in your Rails directory structure and your show page will follow the normal format of show.liquid
. Let’s start to build the page using the agency name, agency description and the agency’s portal logo with a fallback to their default logo:
Next, let’s add a Google style map to our show page - note that this will show the branches belonging to an agency:
Don’t forget to give your map div a height and a width setting in your CSS.
If you would prefer to use a Leaflet style map:
Now let’s extract the branches of an agency, including their branch pic or logo, description etc:
Note that we’re ordering the branches alphabetically using a helper function and we’re reusing our branch_small
. Not only is this excellent reuse, but it means if your branch_small layout is sorted, it should work out of the box on you agencies pages. In addition, when you need to make a change to it, it will be reflected on all pages that use it.
Finally, let’s see how we can extract some social media links from the CRM:
This block of code first executes a has_social_links
function - this checks whether any one of the standard social media slots has a value. If at least one does, it will execute the block. We then use individual agency drop checks to see if the URI is available and output a theme image linking to the URI if so.
Properties from fragment is a function that effectively allows you to run a background search using any search criteria, then loop through the results anywhere on the site using a well defined content block.
If you’ve been working with search results as well as filtering by price, type and so on, you’ll be familiar with the URL ‘fragments’. A typical fragment could be: from-3-bed/from-200000/up-to-300000
. This is exactly what we can add to the block:
For an agency, featured properties can play one of two roles depending on what has been set. In your backend admin system, you or the agent can manually feature up to five properties by clicking into the property record, selecting either sales or lettings and selecting the checkbox Feature on the home page
, which is under the Status and visibility
section. You can then loop through the properties on your page using the following code construct:
If no featured properties have been manually set, the application will call the recent properties
function instead. This function pulls out five of the latest properties, sorted descending by the date they were created on the Homeflow system.
###Featured properties outside property results pages
Sometimes it is a requirement to have the featured properties on other pages in the site. As the featured properties relies on properties being included in the Ctesius Javascript config, it is necessary to do this manually.
If you want to ‘Add to shortlist’ or ‘Favourite’ these properties then they will need to be added to the Ctesius config called ‘properties’. This can be achieved by the placing the following snippet on the page:
There are three recent property related functions to be aware of:
Whereas recent properties gets both sales and lettings, recent sales or recent lettings gets five properties belonging to the respective channel. They are all called in much the same way and make use of the same fields. Here’s how to call the recent sales function:
The interesting properties algorithm attempts to find properties similar to the ones a user has searched for and/or viewed, then display them in a location such as the home page. Many agency sites have a default output that is replaced if a certain number of interesting properties are returned.
Our first port of call is to switch on a couple of options in the theme. In your JS Event Registers file add the following:
And if you want to make sure enough properties are on the stack before outputting:
Now consider a typical home page presentation:
There’s nothing special about this - if we had another three you’d have a nice row of recent property boxes. Now, somewhere convenient, we would then add:
This template will be used to render our results.
###Working with statuses and property fields
At the time of writing, the property status Liquid that finds and outputs the appropriate sash is not available for use on the Interesting Properties output. Instead, the solution is to add the property’s channel to the properties_list.ljson
, then run some Liquid checks to output the appropriate sash.
status: "{{property.status}}"
- add to the LJSON
primary_channel: "{{property.primary_channel}}"
- also worth adding to get the channel
If you wanted to exclude Sold, Let, etc from the output altogether, you can add this to the JSON within the for loop:
{% highlight liquid %} exclude_from_implied: {% if property.status == ‘SSTC’ %}true{% endif %}{% if property.status == ‘Let agreed’ %}true{% endif %}{% if property.status == ‘Let’ %}true{% endif %}{% if property.status == ‘Sold’ %}true{% endif %} {% endhighlight %}
This if statement looks a bit ugly but the value must follow the field.
Most fields can be added to the JSON, so if you wanted to output property.town
for example, you could add it to the JSON then check and output put it to the Interesting Properties view.
###Working with User History
A handy event and callback is available to you as and when the user history for the Interesting Properties output is built up. This can be used to add a custom title, background or anything else you please.
In this code sample you could run a test on place, then use a jQuery attribute change on an element.
Agency testimonials can be added via the CMS link: /configure/website/testimonials
. You can then loop over and output the testimonials as follows:
A route exists in the Ctesius app the /pages/testimonials
and a testimonials.liquid
page can exist under your pages folder to have a dedicated testimonials page. Use the loop above here to extract them to the page.
A useful testimonials function is to assign a random testimonial and output to a given area:
Need to slice the testimonials array to get the latest five and then shuffle them? Use the slice_array
and shuffle
functions:
Need testimonials by channel? No problem:
Then loop through them as normal.
Banners are useful blocks that can contain a title, description, image and a URL. Items belonging to a banner can be manually ordered, which makes them very versatile. To add a banner, head over to the agency admin: /configure/website/site_banners
. Here’s the markup: