How to open automatically print dialogue for packing slip?

Dear All,

When preparing orders and printing manually eahc packing slip for orders, I was wondering to accelerate packing slip print.

Therefore, I just told me that it would spare time if the print dialogue window could open automatically just after opening packing slip window.

I’m not familiar with TPL system but I think a good way to find a solution would be to implement the javascript function with a onload condition:

Here is a part of the javascript function window.print

<br />
<script language="Javascript1.2"><br />
  <!--<br />
  function printpage() {<br />
  window.print();<br />
  }<br />
  //--><br />
</script><br />

```<br />
<br />
[b]But where should I insert this code ?[/b]<br />
<br />
Your help would be greatly appreciated !<br />
<br />
Best regards,<br />

Put it anywhere inside of a smarty if statement for something like (unsure of the actual 'mode' below since I only use EDP products and am too lazy to look it up)

{if $auth.area == 'A' && $controller == 'orders' && $mode == 'print_packing_slip"}
$(document).ready( function() {

This checks if you're in the admin area and the conntroller and mode are correct for printing the packing slip and then allows the jQuery code to be active only on that page.

The jQuery code will wait until the page has completely loaded and then invoke the window.print() function.

Dear Tbirnseth,

Thank you for your answer.? I tried your code by adding your line the the packing_slip.tpl but it gaves me after a 500-type error.

So I just simply tried the following code the the tpl inside the tags :



It works perfectly.

But your code with the JQuery seems to be smarter because you were checking rights and complete load. Could you explain me more ?



Having it in the packing slip template is fine. The only advantage to how I was doing it was that you could simply add other pages to the condition if there were other pages that you wanted to default to being printed (bring print dialog anyway, not necessarily complete the print task). Mine also limits to the admin (not sure if customer sees packing slip or not from orders or shipments) but in MVE, it could be further qualified by company.

Many ways to skin a cat. Yours is fine.

If there is still interest in this functionality, we've created a free add-on for CS-Cart 3 Professional and Ultimate. You can download it here.