{extends file="email-layout.tpl"}

{* Open in browser  *}
{block name="browser"}{/block}

{* Subject  *}
{block name="email-subject"}{intl l="Your order confirmation Nº %ref" ref={$order_ref}}{/block}

{* Title  *}
{block name="email-title"}{intl l="Thank you for your order!"}{/block}

{* Content  *}
{block name="email-content"}

        {loop name="order.invoice" type="order" id=$order_id customer="*"}
            {loop name="currency.order" type="currency" id=$CURRENCY}
                {assign "orderCurrencySymbol" $SYMBOL}
                {assign var="orderCurrencyIsoCode" value=$ISOCODE}
            {/loop}
        {loop type="customer" name="customer.invoice" id=$CUSTOMER current="0"}
            {assign var="customerRef" value=$REF}
        {/loop}

        {intl l="Here are the details of your purchase:"}<br /><br />

        <table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td valign="top" width="55%">
                    <strong>{intl l="Delivery address:"}</strong><br>
                    {loop type="order_address" name="delivery_address" id=$DELIVERY_ADDRESS}
                    {$FIRSTNAME} {$LASTNAME}<br />
                    {$ADDRESS1}<br>
                    {if $ADDRESS2 != ""}{$ADDRESS2}<br />{/if}
                    {if $ADDRESS3 != ""}{$ADDRESS3}<br />{/if}
                    {$CITY}<br />
                    {$ZIPCODE}, {loop type="country" name="country_delivery" id=$COUNTRY}{$TITLE}{/loop}<br />
                    {/loop}
                </td>
                <td valign="top">
                    <strong>{intl l="Billing address:"}</strong><br />
                    {loop type="order_address" name="invoice_address" id=$INVOICE_ADDRESS}
                    {$FIRSTNAME} {$LASTNAME}<br />
                    {$ADDRESS1}<br>
                    {if $ADDRESS2 != ""}{$ADDRESS2}<br />{/if}
                    {if $ADDRESS3 != ""}{$ADDRESS3}<br />{/if}
                    {$CITY}<br />
                    {$ZIPCODE}, {loop type="country" name="country_delivery" id=$COUNTRY}{$TITLE}{/loop}<br />
                    {/loop}
                </td>
            </tr>
        </table>

        <br />

        <p>
            {intl l="Order Total:"} {$TOTAL_TAXED_AMOUNT} {$orderCurrencySymbol} <span style="font-size:90%;color:#777">{$orderCurrencyIsoCode}</span><br />
            {intl l="Order Number:"} {$REF}<br />
            {intl l="Paid With:"} {loop name="payment-module" type="module" id=$PAYMENT_MODULE}{$TITLE}{/loop}<br />
            {intl l="Purchase Date:"} {format_date date=$CREATE_DATE output="date"}<br />
            {intl l="Delivery method:"} {loop name="delivery-module" type="module" id=$DELIVERY_MODULE}{$TITLE}{/loop}<br />
        </p>

        <table width="100%" border="0" cellpadding="0" cellspacing="0" style="font-size:13px;line-height:2em">
            <tr style="color:#999;font-size:11px">
                <td style="color:#999;border-bottom:1px solid #000">What You Purchased</td>
                <td align="right" style="color:#999;border-bottom:1px solid #000">Price in {$orderCurrencyIsoCode}</td>
            </tr>
            {loop type="order_product" name="order-products" order=$ID}
            {if $WAS_IN_PROMO == 1}
                {assign "realPrice" $PROMO_PRICE}
                {assign "realTax" $PROMO_PRICE_TAX}
                {assign "realTaxedPrice" $TAXED_PROMO_PRICE}
            {else}
                {assign "realPrice" $PRICE}
                {assign "realTax" $PRICE_TAX}
                {assign "realTaxedPrice" $TAXED_PRICE}
            {/if}
                <tr>
                    <td style="border-bottom:1px solid #000">
                        <b>{$TITLE}</b> <i>({$REF})</i>
                        {ifloop rel="combinations"}<br />
                        {loop type="order_product_attribute_combination" name="combinations" order_product=$ID}
                            <span style="color:#999;display:block;font-size:11px;line-height:1.2">* {$ATTRIBUTE_TITLE}: {$ATTRIBUTE_AVAILABILITY_TITLE}</span>
                        {/loop}
                        {/ifloop}
                    </td>
                    <td align="right" style="border-bottom:1px solid #000">
                        {$QUANTITY} x {$realTaxedPrice} {$orderCurrencySymbol}
                    </td>
                </tr>
            {/loop}
            <tr>
                <td align="right" style="text-align:right">{intl l="Total"}</td>
                <td align="right" style="text-align:right">{$TOTAL_TAXED_AMOUNT - $POSTAGE} {$orderCurrencySymbol}</td>
            </tr>
            <tr>
                <td align="right" style="text-align:right">{intl l="Shipping:"}</td>
                <td align="right" style="text-align:right">{$POSTAGE} {$orderCurrencySymbol}</td>
            </tr>
            <tr>
                <td align="right" style="text-align:right"><strong>{intl l="Order Total"}</strong></td>
                <td align="right" style="text-align:right"><strong>{$TOTAL_TAXED_AMOUNT} {$orderCurrencySymbol}</strong></td>
            </tr>
        </table>
    {/loop}

    <br />

    <h2>{intl l="Support"}</h2>
    {intl l='For any questions, or concerns, feel free to contact <a href="mailto:%mail" style="color:#3c69c1;text-decoration:none" target="_blank">%mail</a>.' mail={config key="store_email"}}<br /><br />
    <b>{intl l="Our contact us at:"}</b> <br />
    {config key="store_name"}<br>
    {config key="store_address1"}<br />
    {config key="store_zipcode"}, {config key="store_city"}<br />
    {loop type="country" name="store_country" id={config key="store_country"}}
        {$TITLE}
    {/loop}

    <br />
    <br />
    {intl l="Thanks"}<br />
{/block}
