I have created an extension that adds a custom tab in the adminhtml customer interface. After submitting the form on the page, how can I return the user to my custom tab instead of the default tab on customer edit.
This is the code I use to return to the customer edit page in my controller
$redirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
$redirect->setUrl($this->_redirect->getRefererUrl());
return $redirect;
-
I am aware of a url piece/param "active_tab", but cannot find an example of how to use it.Todd– Todd2019年05月13日 16:55:07 +00:00Commented May 13, 2019 at 16:55
-
In the orders adminhtml tab construct, I can do this: /sales/order/view/order_id/81248/active_tab/order_creditmemos/key/mybigkeystring/ order_creditmemos comes from name of the corresponding tab element, such as: <a href="#sales_order_view_tabs_order_creditmemos_content" id="sales_order_view_tabs_order_creditmemos" name="order_creditmemos" title="Order Credit Memos" .... > However, I have observed that none of the customer tabs have a name property on the link. Is this an oversite or do the customer tabs not conform or perhaps were not fully redeveloped from Magento 1.9x?Todd– Todd2019年05月13日 17:08:04 +00:00Commented May 13, 2019 at 17:08
-
I'm seeing now that the entire customer tab widget is one big form that gets saved all together, whereas the order tab widget is not fundamentally a giant form. This probably explains why my plan is not working (even though I am able to submit my own form and take actions and return to the customer edit page, just not the right tab).Todd– Todd2019年05月14日 15:45:44 +00:00Commented May 14, 2019 at 15:45
1 Answer 1
@todd active_tab works, just need to remember that need to use tab name from xml file
instead # from link
return $this->resultRedirectFactory->create()->setPath(
'sales/order/view',
[
'order_id' => $orderId,
'active_tab' => 'sales_order_additional_items',
]
);
answered Mar 28, 2023 at 15:30
Mateusz Lerczak
1932 silver badges13 bronze badges
default