Customizing the print template for barcode labels

278 views
Skip to first unread message

David Harty

unread,
May 2, 2014, 3:44:16 PM5/2/14
to merchantos-a...@googlegroups.com

Hi. I am new to Lightspeed Cloud. We are a bookstore and I am trying to customize the print template so the printout mimics our existing store labels. I need help with 4 things:

 1) How can I include the data from the “Vendor” field onto the label?

 2) How can I disable “word wrapping”? Long book titles push the barcode off of the label.

 3) How do I display the EAN on the label?

 4) Is the barcode related to the EAN? If not, how do you print a barcode that pulls up the correct record when scanned?

dan.s...@lightspeedretail.com

unread,
May 6, 2014, 11:28:12 AM5/6/14
to merchantos-a...@googlegroups.com
Hey David,

I would highly recommend looking at Account.DisplayTemplate.Label in the API Documentation to see what data you can pull from the API to put on labels. A neat trick is to print a label and change the '.html' to '.xml' in the URL on the label window, which will show a live example of the data you can access.

That being said:
1. You can access the Default Vendor ID (The part # is only accessible when printing from a Purchase Order)
2. The way you disable word wrapping is completely up to you. One way is to add 'white-space: nowrap; overflow: hidden;' to the description style (this is just one way of doing it)
3 and 4. The barcode is based on the System ID for the item being printed. The barcode image is automatically generated off of this number using a image generating script. You can try replacing that number, but more than likely it is going to cause issues and  cause the image to not work correctly (based on past experiences). You could always link to an external process to generate a barcode based on the EAN you want, but that could prove tricky.

Hope that helps!

-Dan

tom.byron....@gmail.com

unread,
Jan 11, 2016, 9:17:53 AM1/11/16
to Lightspeed Retail API Developers
3 & 4 only, read Dans response for these and test the EAN scanning in LS. Hint, what happens when you put the EAN for one product in the UPC field of another product, or the description, etc.

This is not directly comparable to what I have tested so you will want to clean the code up a bit. Throw a ternary in for hide_barcode_sku so you can get rid of hide_text and toss out localsku if you are only going to be using EAN and just reference Label.Item.ean. If you are storing EAN with check digit (13 digits long) you need to use a string operator to remove the last number as the LS barcode generator adds the checkdigit for you.

{% if hide_barcode == false %}
    {% if hide_barcode_sku == true %}
        {% set hide_text = 1 %}
    {% else %}
        {% set hide_text = 0 %}
    {% endif %}
    {% set localsku = Label.Item.ean %}
    {% if localupc | strlen == 13 %}  {# EAN-13 w/ check digit #}
        {# get rid of last digit in localsku here #}
    {% endif %}
    <img class="ean13" src="/barcode.php?type=label&amp;number={{ localsku }}&amp;ean13=1&amp;noframe=1&amp;hide_text={{ hide_text }}">


And I'm just going to drop this here as an example of what Dan referenced with "external process to generate a barcode". DO NOT DO EXACTLY THIS, you need to use a reliable generator and not just the first thing I googled.
Reply all
Reply to author
Forward
0 new messages