【问题标题】:Redirect to a function in another admin controller from one admin controller in magento从 magento 中的一个管理控制器重定向到另一个管理控制器中的函数
【发布时间】:2015-03-12 07:58:58
【问题描述】:

我必须从一个控制器调用一个函数到另一个控制器。

我需要从 testController 中的 testAction() 调用另一个控制器中的 indexAction() 函数。

我怎么称呼那个。我试过下面的。但这似乎不起作用。请给我建议。

$this->_redirect("./admin/another/index", array("group_id" => $group_id));

$this->_forward($action = 'indexAction', $controller = 'adminhtml_another', $module = 'custommodule');

【问题讨论】:

    标签: magento redirect module controller


    【解决方案1】:

    如果您从一个控制器重定向到另一个控制器

    $this->_redirect('customer/account/login'); 
    //Format: $this->_redirect('module/controller/action');
    

    如果在同一个控制器中

    //$this->_redirect('*/*/SameControllerMethodAction');
    

    更新: 你的解决方案:

    $this->_redirect('adminhtml/newsletter_template/index'); 
    

    Adminhtml - module
    Newsletter (Folder) > Template - controller
    Index - function
    

    【讨论】:

    • 实际上我需要重定向到时事通讯索引操作。我尝试使用“$this->_redirect("newsletter/template/index");"但它不起作用。
    • 确保您在时事通讯模块中有模板控制器。顺便说一句,Magento 默认没有模板控制器。顺便说一句,您找不到 404 是什么?还是重定向?
    • 它不是 'newsletter/template/index',只是 'adminhtml/newsletter_template/index'。
    • @anz 它工作正常 $this->_redirect('adminhtml/newsletter_template/index');但是我们需要重定向到新页面。这种情况怎么可能。
    【解决方案2】:

    我找到了答案。现在重定向工作正常。我刚刚在'return;' 声明下方添加。代码是,

    $this->_redirect("adminhtml/newsletter_template/"); 
    return;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-11
      • 1970-01-01
      • 1970-01-01
      • 2019-10-17
      • 2023-04-10
      • 2023-03-12
      • 2021-12-20
      相关资源
      最近更新 更多