1

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;
asked May 13, 2019 at 11:12
3
  • I am aware of a url piece/param "active_tab", but cannot find an example of how to use it. Commented 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? Commented 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). Commented May 14, 2019 at 15:45

1 Answer 1

0

@todd active_tab works, just need to remember that need to use tab name from xml file

enter image description here

instead # from link

enter image description here

return $this->resultRedirectFactory->create()->setPath(
 'sales/order/view',
 [
 'order_id' => $orderId,
 'active_tab' => 'sales_order_additional_items',
 ]
);
answered Mar 28, 2023 at 15:30

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.