2

resusltを合計したい。私はすでにグループ全体の結果のようにそれを行い、合計で1つの製品になりました...。

お気に入り:-

製品のグループ全体=15

36の製品を示す1つのグループ。

56の製品を示す2番目のグループ。

グループ製品の合計結果=36+ 56=>92を表示したい。forループなし。

小枝ファイル:

<table>
<h2> Showing {{ templates | length  }} Products</h2>

    {% for groupResults in templates %}
       {% if groupResults.doclist.docs[0].first_product_name is defined %}


            Show all {{ groupResults | length }} results



        <tr>
            <td>
            {{ groupResults.doclist.docs[0].first_product_name }}




            &nbsp;
            {% if groupResults.doclist.numFound > 4 %}
            <a href="{{ path("design_picker_catalog", { "productSlug": groupResults.doclist.docs[0].first_product_slug, "search": searchTerm }) }}" style="float:right">Show all {{ groupResults.doclist.numFound }} results</a>
            {% endif %}
            </td>
        </tr>

        <tr> 
        {% set count = 0 %}
        {% for template in groupResults.doclist.docs %}
            <td>
                <a href="{{ path("customer_design_editor", { "templateSlug": template.slug, "productSlug": template.product_slug[0] }) }}">
                    <img src="{{ path("design_template_thumbnail_by_slug", { "slug": template.slug}) }}" alt="" />
                </a>
            </td>
            {% set count = count + 1 %}
        {% endfor %}
        {% if count < 4 %}
        {% for i in count..3 %}
            <td>&nbsp;</td>
        {% endfor %}
        {% endif %}
    {% else %}
    {% endif %}     
    {% endfor %}

4

1 に答える 1

4

どうですか:

{% set totalCount = firstGroup|length + secondGroup|length %}
于 2013-01-21T20:05:07.947 に答える