minor text email receipt formatting issue

dustystringsdustystrings Member
in Help edited December 2014
I am slightly modifying the text email template, and I must have done something to mess up the formatting because each new item name starts right after the price from the previous item (on the same line, no space in between) instead of appearing on its own line. Here's the code I copied from cart.inc.txt.twig, with a modification to hide one custom option. It seems like there's probably something obvious I've missed, but I don't know what a line break would look like in twig!
{# BEGIN CART TWIG TEMPLATE #}
{{ config.lang.email_text_cart|pad(60,"-"," ") }}
{% set show_product_options = true %}
{% set show_product_weight = true %}
{% set show_product_category = true %}
{% set show_product_code = true %}
{% if config.template_config.cart_display_config.usage != "none" %}
{%- set show_product_options = config.template_config.cart_display_config.show_product_options -%}
{%- set show_product_weight = config.template_config.cart_display_config.show_product_weight -%}
{%- set show_product_category = config.template_config.cart_display_config.show_product_category -%}
{%- set show_product_code = config.template_config.cart_display_config.show_product_code -%}
{% endif %}
{% for item in items %}
{% if item.multiship >= 0 %}
{% set shipto_label = config.lang.cart_shipto ~ item.shipto %}
{{ shipto_label|pad(40,"-"," ") }}
{% endif %}
{{ item.name }}
{% if show_product_options %}
{% for option in item.options %}
{% if option.class != "no_first_class" %}
* {{ option.name|pad(15) }} {{ option.value }}
{% endif %}
{% endfor %}
{% endif %}
{% if item.code != '' and show_product_code %}
* {{ config.lang.cart_code|pad(15) }} {{ item.code }}
{% endif %}
{% if item.category != 'DEFAULT' and show_product_category %}
* {{ config.lang.cart_category|pad(15) }} {{ item.category }}
{% endif %}
{% if item.weight != 0 and show_product_weight %}
* {{ config.lang.cart_weight|pad(15) }} {{ item.weight }} {{ weight_uom }}
{% endif %}
{% if item.sub_frequency != '' %}
* {{ config.lang.cart_subscription_details }}
- {{ config.lang.cart_frequency|pad(11) }} {{ item.sub_frequency }}
- {{ config.lang.cart_start_date|pad(11) }} {{ item.sub_startdate }}
- {{ config.lang.cart_next_date|pad(11) }} {{ item.sub_nextdate }}
{% if item.sub_enddate != "0000-00-00" %}
- {{ config.lang.cart_end_date|pad(11) }} {{ item.sub_enddate }}
{% endif %}
{% endif %}
* {{ config.lang.cart_quantity|pad(15) }} {{ item.quantity }}
* {{ config.lang.cart_price|pad(20) }} {{ item.price|money_format }}{% if item.quantity > 1 and item.price_each > 0 %} ({{ item.price_each|money_format }} {{ config.lang.cart_each }}{% if (((item.price_each * 10000) % 100) != 0) %}... {{ item.price_each }}{% endif %}){% endif %}
{% endfor %}
{{ config.lang.cart_subtotal|pad(24) }} {{ total_item_price|money_format }}
{% if has_future_products %}
{{ config.lang.cart_future_subscriptions|pad(24) }} {{ total_future_item_price|money_format }}
{% endif %}
{% for key,coupon in coupons %}
{% set coupon_label = coupon.name ~ " (" ~ key ~ ")" %}
{{ coupon_label|pad(24) }} {{ coupon.amount|money_format }}
{% endfor %}
{{ shipping_and_handling_label|pad(24) }} {{ total_shipping|money_format }}
{% if has_future_products and show_future_shipping_and_handling %}
{% set future_shipping_handling_label = lang.cart_future_subscriptions ~ " " ~ shipping_and_handling_label %}
{{ future_shipping_handling_label|pad(24) }} {{ future_shipping_and_handling|money_format }}
{% endif %}
{% if has_taxes %}
{% if has_multiship %}
{{ config.lang.cart_tax|pad(24) }} {{ total_tax|money_format }}
{% else %}
{% for tax in shipping_address.taxes %}
{{ tax.name }} ({{ tax.rate }}%) {{ config.lang.cart_tax|pad(24) }} {{ tax.amount|money_format }}
{% endfor %}
{% endif %}
{% endif %}
{{ config.lang.cart_order_total|pad(24) }} {{ total_order|money_format }}
{# END CART TWIG TEMPLATE #}
Comments
  • fc_adamfc_adam FoxyCart Team
    @dustystrings,

    You are missing some blank lines that are causing the formatting to collapse a little - give this a try:
    {# BEGIN CART TWIG TEMPLATE #}
    {{ config.lang.email_text_cart|pad(60,"-"," ") }}
    {% set show_product_options = true %}
    {% set show_product_weight = true %}
    {% set show_product_category = true %}
    {% set show_product_code = true %}
    {% if config.template_config.cart_display_config.usage != "none" %}
        {%- set show_product_options = config.template_config.cart_display_config.show_product_options -%}
        {%- set show_product_weight = config.template_config.cart_display_config.show_product_weight -%}
        {%- set show_product_category = config.template_config.cart_display_config.show_product_category -%}
        {%- set show_product_code = config.template_config.cart_display_config.show_product_code -%}
    {% endif %}
    {% for item in items %}
    {% if item.multiship >= 0 %}
    
    {% set shipto_label = config.lang.cart_shipto ~ item.shipto %}
    {{ shipto_label|pad(40,"-"," ") }}
    
    {% endif %}
    {{ item.name }}
    {% if show_product_options %}
    {% for option in item.options %}
    {% if option.class != "no_first_class" %}
      * {{ option.name|pad(15) }} {{ option.value }}
    {% endif %}
    {% endfor %}
    {% endif %}
    {% if item.code != '' and show_product_code %}
      * {{ config.lang.cart_code|pad(15) }} {{ item.code }}
    {% endif %}
    {% if item.category != 'DEFAULT' and show_product_category %}
      * {{ config.lang.cart_category|pad(15) }} {{ item.category }}
    {% endif %}
    {% if item.weight != 0 and show_product_weight %}
      * {{ config.lang.cart_weight|pad(15) }} {{ item.weight }} {{ weight_uom }}
    {% endif %}
    {% if item.sub_frequency != '' %}
      * {{ config.lang.cart_subscription_details }}
          - {{ config.lang.cart_frequency|pad(11) }} {{ item.sub_frequency }}
          - {{ config.lang.cart_start_date|pad(11) }} {{ item.sub_startdate }}
          - {{ config.lang.cart_next_date|pad(11) }} {{ item.sub_nextdate }}
    {% if item.sub_enddate != "0000-00-00" %}
          - {{ config.lang.cart_end_date|pad(11) }} {{ item.sub_enddate }}
    {% endif %}
    {% endif %}
      * {{ config.lang.cart_quantity|pad(15) }} {{ item.quantity }}
      * {{ config.lang.cart_price|pad(20) }} {{ item.price|money_format }}{% if item.quantity > 1 and item.price_each > 0 %} ({{ item.price_each|money_format }} {{ config.lang.cart_each }}{% if (((item.price_each * 10000) % 100) != 0) %}... {{ item.price_each }}{% endif %}){% endif %}
    
    
    {% endfor %}
    {{ config.lang.cart_subtotal|pad(24) }} {{ total_item_price|money_format }}
    {% if has_future_products %}
    {{ config.lang.cart_future_subscriptions|pad(24) }} {{ total_future_item_price|money_format }}
    {% endif %}
    {% for key,coupon in coupons %}
    {% set coupon_label = coupon.name ~ " (" ~ key ~ ")" %}
    {{ coupon_label|pad(24) }} {{ coupon.amount|money_format }}
    {% endfor %}
    {{ shipping_and_handling_label|pad(24) }} {{ total_shipping|money_format }}
    {% if has_future_products and show_future_shipping_and_handling %}
    {% set future_shipping_handling_label = lang.cart_future_subscriptions ~ " " ~ shipping_and_handling_label %}
    {{ future_shipping_handling_label|pad(24) }} {{ future_shipping_and_handling|money_format }}
    {% endif %}
    {% if has_taxes %}
    {% if has_multiship %}
    {{ config.lang.cart_tax|pad(24) }} {{ total_tax|money_format }}
    {% else %}
    {% for tax in shipping_address.taxes %}
    {{ tax.name }} ({{ tax.rate }}%) {{ config.lang.cart_tax|pad(24) }} {{ tax.amount|money_format }}
    {% endfor %}
    {% endif %}
    {% endif %}
    {{ config.lang.cart_order_total|pad(24) }} {{ total_order|money_format }}
    
    {# END CART TWIG TEMPLATE #}
    
  • Thank you! I hadn't realized the spaces were important. :-)
Sign In or Register to comment.