4

I'd like to use the Magento's print feature in my module to have the invoice pdf of a programmatically created order. For that I'd like to get the url that Magento back end uses to print the invoice. eg : http://localhost/magento1/index.php/admin/sales_order_invoice/print/invoice_id/104/key/eaf550ef39cc92e93b562994019fde14/ enter image description here

My question is how can I get that key to build the url that retrieves the invoice pdf ?

1

just write below code

Mage::helper("adminhtml")->getUrl("adminhtml/sales_order_invoice/print/invoice_id/104/");

and it will autometically add key

  • This generate the following link : http://localhost/magento1/index.php/sales_order_invoice/print/invoice_id/key/1c762f48f0b4a305a038d599b84bda83/. This does not add the invoice_id (104 in our example). I don't know why it does not add the invoice_id ... – androniennn Dec 26 '16 at 11:25
  • Is it a bug in Magento ... ? – androniennn Dec 26 '16 at 11:43
  • 2
    @androniennn Magento always generate unique key everytime, so dont worry – Murtuza Zabuawala Dec 26 '16 at 12:03
  • 2
    @androniennn, I have written same kind of code abt 1 year ago so that's why I know , and from my study I know that There is always this kind of function available for getting keys whether its form_key or url_key – Murtuza Zabuawala Dec 26 '16 at 12:08
  • 1
    @androniennn I am not sure but you can try this Mage::helper("sales")->getUrl("adminhtml/sales_order_invoice/print/invoice_id/104/"); – Murtuza Zabuawala Dec 27 '16 at 5:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.