EDIT: Some useful background in my post, but @QMcKay’s method is nicer. Infact, I am not even sure if mine works now, can you use XCT commands conditionally Q?
Cash drawers are usually triggered using RJ11 cable connected to your printer.
Your printer will normally call this functionality a “kick”
You printer will normally also have additional functionality such as a cutter.
Inside the configuration software for your printer you can normally specify if the printer should cut and/or kick at the end of each ticket it prints. So, first, using the diagnostics for your printer, check that it is able to successfully ‘kick’ your drawer.
Since you DO NOT want the drawer to open for every ticket (only ones which involve cash) you should NOT enable “kick every ticket” inside your printer configuration.
Many thermal printers use the ESC/POS protocol to communicate. This protocol provides the ability of your to specify printer functions in real time. The types of things you can typically change are:
- Font style
- Font size
- Inverse (white text on black background)
- Print speed
- Trigger cutter
- Trigger kick
You can send these commands directly to the printer from within the SambaPOS printer template using <XCT>
commands.
You’ll need to double check the specific codes that will be required for your printer by taking a close look at the product manual, but for me the command <XCT>27,112,0,50,250
will trigger the printer to kick the drawer.
If you put this command in your printer template then the drawer will always open.
If you want to only only kick the drawer when someone pays using cash, then you can take a look at IF statements within the printer template. Take a look at this example…
[= TN('{PAYMENT TOTAL:Cash}') > 0 ? '<L00>You paid using cash!']
[= TN('{PAYMENT TOTAL:Cash}') > 0 ? '<XCT>27,112,0,50,250']
The above example will print a message on the ticket confirming the client paid in cash and will then kick the drawer.