Printing encoded product cost on label

(Note: To enable any command remove <!– at the start and –> at the end of the command lines. Disabled commands will be green in color, once enabled the color changes to black and red combination, for commands with at the start just remove the , for single line commands with // at the start remove the // to enable)

Administration Menu > Maintenance > Resources
Use below template in Printer.Label to encode and print product cost on label. You may use some meaningful phrase for encryption key.

<?xml version="1.0" encoding="UTF-8"?>
<label>
<text width="20" height="20" x="280" y="20">$product.printName()</text>
<barcode x="320" y="110" type="CODE128" height="50" width="2" readable="N">$product.getCode()</barcode>
<text width="30" height="30" x="280" y="170">Price:$line.printPriceSellTax()</text>
#set($message = $line.printPrice())
#set($key = "ABCDEFGHIJK")
#set($alphabet = "0123456789")
#set($coded = "")
#foreach ($index in [0..$message.length()])
    #set($nextChar = $index+1)
    #if ($nextChar <= $message.length())
        #set($curChar = $message.substring($index, $nextChar))
        #set($charIndex = $alphabet.indexOf($curChar))             
            #if ($charIndex == -1)                     
                #set($coded = $coded + $curChar)                 
            #else {                                    
                #set($coded = $coded + $key.charAt($charIndex))     
            #end
    #end
#end
<text width="30" height="30" x="480" y="170">$coded</text>
</label>

Save

0 Comments

Leave a Reply

Arrow-up