2

我想计算结果。我已经像总组结果和总结果一样完成了一个产品....

喜欢:-

总产品组 = 15

在一组显示 36 个产品。

在第二组显示 56 个产品。

我想显示总组产品结果 = 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 回答