HaaseIT/HCSF

View on GitHub
src/views/shop/shoppingcarttable-mail.twig

Summary

Maintainability
Test Coverage
<link rel="stylesheet" type="text/css" href="/screen-shc.css">
{% if customdata.shoppingcart.readonly == false %}
    <script language="JavaScript" async="async">
        function removeFromCart(id) {
            var o = new Option("0", "0");
/// jquerify the DOM object 'o' so we can use the html method
            $(o).html("0");
            $("#shc_amount_"+id).append(o);
            $("#shc_amount_"+id).val("0");
            $("#shc_form_"+id).submit();
        }
    </script>
    {% set formcounter = 0 %}
{% endif %}
{% for thiscartkey, thiscart in customdata.shoppingcart.cart %}
    {% if customdata.shoppingcart.readonly == false %}
        <form action="/_misc/update-cart.html" method="POST" id="shc_form_{{ formcounter }}">
        {% if custom_order_fields is defined and custom_order_fields|length > 0 %}
            {% set thiscartkeys = thiscartkey|split('|') %}
            <input type="hidden" name="itemno" value="{{thiscartkeys[0]}}">
            {% for thiscartkeys_current in thiscartkeys %}
                {% set thiscartkeys_current_split = thiscartkeys_current|split(':') %}
                {% if thiscartkeys_current_split[0] in custom_order_fields %}
                    <input type="hidden" name="{{ thiscartkeys_current_split[0] }}" value="{{ thiscartkeys_current_split[1] }}">
                {% endif %}
            {% endfor %}
        {% else %}
            <input type="hidden" name="itemno" value="{{thiscartkey}}">
        {% endif %}
    {% endif %}
    <table class="shctable">
        <tr>
            <td class="shctablecol1">
                <img src="{{ customdata.mail is defined ? 'cid:'~thiscart.img : '' }}">
            </td>
            <td class="shctablecol2">
                {{thiscart.name}}<br>
                {% if custom_order_fields is defined and custom_order_fields|length > 0 %}
                    {% set thiscartkeys = thiscartkey|split('|') %}
                    {{T("shoppingcart_item_itemno")}} {{thiscartkeys[0]}}
                    {% for thiscartkeys_current in thiscartkeys %}
                        {% set thiscartkeys_current_split = thiscartkeys_current|split(':') %}
                        {% if thiscartkeys_current_split[0] in custom_order_fields %}
                            <br>{{ T("shoppingcart_item_" ~ thiscartkeys_current_split[0] )}} {{ thiscartkeys_current_split[1] }}
                        {% endif %}
                    {% endfor %}
                {% else %}
                    {{T("shoppingcart_item_itemno")}} {{thiscartkey}}
                {% endif %}
                <br>
                {{thiscart.amount}}x
                {{(thiscart.price.brutto_use * thiscart.amount)|number_format(numberformat_decimals, numberformat_decimal_point, numberformat_thousands_seperator)}} {{currency}}
            </td>
        </tr>
    </table>
    {% if customdata.shoppingcart.readonly == false %}
        </form>
        {% set formcounter = formcounter + 1 %}
    {% endif %}
{% endfor %}
<br>
    {% if customdata.shoppingcart.additionalcoststoitems.fVersandkostenbrutto > 0 %}
            {{T("shoppingcart_tablefoot_shippingcost")}}:
            {{customdata.shoppingcart.additionalcoststoitems.fVersandkostenbrutto|number_format(numberformat_decimals, numberformat_decimal_point, numberformat_thousands_seperator)}} {{currency}}
        <br><br>
    {% endif %}
        <strong>{{T("shoppingcart_tablefoot_sumbrutto")}}:
        {{customdata.shoppingcart.additionalcoststoitems.fGesamtbrutto|number_format(numberformat_decimals, numberformat_decimal_point, numberformat_thousands_seperator)}} {{currency}}</strong>