douyaju4749 2014-05-16 14:15
浏览 16

如何重定向辅助类内部

In Magento, I have a helper class data

class My_Advert_Helper_Data extends Mage_Core_Helper_Abstract {

where

I have a function such as

    public function callValid($arrError){
.....

and in that function I am trying to redirect user to a certain login...

$this->_redirect($strReturnPath);

The setUrl is not redirecting. How can I redirect?.. $strReturnPath is getting */ as path. I need it to go to homepage Receiving error like below

Fatal error: Call to undefined method My_Advert_Helper_Data::_redirect() in 
  • 写回答

1条回答 默认 最新

  • dooid3005 2014-05-16 14:42
    关注

    You can set redirects within your helper class like the following

     Mage::app()->getResponse()->setRedirect($strReturnPath);
    

    That should do the trick.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用