【问题标题】:How to redirect magento admin page to different controller action?如何将 magento 管理页面重定向到不同的控制器操作?
【发布时间】:2013-11-27 21:59:24
【问题描述】:

我有一个自定义模块,它将根据有限的条件生成优惠券代码。现在优惠券代码完美保存在 salesrule 中,现在如果我点击模块页面中的编辑,应该重定向到默认的销售优惠券编辑页面。

示例: 我目前的网址:http://localhost/magento2/index.php/customcoupons/adminhtml_customcoupons/edit/id/44/key/af601cf21208c082e697be71620f2e88/

我想重定向到-> http://localhost/magento2/index.php/admin/promo_quote/edit/id/44/key/af601cf21208c082e697be71620f2e88/

我已经尝试在 Grid.php 中更改 getRowUrl() 如下所示

public function getRowUrl($row)
  {

        return $this->getUrl('admin/promo_code/edit', array('id' => $row->getId()));

  }

但在这种情况下,它将 url 显示为 http://localhost/magento2/index.php//promo_quote/edit/id/44/key/2afbac6ee9b3321206fa18a9fc1f949c/ 即,它忽略管理员。

它还会重定向回仪表板页面。

有没有办法重定向到自定义控制器?

【问题讨论】:

    标签: php magento redirect


    【解决方案1】:

    尝试:

    public function getRowUrl($row)
    {
        return Mage::helper('adminhtml')->getUrl('adminhtml/promo_code/edit', array('id' => $row->getId())); 
    }
    

    【讨论】:

    • 谢谢 Marius,工作正常 :) 这就是我想要的!! :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-10
    • 2010-10-04
    • 1970-01-01
    • 2011-12-25
    • 1970-01-01
    • 2015-05-18
    • 1970-01-01
    相关资源
    最近更新 更多