Prestashop and remote printing

21 views
Skip to first unread message

Julien Studer

unread,
Apr 29, 2024, 4:35:33 AMApr 29
to qz-print
Hello,

I use prestashop e-commerce installed on a (remote) web server. In my physical store, I installed qz tray on a computer (Mac).
In the web browser, I go to the POS of my online store and I can print the ticket on my thermal printer (Epson).
However, I also use an iPad and I can't install a qz tray module on it.
So I have to send the tickets from the ipad to the mac, which then prints them. And I can't do that.
On my web server, for the qz tray part, I have a javascript file that contains the following code:

 /** Default parameters used on new connections. Override values using options parameter on {@link qz.websocket.connect}. */
            connectConfig: {
                host: ["localhost", "localhost.qz.io"], //hosts QZ Tray can be running on
                hostIndex: 0,                           //internal var - index on host array
                usingSecure: true,                      //boolean use of secure protocol
                protocol: {
                    secure: "wss://",                   //secure websocket
                    insecure: "ws://"                   //insecure websocket
                },
                port: {
                    secure: [8181, 8282, 8383, 8484],   //list of secure ports QZ Tray could be listening on
                    insecure: [8182, 8283, 8384, 8485], //list of insecure ports QZ Tray could be listening on
                    portIndex: 0                        //internal var - index on active port array
                },
                keepAlive: 60,                          //time between pings to keep connection alive, in seconds
                retries: 0,                             //number of times to reconnect before failing
                delay: 0                                //seconds before firing a connection
            },


it is loaded locally in the browser when I launch the ineterface of my cash register (on the remote website).

I tried to change localhost to the internal IP address of the Mac running QZ tray. This doesn't work. I've also tried setting the IP address to public and forwarding the ports (I can't remember which ones at the time of writing) to the Mac in my router. That doesn't work either, but maybe I haven't configured all the parameters correctly.

Does anyone have any idea what configuration to do in my case?
Thanks!

Tres Finocchiaro

unread,
Apr 29, 2024, 9:51:02 AMApr 29
to Julien Studer, qz-print
Julien,

Sorry about the trouble you're having.

Although iPad/iOS is not supported, we've had decent luck using the print-server technique that you're trying.

There's three critical changes needed to use QZ Tray in print server mode:
Please let us know if you have any trouble through this process.


--
You received this message because you are subscribed to the Google Groups "qz-print" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qz-print/9ebef51e-a77e-4f94-81fd-a0162778888an%40googlegroups.com.

Julien Studer

unread,
Apr 29, 2024, 10:00:49 AMApr 29
to qz-print
Ho thanks a lot for your answer !

ok so the mac where qz tray is installed has 192.168.1.10 IP address.
so i execute this sudo "/Applications/QZ Tray.app/Contents/MacOS/QZ Tray" certgen --host "192.168.1.10"

for ssl certificate deployement it should be fine since i have tried this before.

and in the webpage on the remote web server : Make a change in the JavaScript to inform this webpage to connect to the iPad:

you mean i can put the local IP address of the mac 192.168.1.10 ? I don't have to deal with public IP and port forwarding. it should work locally.

i think i missed the first step to regenerate the ssl certificat !

ok i will try that tomorrow ! thanks a lot !

Julien Studer

unread,
Apr 29, 2024, 10:03:11 AMApr 29
to qz-print
Make a change in the JavaScript to inform this webpage to connect to the iPad:

ho it's the ip address of the ipad ?? not the address of the mac ?

Tres Finocchiaro

unread,
Apr 29, 2024, 10:18:47 AMApr 29
to Julien Studer, qz-print
The IP address of the PC (or server) that QZ Tray is running on.  In your case, probably the Mac. :)

Julien Studer

unread,
Apr 30, 2024, 1:45:58 AMApr 30
to qz-print
ok thanks !

and what is the syntax you think ?


/** Default parameters used on new connections. Override values using options parameter on {@link qz.websocket.connect}. */
            connectConfig: {
                host: ["192.168.1.10"], //hosts QZ Tray can be running on

like this or without " ?

Tres Finocchiaro

unread,
Apr 30, 2024, 1:49:54 AMApr 30
to Julien Studer, qz-print
It would be:

qz.websocket.connect({host: "192.168.1.2"});
... with the IP of your PC or server.

Julien Studer

unread,
May 3, 2024, 2:48:10 AMMay 3
to qz-print
Hi !

Thanks for your help, i could achieve the setup with your tips !

So yeah on webserver, in the prestashop-qztray js config file, i replaced localhost with the local ip address of the Mac running qz tray.
I did the step to "renew" the certificate with the IP on the mac.

the last thing that i didn't understand last time, is that i need to run the prestashop POS on the Ipad with Firefox ! 
It doesn't work with Safari. It seems obvious then, since the ssl certificates are installed or generated for Firefox.

Thanks again for your help !

Tres Finocchiaro

unread,
May 3, 2024, 9:09:11 AMMay 3
to Julien Studer, qz-print
The certificate is installed into Safari here:  https://qz.io/docs/print-server#ios-ipad-iphone


Reply all
Reply to author
Forward
0 new messages