Virtual Categories

Virtual categories are just another way to look at custom field-based taxonomies, which can be useful for assigning listings to multiple categories, simplifying the category setup, and creating new categories on-the-fly. JReviews also makes it possible to use these for navigation and to control page titles and descriptions for SEO.

Overview

Virtual categories are a specific example of using taxonomies, introduced in Planning & Organizing, to classify listings.

A virtual category is, in essence, a custom field with pre-defined options (checkbox, select) that you can use to tag, or classify, listings.

The are several reasons for using virtual categories in your setup:

  1. To place a listing in multiple "categories"
  2. To simplify the category structure
  3. To create new categories on-the-fly while submitting a listing using Click2Add

Virtual categories can also be used for navigation, search & filtering, and they can even have their own SEO settings for page title and description.

Use-case for Real Categories

There is a specific use-case, or need, for real categories in JReviews. That is to be able to associate different listing types (sets of custom fields and rating criteria) with specific categories. It's not possible to associate listing types with virtual categories.

It is possible, however, to use field relations to have different sets of fields, even when using virtual categories. For example, you could have a "Business Type" virtual category using a select custom field where each business type controls a different field group. When a a business type is selected, the corresponding field group, and fields, are shown in the form.

We recommend keeping field relations simple, to avoid overly complicated setups.

Using Virtual Categories

Rather than boring you with long explanations, lets jump right in with an example showing you how to implement virtual categories.

At this point you should be familiar with creating a basic JReviews setup because we took care of that in the Initial Setup. Make sure you go over that if you need to brush up on your setup skills.

Cuisine Category For Restaurants

In the initial setup we created a Restaurants category, with a Cuisine checkbox custom field. Lets put that aside for a moment, and think about how we would structure the categories ⎼ real ones, not virtual⎼, in order to classify restaurants by cuisine and location.

A. Cuisine

├── Restaurants
    	├── American
    	├── Italian
    	├── French

B. Location & Cuisine

├── Restaurants
    	├── New York
            ├── American
            ├── Italian
            ├── French
    	├── San Francisco
            ├── American
            ├── Italian
            ├── French

On the left, we have structure A, where we use one category for each cuisine. On the right, we have structure B where we include locations, and cuisine types as sub-categories for each location.

Do you see what's wrong with these approaches?

In structure A, we can only have restaurants with a single cuisine type, and the restaurant location is missing.

In structure B, we solve the location, but create an additional issue where it's necessary to duplicate the cuisine structure for each location.

And what if we wanted to classify the restaurants by price, or whether they offer delivery, and takout? We can't possibly use categories for this.

Custom fields to the rescue 🚀

So we are going to scrap all of that, and get back to our cuisine custom field which is already setup and ready to go. Our structure looks something like this now.

├── Restaurant
    	◎── Cuisine (American, Italian, French, ...)  

We can take advantage of this cuisine virtual category in a number of ways.

Click2Search

Click2Search is a custom field feature that automatically converts the selected option into a link. Site users can then click on these links within listings to quickly find other listings matching the clicked value. In our restaurant example, if someone is viewing a restaurant that offers Italian food, they can click on Italian to search for other Italian restaurants.

Click2Search can be enabled invididually for each custom field, and it also works with fields that have multiple values selected, where clicking on each option will lead to results matching that option.

You can customize the page title and meta description for Click2Search pages at the field level, but also for each field option. This is covered in more detail in the SEO section of the documentation. Learn more about using Click2Search and how to use it for SEO.

Click2Add - Adding Options On-The-Fly

Click2Add is custom field feature for select lists, that lets the person creating a listing, or a review, add new options for the field while submitting the form.

For example, if you start with just a handful of cuisine options for restaurants, you can enable Click2Add for the Cuisine Custom Field and allow users authorized to submit entries to easily create new virtual categories themselves.

Click2Add also works with field relations, but only when adding options to the last level of the relationship. For example, when using the State → City relationship, you can add the 50 U.S. states, and at least one city per state. Then when posting new listings, you can select the State, and if you need to add a new city for that state, just use Click2Add and submit the listing and the relationship will be automatically created.

One thing that real categories offer out of the box, is a hierarchy where you can click on categories and sub-categories for site navigation. The category structure is also visible in breadcrumbs.

Well, let me let you in on a little secret. The Fields Joomla Module and WordPress Widget allows you to implement virtual category navigation with support for breadcrumbs. And, it even allows drill-down navigation for related field options (e.g. Country → State → City. We'll get into this last point a bit further down.

Virtual category navigation pages are the same as Click2Search pages, so the SEO improvements for them also apply for navigation.

There's a couple of points to pay attention to here:

  1. You can publish the Fields Module/Widget to any page, but for navigation purposes, we recommend publising it to category pages only. In our example, we publish it to the Restaurants category.

  2. JReviews makes available a jr-listpage-below-pagetitle Joomla position which is convenient for virtual category navigation. The WordPress equivalent is the List page below heading widget position.

  3. For Click2Search navigation links to follow the main category URL structure set the module/widget Filtering Mode setting to Current Page Category.

Learn more about using the field module for navigation

Advanced Search And Filtering

Since virtual categories are custom fields, these can be easily included in search and filter forms allowing for very targeted searches. We've got very detailed sections on creating custom forms for Advanced Search and Advanced Filtering so you can explore those articles in more detail.

Adding Location Virtual Categories

We are now going to add the location virtual category structure for restaurants. We already created location custom fields for State and City in the Initial Setup article and we'll use those here.

Our setup includes field option relations where cities are controled by states. These relations can be used for navigation in the Fields Joomla Module and WordPress Widget when drill-down mode is enabled. The module will first show the States, and when when a specific value is clicked, the States dissapear, and instead the corresponding Cities take their place.

Our current virtual category setup looks something like this now.

├── Restaurant
    	◎── Cuisine
    	◎── State
              ◎── City
  

On the demo site, you can see a nice example of the location navigation using virtual categories. On that page you can see several of the features discussed above.

  • The fields module/widget is shown using the Find Listings by Location heading. When you click on a State, the breadcrumbs are updated and if there are cities setup for that state they are shown in place of the states. For example, click on California → Los Angeles.
  • On the left sidebar you find the Advanced Filtering form where you can narrow down the results based on Cuisine and Location using the same fields we've covered above.

Virtual categories remove the constraints imposed by hierarchical categories, adding flexibility for navigation, search, and allowing you to classify listings in more meaningful ways.