Reputation: 350
I have been successful developing a Customer Notes Tab in Magento Admin Customer Edit, with everything functioning correctly. However whan a CSR saves a customer Note in the tab magento will update the table and return to the default top tab of "Customer View" I would like the action on the customer notes section on save to return to the customer notes tab. this is my controller
<?php class Mycompany_Customernotes_CustomernotesController extends Mage_Adminhtml_Controller_Action
{
public function saveAction()
{
$resource = Mage::getSingleton('core/resource');
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$returnnotes[] = $this->getRequest()->getPost();
foreach ($returnnotes as $returnnote) {
$notes = $returnnote['customer_notes'];
$customer_id = $returnnote['customer_id'];
$user_id = $returnnote['userId'];
$username = $returnnote['username'];
$timestamp = $returnnote['timestamp'];
$write->query("INSERT into Blah Blah Blah
}
$this->_redirectReferer();
}
}
This is Magento EE 1.12
Thanks in advance for any insite.
UPDATE showing config.xml
<admin>
<routers>
<customernotes>
<use>admin</use>
<args>
<module>Mycompany_Customernotes</module>
<frontName>customernotes</frontName>
</args>
</customernotes>
</routers>
</admin>
Upvotes: 0
Views: 2870
Reputation: 2072
The class Mage_Adminhtml_Block_Customer_Edit_Tabs appears to deal with setting the active tab in the following function.
protected function _updateActiveTab()
{
$tabId = $this->getRequest()->getParam('tab');
if( $tabId ) {
$tabId = preg_replace("#{$this->getId()}_#", '', $tabId);
if($tabId) {
$this->setActiveTab($tabId);
}
}
}
Try setting the "tab" parameter before you redirect and see what happens. For an example id the address tab is "customer_info_tabs_addresses"
Upvotes: 0
Reputation: 17656
Try
$this->_redirect('*/*/', array('active_tab' => 'list_untranslated'));
See Magento tab change/redirect
Upvotes: 1