Taxonomies and taxons
Taxonomies and taxons provide a robust way to classify and categorize products.
They belong to the
Administrators can define as many structures as they need from Solidus's
backend. Then, they can associate individual products with any number of
taxonomies or taxons using the
When working with taxonomies there are two key terms to understand:
- Taxonomy: A hierarchical list which is made up of individual taxons. Each taxonomy relates to one taxon, which is its root node.
- Taxon: A single child node which exists at a given point within a taxonomy. Each taxon can contain additional child taxons. Administrators can define as many Taxonomies as needed and link a product to multiple taxons from each taxonomy.
Use taxonomies to define the ways that you want to classify products in your store at a high level. They are the parent nodes for taxons.
The following taxonomies are common in ecommerce stores:
Once the taxonomies have been established, you can start to break down the lower-level organization by adding child nodes, called taxons.
For example, if you decide to create
Brands as taxons, your
taxonomies might look like this:
Categories |-- Luggage |-- Clothing |-- T-shirts |-- Socks |-- Shoes Brands |-- Adidas |-- Bentley |-- Calvin Klein
Taxons can have child taxons. For example, a
Clothing taxon may have further
Classifications and taxon management
Spree::Products become associated with taxons through the
This model exists so that if a product is deleted, all of the links from that product to its taxons are also deleted. A similar action takes place when a taxon is deleted: all of the links to products are deleted automatically.
Using taxons in controllers and templates
Linking to a taxon in a controller or a template should be done using the
spree.nested_taxons_path helper, which uses the taxon's permalink to
generate a URL such as
Taxons use the Nested set model for their hierarchy.
rgt properties on the
Spree::Taxons model represent the
locations within the hierarchy of the item. This logic is handled by the
awesome_nested_set gem. See [the gem's documentation][awesome-nested-set]
for more information about these fields.
Solidus is an open source platform supported by the community. We encourage everyone using Solius to contribute back to the documentation and the code.