I'm stuck on a problem with categories. I never worked with them before so maybe it's not as difficult a I think.

I need the following structure:

Type of company 1 (e.g. Bakery)
-Bakery 1 + website
-Bakery 2 + website
-Bakery 3 + website

Type of company 2 (e.g. Supermarket)
-Super 1 + website
-Super 2 + website
-Super 3 + website

So my parent categories only need 1 field (type of company) and the children need 2 types of fields (url + company name)

How can I accomplish this?


I would just leave the URL field blank for parent categories.

In the template you could check if the the category is level two before outputting the URL field.

{% if category.level == 2 and category.categoryUrl %}
    {{ category.categoryUrl }}
{% endif %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.