.. include:: _include.rst
.. highlight:: bbcode
.. _repo_advanced:
############################
Repo Advanced
############################
*******************
Categories and Tags
*******************
Like you know it from standard posts, you can use categories and tags with Repo items.
In this example, the Jedi Interceptor is settled in the LEGO category **"Star Wars"** and I tagged it with **"spaceship"** and **"yellow"**.
.. image:: _static/repo_edit_cat_tag.png
:height: 720px
:width: 815px
:scale: 100%
:alt: ASA 2 Repo categories and tags
Now you can use |asa2|'s shortcode :ref:`shortcodes_asa2_smart_collection` to dynamically embed items on your pages based on categories and tags.
For example, if you want to embed three items from the category "Star Wars" tagged with "spaceship", you could use the following shortcode:
.. code::
[asa2_smart_collection cat_slug="starwars" tag="spaceship" limit="3"]
You want to show 10 "yellow" tagged items in a random order? Use this shortcode:
.. code::
[asa2_smart_collection tag="yellow" limit="10" orderby="random"]
*********************************
Shortcode [asa2_smart_collection]
*********************************
The shortcode :ref:`shortcodes_asa2_smart_collection` is one of the **most powerful features** of |asa2|. With it you can create **dynamic queries** to your |repo| with filters for many relevant product properties.
For example, to display only Star Wars spaceships having a better average rating than 4, use this shortcode:
.. code::
[asa2_smart_collection cat_slug="starwars" tag="spaceship" rating_gt="4"]
You can also add a price filter. This example would only display Repo items with a main price lower than 100.
.. code::
[asa2_smart_collection cat_slug="starwars" tag="spaceship" rating_gt="4" main_price_lt="100"]
Check the shortcode page :ref:`shortcodes_asa2_smart_collection` for a detailed list of all available options.
.. _repo_adv_custom_fields:
*************
Custom Fields
*************
Another powerful feature is the use of Custom Fields with your Repo items.
On https://asa2-demo.de/custom-fields/ I have setup Custom Fields for my personal rating and my recommendation on a product. The easiest way to create these, is with the plugin `Advanced Custom Fields
My personal rating: {{ repo_custom_field_my_rating }}
{% endif %} And to show if I recommend a product: .. code:: {% if repo_custom_field_recommendation == "yes" %}I recommend this product!
{% endif %} .. note:: Learn more about |asa2|'s :ref:`template_syntax`. Of course I could display anything instead of just text, for instance load an image with my custom rating stars or a recommendation badge etc. This is just a demonstration of what is possible with custom fields on Repo items and |asa2|'s conditional template syntax.