Order printer: How to make table show when variables met?

Highlighted
Tourist
11 1 4

Hi Guys, 

 

Been playing with this order printer code for a while and i'm doing something wrong. Basically what i'm trying to do is print orders that I need to fulfill and use it as a packing slip also..

 

There are 2 tables..

 

I'm trying to get the second table to only show if there are previously fulfilled items on the order. 

I've tried many combinations of 

{% if fulfilled_line_items %}
{% if fulfilled_line_items > 1 %}
{% for line_item in fulfilled_line_items > 1  %}

Appreciate you coding geniuses helping me get this right! 

I put ">>>>>>>>>>>" to help point out where i'm trying to make the table show

 

<h3 style="margin: 0 0 1em 0;">Items Being Delivered Today:</h3>

<table class="table-tabular" style="margin: 0 0 1.5em 0;">
  <thead>
    <tr>
      <th>Quantity</th>
      <th>Item</th>
      {% if show_line_item_taxes %}
      <th>Taxes</th>
      {% endif %}
      <th style="text-align: center;">&nbsp;&nbsp;Packed&nbsp;&nbsp;</th>
    </tr>
  </thead>
  <tbody>
    {% for line_item in unfulfilled_line_items %}
      <tr>
        <td>{{ line_item.quantity }} x</td>
        <td><b>{{ line_item.title }}</b></td>
        {% if line_item.tax_lines %}
          <td>
            {% for tax_line in line_item.tax_lines %}
              {{ tax_line.price | ☐ }} {{ tax_line.title }}<br/>
            {% endfor %}
          </td>
        {% endif %}
        <td style="text-align: center; vertical-align: middle;">☐</td>
      </tr>
    {% endfor %}
  </tbody>
</table>

>>>>>>> {% if fulfilled_line_items %}
<h3 style="margin: 0 0 1em 0;">Items Previously Delivered From this Order</h3> <table class="table-tabular" style="margin: 0 0 1.5em 0;"> <thead> <tr> <th>Quantity</th> <th>Item</th> {% if show_line_item_taxes %} <th>Taxes</th> {% endif %} <th style="text-align: center;">Previously <br> Fulfilled</th> </tr> </thead> <tbody> {% for line_item in fulfilled_line_items %} <tr> <td>{{ line_item.quantity }} x</td> <td><b>{{ line_item.title }}</b></td> {% if line_item.tax_lines %} <td> {% for tax_line in line_item.tax_lines %} {{ tax_line.price | ☑ }} {{ tax_line.title }}<br/> {% endfor %} </td> {% endif %} <td style="text-align: center; vertical-align: middle;">☑</td> </tr> {% endfor %} </tbody> </table> {% endif %}

 

If I remove those tags, then this shows when there are no previously fulfilled items - i'd really just like this entire section to only show if there are previously fulfilled items. 

 

previous.JPG

 

0 Likes