If Else Twig for Barcodes?

darryl_ssdarryl_ss Member Posts: 65

Hi,

Does Lightspeed support If Else for the barcodes?

I've tried the below, but it doesn't appear to work. Does anybody have any tips on a workaround?

 {% if (Label.Item.ean) %}
            <img class="ean8" src="/barcode.php?type=label&amp;number={{ Label.Item.ean }}&amp;ean8=1&amp;noframe=1encoding=code128">
    ...   {% else %}
            <img class="ean8" src="/barcode.php?type=label&amp;number={{ Label.Item.systemSku }}&amp;ean8=1&amp;noframe=1">
          {% endif %}
          {% if (Label.Item.ean) %}
            <img class="ean" src="/barcode.php?type=label&amp;number={{ Label.Item.ean}}&amp;noframe=1&amp;encoding=code128">
    ...   {% else %}
            <img class="ean" src="/barcode.php?type=label&amp;number={{ Label.Item.systemSku }}&amp;noframe=1">
          {% endif %}     
Tags:

1 comment

  • darryl_ssdarryl_ss Member Posts: 65

    For anybody that's looking for this information, I resolved this by using:

     {% if Label.Item.ean is empty %}
        ...     <img class="ean8" src="/barcode.php?type=label&amp;number={{ Label.Item.systemSku }}&amp;ean8=1&amp;noframe=1">
                <img class="ean" src="/barcode.php?type=label&amp;number={{ Label.Item.systemSku }}&amp;noframe=1">
              {% endif %}
    
Sign In or Register to comment.