Mail: [email protected] Phone: +1(628) 800-7750
Everything you need to know about NexoPOS.
A printing handler is a service or a script used to manage printing. By default, NexoPOS comes with a default print handler which is the browser printing. However sometime, you might want to print differently an order. That technique was used by Nexo Print Adapter which inject on NexoPOS a new custom print handler.
This guide will share how to create your own print handler.
Before creating a print handler, you need to be familiar with creating modules on NexoPOS. We really do not recommend you touch the source code. You should also know how to inject views on the footer.
The first step is to register our customer print gateway. This will be made by adding on your ServiceProvider.php the following snippet.
This will inject the new option into the Printing settings.
Now that we've created a new handler, we need to catch every print request submitted from the POS screen. We then need to inject a view on the footer of the POS. This can be made using the hook "ns-dashboard-pos-footer" and then by loading a view within the module Resources/Views directory.
Now, every time we're printing with that custom print gateway selected, that log should appear on the console.
The reason of providing a custom print handler is to be able to print as you desire. As you can see, you get the order id that you can use to perform an async request to retrieve either the default printing template:
But you can also make custom calls to your modules API to retrieve the order details. Remember while loading users you can pull: customers, products, refund, payments, etc like this.
From there, you can basically do everything you want.