You can use the item.predecorated_product.category_name variable to show the name of the category a decorated product belongs to in the Order Template.
Here is an example of how you can modify the default Order Template to show the name of the category a decorated product belongs to:
Default Code
Code to be modified highlighted in red:
<table class="hundred">
<thead>
<tr>
<th>Product</th>
<th>Color</th>
<th>Size / Qty</th>
<th class="text_right">Unit Price</th>
{% if order.use_extra_line_item_columns %}
{% if order.has_a_discount %}
<th class="text_right">Discount</th>
<th class="text_right">Disc Unit Price</th>
{% endif%}
{% if order.has_taxes_against_items %}
<th class="text_right">Tax</th>
{% endif %}
{% endif %}
<th class="text_right">Qty</th>
<th class="text_right">Total</th>
</tr>
</thead>
<tbody>
{% assign colspan = 5 %}
{% if order.use_extra_line_item_columns %}
{% if order.has_a_discount %}
{% assign colspan = colspan | plus:2 %}
{% endif%}
{% if order.has_taxes_against_items %}
{% assign colspan = colspan | plus:1 %}
{% endif %}
{% endif %}
{% assign row_count = 1 %}
{% for item in order.main_items %}
<tr>
<td class="text_left" {% unless item.has_sizes_or_colors? %} colspan="3" {% endunless %}>
{{ row_count }}.
{% if (item.supplier_product) and (item.is_not_freeform?) %}
{{ item.supplier_product.product_code }} -
{% endif %}
{{ item.product_name }}
{% if item.product_based? %}
<br />
{% else %}
{% if item.has_extra_options? %} : {% endif %}
{% endif %}
{{ item.extra_options }}
</td>
Custom Code
Add/replace the code in red to the default code shown above as follows:
<table class="hundred">
<thead>
<tr>
<th>Product</th>
{% for item in order.main_items %}
{% if item.is_predecorated_product? %}
<th>Product Category</th>
{% endif %}
{% endfor %}
<th>Color</th>
<th>Size / Qty</th>
<th class="text_right">Unit Price</th>
{% if order.use_extra_line_item_columns %}
{% if order.has_a_discount %}
<th class="text_right">Discount</th>
<th class="text_right">Disc Unit Price</th>
{% endif%}
{% if order.has_taxes_against_items %}
<th class="text_right">Tax</th>
{% endif %}
{% endif %}
<th class="text_right">Qty</th>
<th class="text_right">Total</th>
</tr>
</thead>
<tbody>
{% assign colspan = 6 %}
{% if order.use_extra_line_item_columns %}
{% if order.has_a_discount %}
{% assign colspan = colspan | plus:2 %}
{% endif%}
{% if order.has_taxes_against_items %}
{% assign colspan = colspan | plus:1 %}
{% endif %}
{% endif %}
{% assign row_count = 1 %}
{% for item in order.main_items %}
<tr>
<td class="text_left" {% unless item.has_sizes_or_colors? %} colspan="3" {% endunless %}>
{{ row_count }}.
{% if (item.supplier_product) and (item.is_not_freeform?) %}
{{ item.supplier_product.product_code }} -
{% endif %}
{{ item.product_name }}
{% if item.product_based? %}
<br />
{% else %}
{% if item.has_extra_options? %} : {% endif %}
{% endif %}
{{ item.extra_options }}
</td>
{% if item.is_predecorated_product? %}
<td class="text_left">
{{ item.predecorated_product.category_name }}
</td>
{% endif %}
Comments
0 comments
Please sign in to leave a comment.