- Posts: 42
- Thank you received: 0
- Community Forum
- Appointment Booking Pro - Retired, no longer for sale or supported.
- ABPro 4.0.x
- Problem with cart summary printing
Problem with cart summary printing
- Giuseppe Cento
- Topic Author
- Offline
- Senior Boarder
Less
More
2 years 4 months ago #26863
by Giuseppe Cento
Problem with cart summary printing was created by Giuseppe Cento
Attachments:
Please Log in to join the conversation.
- Rob
- Offline
- Administrator
Less
More
- Posts: 4785
- Karma: 103
- Thank you received: 673
2 years 4 months ago #26864
by Rob
Replied by Rob on topic Problem with cart summary printing
The button just calls the browser window.print().
It used to just print the popup window but now seems to print the window behind as well.
I don't know when this change began, nor do I have a fix. Sorry.
I will poke around and see if I can find a way to once again only print the popup window.
It used to just print the popup window but now seems to print the window behind as well.
I don't know when this change began, nor do I have a fix. Sorry.
I will poke around and see if I can find a way to once again only print the popup window.
Please Log in to join the conversation.
- Rob
- Offline
- Administrator
Less
More
- Posts: 4785
- Karma: 103
- Thank you received: 673
2 years 4 months ago #26865
by Rob
Replied by Rob on topic Problem with cart summary printing
The popup is made with jQuery.
I found a code snippet for printing a jQuery dialog and it seems to work.
To try it out, edit file: components\com_rsappt_pro3\views\cart\tmpl\default.php
At line 186, make the following changes..
Before change:
jQuery('#btnPrint').click(function() {
window.print();
});
After change:
jQuery('#btnPrint').click(function() {
// window.print();
var divToPrint=document.getElementById('sv_alertWindow');
var newWin=window.open('','Print-Window');
newWin.document.open();
newWin.document.write('<html><body onload="window.print()">'+divToPrint.innerHTML+'</body></html>');
newWin.document.close();
setTimeout(function(){newWin.close();},10);
});
I found a code snippet for printing a jQuery dialog and it seems to work.
To try it out, edit file: components\com_rsappt_pro3\views\cart\tmpl\default.php
At line 186, make the following changes..
Before change:
jQuery('#btnPrint').click(function() {
window.print();
});
After change:
jQuery('#btnPrint').click(function() {
// window.print();
var divToPrint=document.getElementById('sv_alertWindow');
var newWin=window.open('','Print-Window');
newWin.document.open();
newWin.document.write('<html><body onload="window.print()">'+divToPrint.innerHTML+'</body></html>');
newWin.document.close();
setTimeout(function(){newWin.close();},10);
});
Please Log in to join the conversation.
- Giuseppe Cento
- Topic Author
- Offline
- Senior Boarder
Less
More
- Posts: 42
- Thank you received: 0
2 years 4 months ago #26866
by Giuseppe Cento
Replied by Giuseppe Cento on topic Problem with cart summary printing
Rob, in the meantime, thanks for your reply, I made the change you suggested. As soon as I entered it I immediately did a test and it worked. I tried a second time and when I click on "Print this page" it is as if it were executing the command quickly, but without showing anything (and the screen remains in this position (attached file)). Can you help me understand what's going on? Below I insert the code I changed:
jQuery ('# btnPrint'). click (function () {
// window.print ();
var divToPrint = document.getElementById ('sv_alertWindow');
var newWin = window.open ('', 'Print-Window');
newWin.document.open ();
newWin.document.write ('<html> <body onload = "window.print ()">' + divToPrint.innerHTML + '</body> </html>');
newWin.document.close ();
setTimeout (function () {newWin.close ();}, 10);
});
jQuery ('# btnPrint'). click (function () {
// window.print ();
var divToPrint = document.getElementById ('sv_alertWindow');
var newWin = window.open ('', 'Print-Window');
newWin.document.open ();
newWin.document.write ('<html> <body onload = "window.print ()">' + divToPrint.innerHTML + '</body> </html>');
newWin.document.close ();
setTimeout (function () {newWin.close ();}, 10);
});
Attachments:
Please Log in to join the conversation.
- Rob
- Offline
- Administrator
Less
More
- Posts: 4785
- Karma: 103
- Thank you received: 673
2 years 4 months ago #26867
by Rob
Replied by Rob on topic Problem with cart summary printing
The code opens a new window, then fills it with the contents of the popup and does a window.print on that.
To see it in action, go to the demo page and make a booking.
cartdemo.appointmentbookingpro.com/abpro-cart-demo
To see it in action, go to the demo page and make a booking.
cartdemo.appointmentbookingpro.com/abpro-cart-demo
Please Log in to join the conversation.
- Giuseppe Cento
- Topic Author
- Offline
- Senior Boarder
Less
More
- Posts: 42
- Thank you received: 0
2 years 4 months ago #26868
by Giuseppe Cento
Replied by Giuseppe Cento on topic Problem with cart summary printing
Yes, I understood this, but I can't understand how it worked the first time and now it doesn't work. I tried your demo and it works perfectly. I really don't know what happened. Could it depend on the content of what I send to print, which I have customized?
Please Log in to join the conversation.
- Rob
- Offline
- Administrator
Less
More
- Posts: 4785
- Karma: 103
- Thank you received: 673
2 years 4 months ago - 2 years 4 months ago #26869
by Rob
You could change it to plain text and see if that helps.
Also, maybe check the browser console and see if it shows any errors.
It is all done in Javascript and a js error could cause it to not work.
Replied by Rob on topic Problem with cart summary printing
Could it depend on the content of what I send to print, which I have customized?
You could change it to plain text and see if that helps.
Also, maybe check the browser console and see if it shows any errors.
It is all done in Javascript and a js error could cause it to not work.
Last edit: 2 years 4 months ago by Rob.
Please Log in to join the conversation.
- Giuseppe Cento
- Topic Author
- Offline
- Senior Boarder
Less
More
- Posts: 42
- Thank you received: 0
2 years 4 months ago #26870
by Giuseppe Cento
Replied by Giuseppe Cento on topic Problem with cart summary printing
Rob, solved the problem, I had inserted a logo and this prevented printing. Thanks for your help and your availability.
Please Log in to join the conversation.
- Rob
- Offline
- Administrator
Less
More
- Posts: 4785
- Karma: 103
- Thank you received: 673
2 years 4 months ago #26871
by Rob
Replied by Rob on topic Problem with cart summary printing
I am happy your were able to solve the problem.
Please Log in to join the conversation.
- Community Forum
- Appointment Booking Pro - Retired, no longer for sale or supported.
- ABPro 4.0.x
- Problem with cart summary printing
Time to create page: 0.248 seconds