Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento管理客户编辑选项卡_Magento - Fatal编程技术网

Magento管理客户编辑选项卡

Magento管理客户编辑选项卡,magento,Magento,我已经成功地在Magento Admin Customer Edit中开发了一个Customer Notes选项卡,所有功能都正常。但是,当CSR在选项卡中保存客户注释时,magento将更新该表并返回到“客户视图”的默认顶部选项卡。我希望客户注释部分关于保存的操作返回到客户注释选项卡。 这是我的控制器 <?php class Mycompany_Customernotes_CustomernotesController extends Mage_Adminhtml_Control

我已经成功地在Magento Admin Customer Edit中开发了一个Customer Notes选项卡,所有功能都正常。但是,当CSR在选项卡中保存客户注释时,magento将更新该表并返回到“客户视图”的默认顶部选项卡。我希望客户注释部分关于保存的操作返回到客户注释选项卡。 这是我的控制器

    <?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();
            }
    }
试试看


请参见“Mage_Adminhtml_Block_Customer_Edit_Tabs”类,该类用于在以下功能中设置活动选项卡

protected function _updateActiveTab()
{
    $tabId = $this->getRequest()->getParam('tab');
    if( $tabId ) {
        $tabId = preg_replace("#{$this->getId()}_#", '', $tabId);
        if($tabId) {
            $this->setActiveTab($tabId);
        }
    }
}

在重定向之前尝试设置“tab”参数,看看会发生什么。例如,地址选项卡是“客户信息选项卡地址”

页面URL是/customer/edit/id/185208/重定向到活动选项卡返回404。您的管理员URL是否需要表单密钥?例如/customer/edit/id/185208//key/8e7af61..199e064b3/请看我的答案@。。。您在config.xml中以何种方式定义了管理路由。。。你在做什么?
@RS~我把配置复制到了原来的帖子上。至于表单键。我在notes窗体上使用了一个窗体键。它不起作用的原因是您通过不使用来定义config.xm的方式。如果查看客户部分的管理员url,您会发现它是site.com/[admin]/customer/edit,而您的自定义模块是site.com/mymodule/edit(不带[admin])
 $this->_redirect('*/*/', array('active_tab' => 'list_untranslated'));
protected function _updateActiveTab()
{
    $tabId = $this->getRequest()->getParam('tab');
    if( $tabId ) {
        $tabId = preg_replace("#{$this->getId()}_#", '', $tabId);
        if($tabId) {
            $this->setActiveTab($tabId);
        }
    }
}