Creating drop-down based on data from database


#1

Hi Guys,
Im just a beginner,
But I want to make instead of this side menu a dropdown menu.
As you can see, it is database driven, so it takes out everything from the database since we can make news "brands" to choose from.
But if I make a dropdown, bootstrap creates one dropdown menu for each brand.
And how do I make a second dropdown based on the brand you choose in the first dropdown?


<div class="side_menu_container">
    <h1>
        merken
    </h1>
    {% for item in brandnavigation|default(false) %}
        <div class="side_menu_first">
            <a href="{% if item.brand.brandname == activeCategory|default('') %}
                    {{ url('creativebits_coolwall_review_category', {'category': item.subcategory.maincategory.name|replace({" ":"_", "/":"\\"}) }) }}
                {% else %}
                   {{ url('creativebits_coolwall_review_category_brand', {'category': item.subcategory.maincategory.name|replace({" ":"_", "/":"\\"}), 'brand':item.brand.brandname|replace({" ":"_", "/":"\\"}) }) }}
                {% endif %}
            ">
                {{ item.brand.brandname }}
            </a>
        </div>
        {% if menubrands is defined %}
            {% for model in menubrands %}
                {% if model.brand.brandname == item.brand.brandname %}
                    <div class="side_menu_second">
                        <a{% if activeProduct|default(null) == model.name %} class="active"{% endif %} href="{{ url('creativebits_coolwall_review_category_product', {'category': item.subcategory.maincategory.name|replace({" ":"_", "/":"\\"}), 'brand':item.brand.brandname|replace({" ":"_", "/":"\\"}), 'product':model.name|replace({" ":"_", "/":"\\"}) }) }}">
                            {{ model.name}}
                        </a>
                    </div>
                {% endif %}
            {% endfor %}
        {% else %}
            {% for model in branditem|default(false) %}
                {% if model.brand.brandname == item.brand.brandname %}
                    <div class="side_menu_second">
                        <a href="{{ url('creativebits_coolwall_review_category_product', {'category': item.subcategory.maincategory.name|replace({" ":"_", "/":"\\"}), 'brand':item.brand.brandname|replace({" ":"_", "/":"\\"}), 'product':model.name|replace({" ":"_", "/":"\\"}) }) }}">
                            {{ model.name}}
                        </a>
                    </div>
                {% endif %}
            {% endfor %}
        {% endif %}
    {% endfor %}
</div>


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.