开发者

Redirect to created invoice after it's saved

I need to tweak magento admin so after a new invoice is created at a link like this:

admin/sales_order_invoice/new/order_id/550/

to redirect to

/admin/sales_order_invoice/view/invoice_id/384/order_id/550/

Right now, after an order is created magento redirects to admin/sales_order/view/order_id/542/

L.E.

Found out that redirect url is set in saveAction() from app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php

Does anyone know a way to retrieve created invoic开发者_Go百科ed inside that function?


I know this is an old question and the Mage_Adminhtml_Sales_Order_InvoiceController class may have changed since the question was asked, but I thought it may help someone.


The invoice object is already available in the saveAction function and is initialized in the _initInvoice function. To access the invoice id you just need to use $invoice->getId().

To update the URL you just need to change this:

$this->_redirect('*/sales_order/view', array('order_id' => $orderId));

to this:

$this->_redirect('*/sales_order_invoice/view', array('invoice_id' => $invoice->getId(), 'order_id' => $orderId));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜