Jump to content

Admin link in Javascript


tibomuse

Recommended Posts

Hello !

On my admin dashboard, on the order list page, i want to add a link to print the order directly. The function work good but i have a small problem with the getAdminLink. He give me the good link, but he have an error: He dont give me:

https://www.my-domain.com/ADMINID/index.php?controller=AdminOrders&token=MYTOKENID

But he give me:

https://www.my-domain.com/ADMINID/index.php?controller=AdminOrders;amp&token=MYTOKENID

It was a big problem because, with this wrong url i have a message "Do you want to continue ?" and my function to print dont work..

var myWindow=window.open('{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&vieworder&id_order={$order->id|intval});

If somebody have an issue to have $link->getAdminLink without ;amp in javascript

Thanks

Edited by tibomuse (see edit history)
Link to comment
Share on other sites

Hello !

On my admin dashboard, on the order list page, i want to add a link to print the order directly. The function work good but i have a small problem with the getAdminLink. He give me the good link, but he have an error: He dont give me:

https://www.my-domain.com/ADMINID/index.php?controller=AdminOrders&token=MYTOKENID

But he give me:

https://www.my-domain.com/ADMINID/index.php?controller=AdminOrders;amp&token=MYTOKENID

It was a big problem because, with this wrong url i have a message "Do you want to continue ?" and my function to print dont work..

var myWindow=window.open('{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&vieworder&id_order={$order->id|intval});

If somebody have an issue to have $link->getAdminLink without ;amp in javascript

Thanks

 

Remove

|escape:'html':'UTF-8'
Link to comment
Share on other sites

Hello. Thanks @joseantgv !

Its work fine.

 

Just another question. 

On my TPL file, i have this script:

<script>
 function openPrintOrder()
  {
    var myWindow=window.open('{$link->getAdminLink('AdminOrders')}&vieworder&id_order={$order->id}','','width=200,height=200');
    
    myWindow.document.close();
	myWindow.focus();
	setTimeout(function () { myWindow.print();}, 3000);
	setTimeout(function () { myWindow.close();}, 5000);
	
  }
</script>

The problem is, the variable {$order->id} give me always the same id. 

Javascript interpret this kind of variable ?

Thanks

Link to comment
Share on other sites

Hello. Thanks @joseantgv !

Its work fine.

 

Just another question. 

On my TPL file, i have this script:

<script>
 function openPrintOrder()
  {
    var myWindow=window.open('{$link->getAdminLink('AdminOrders')}&vieworder&id_order={$order->id}','','width=200,height=200');
    
    myWindow.document.close();
	myWindow.focus();
	setTimeout(function () { myWindow.print();}, 3000);
	setTimeout(function () { myWindow.close();}, 5000);
	
  }
</script>

The problem is, the variable {$order->id} give me always the same id. 

Javascript interpret this kind of variable ?

Thanks

 

No. You should get it with a jQuery selector from the table TR.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...