Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Take a look at How can I generate an admin link from a frontend controller?How can I generate an admin link from a frontend controller?

Short answer: you can't, but if you create a admin controller that will act like a proxy to get the url key then do the redirect (since you can disable the validation of admin url using $_publicActions).

class MagePal_ProxyCustomerRedirect_Adminhtml_RedirectController extends Mage_Adminhtml_Controller_Action
{
    /**
     * Array of actions which can be processed without secret key validation
     *
     * @var array
     */
    protected $_publicActions = array('redirecttocustomer');

    public function redirecttocustomerAction()
    {
        // get the customer id pass by your observer (url key)
        Mage::app()->getResponse()->setRedirect(Mage::helper("adminhtml")->getUrl("adminhtml/customer/edit/", array("id"=>$customer_id)));

In your observer

  Mage::app()->getResponse()->setRedirect(Mage::helper("adminhtml")->getUrl("adminhtml/redirecttocustomer/edit/", array("id"=>$customer_id)));

See Mage_Adminhtml_Controller_Action

protected function _validateSecretKey()
{
    if (is_array($this->_publicActions) && in_array($this->getRequest()->getActionName(), $this->_publicActions)) {
        return true;
    }

    if (!($secretKey = $this->getRequest()->getParam(Mage_Adminhtml_Model_Url::SECRET_KEY_PARAM_NAME, null))
        || $secretKey != Mage::getSingleton('adminhtml/url')->getSecretKey()) {
        return false;
    }
    return true;
}

Take a look at How can I generate an admin link from a frontend controller?

Short answer: you can't, but if you create a admin controller that will act like a proxy to get the url key then do the redirect (since you can disable the validation of admin url using $_publicActions).

class MagePal_ProxyCustomerRedirect_Adminhtml_RedirectController extends Mage_Adminhtml_Controller_Action
{
    /**
     * Array of actions which can be processed without secret key validation
     *
     * @var array
     */
    protected $_publicActions = array('redirecttocustomer');

    public function redirecttocustomerAction()
    {
        // get the customer id pass by your observer (url key)
        Mage::app()->getResponse()->setRedirect(Mage::helper("adminhtml")->getUrl("adminhtml/customer/edit/", array("id"=>$customer_id)));

In your observer

  Mage::app()->getResponse()->setRedirect(Mage::helper("adminhtml")->getUrl("adminhtml/redirecttocustomer/edit/", array("id"=>$customer_id)));

See Mage_Adminhtml_Controller_Action

protected function _validateSecretKey()
{
    if (is_array($this->_publicActions) && in_array($this->getRequest()->getActionName(), $this->_publicActions)) {
        return true;
    }

    if (!($secretKey = $this->getRequest()->getParam(Mage_Adminhtml_Model_Url::SECRET_KEY_PARAM_NAME, null))
        || $secretKey != Mage::getSingleton('adminhtml/url')->getSecretKey()) {
        return false;
    }
    return true;
}

Take a look at How can I generate an admin link from a frontend controller?

Short answer: you can't, but if you create a admin controller that will act like a proxy to get the url key then do the redirect (since you can disable the validation of admin url using $_publicActions).

class MagePal_ProxyCustomerRedirect_Adminhtml_RedirectController extends Mage_Adminhtml_Controller_Action
{
    /**
     * Array of actions which can be processed without secret key validation
     *
     * @var array
     */
    protected $_publicActions = array('redirecttocustomer');

    public function redirecttocustomerAction()
    {
        // get the customer id pass by your observer (url key)
        Mage::app()->getResponse()->setRedirect(Mage::helper("adminhtml")->getUrl("adminhtml/customer/edit/", array("id"=>$customer_id)));

In your observer

  Mage::app()->getResponse()->setRedirect(Mage::helper("adminhtml")->getUrl("adminhtml/redirecttocustomer/edit/", array("id"=>$customer_id)));

See Mage_Adminhtml_Controller_Action

protected function _validateSecretKey()
{
    if (is_array($this->_publicActions) && in_array($this->getRequest()->getActionName(), $this->_publicActions)) {
        return true;
    }

    if (!($secretKey = $this->getRequest()->getParam(Mage_Adminhtml_Model_Url::SECRET_KEY_PARAM_NAME, null))
        || $secretKey != Mage::getSingleton('adminhtml/url')->getSecretKey()) {
        return false;
    }
    return true;
}
added 56 characters in body
Source Link

Take a look at How can I generate an admin link from a frontend controller?

In your moduleShort answer: you can't, but if you create a admin controller that will beact like a proxy to get the url key then do the redirect (that doesn't need a url keysince you can disable the validation see of admin url using $_publicActions).

class MagePal_ProxyCustomerRedirect_Adminhtml_RedirectController extends Mage_Adminhtml_Controller_Action
{
    /**
     * Array of actions which can be processed without secret key validation
     *
     * @var array
     */
    protected $_publicActions = array('redirecttocustomer');

    public function redirecttocustomerAction()
    {
        // get the customer id pass by your observer (url key)
        Mage::app()->getResponse()->setRedirect(Mage::helper("adminhtml")->getUrl("adminhtml/customer/edit/", array("id"=>$customer_id)));

In your observer

  Mage::app()->getResponse()->setRedirect(Mage::helper("adminhtml")->getUrl("adminhtml/redirecttocustomer/edit/", array("id"=>$customer_id)));

See Mage_Adminhtml_Controller_Action

protected function _validateSecretKey()
{
    if (is_array($this->_publicActions) && in_array($this->getRequest()->getActionName(), $this->_publicActions)) {
        return true;
    }

    if (!($secretKey = $this->getRequest()->getParam(Mage_Adminhtml_Model_Url::SECRET_KEY_PARAM_NAME, null))
        || $secretKey != Mage::getSingleton('adminhtml/url')->getSecretKey()) {
        return false;
    }
    return true;
}

Take a look at How can I generate an admin link from a frontend controller?

In your module create a admin controller that will be like a proxy to do the redirect (that doesn't need a url key validation see $_publicActions)

class MagePal_ProxyCustomerRedirect_Adminhtml_RedirectController extends Mage_Adminhtml_Controller_Action
{
    /**
     * Array of actions which can be processed without secret key validation
     *
     * @var array
     */
    protected $_publicActions = array('redirecttocustomer');

    public function redirecttocustomerAction()
    {
        // get the customer id pass by your observer (url key)
        Mage::app()->getResponse()->setRedirect(Mage::helper("adminhtml")->getUrl("adminhtml/customer/edit/", array("id"=>$customer_id)));

In your observer

  Mage::app()->getResponse()->setRedirect(Mage::helper("adminhtml")->getUrl("adminhtml/redirecttocustomer/edit/", array("id"=>$customer_id)));

See Mage_Adminhtml_Controller_Action

protected function _validateSecretKey()
{
    if (is_array($this->_publicActions) && in_array($this->getRequest()->getActionName(), $this->_publicActions)) {
        return true;
    }

    if (!($secretKey = $this->getRequest()->getParam(Mage_Adminhtml_Model_Url::SECRET_KEY_PARAM_NAME, null))
        || $secretKey != Mage::getSingleton('adminhtml/url')->getSecretKey()) {
        return false;
    }
    return true;
}

Take a look at How can I generate an admin link from a frontend controller?

Short answer: you can't, but if you create a admin controller that will act like a proxy to get the url key then do the redirect (since you can disable the validation of admin url using $_publicActions).

class MagePal_ProxyCustomerRedirect_Adminhtml_RedirectController extends Mage_Adminhtml_Controller_Action
{
    /**
     * Array of actions which can be processed without secret key validation
     *
     * @var array
     */
    protected $_publicActions = array('redirecttocustomer');

    public function redirecttocustomerAction()
    {
        // get the customer id pass by your observer (url key)
        Mage::app()->getResponse()->setRedirect(Mage::helper("adminhtml")->getUrl("adminhtml/customer/edit/", array("id"=>$customer_id)));

In your observer

  Mage::app()->getResponse()->setRedirect(Mage::helper("adminhtml")->getUrl("adminhtml/redirecttocustomer/edit/", array("id"=>$customer_id)));

See Mage_Adminhtml_Controller_Action

protected function _validateSecretKey()
{
    if (is_array($this->_publicActions) && in_array($this->getRequest()->getActionName(), $this->_publicActions)) {
        return true;
    }

    if (!($secretKey = $this->getRequest()->getParam(Mage_Adminhtml_Model_Url::SECRET_KEY_PARAM_NAME, null))
        || $secretKey != Mage::getSingleton('adminhtml/url')->getSecretKey()) {
        return false;
    }
    return true;
}
Source Link

Take a look at How can I generate an admin link from a frontend controller?

In your module create a admin controller that will be like a proxy to do the redirect (that doesn't need a url key validation see $_publicActions)

class MagePal_ProxyCustomerRedirect_Adminhtml_RedirectController extends Mage_Adminhtml_Controller_Action
{
    /**
     * Array of actions which can be processed without secret key validation
     *
     * @var array
     */
    protected $_publicActions = array('redirecttocustomer');

    public function redirecttocustomerAction()
    {
        // get the customer id pass by your observer (url key)
        Mage::app()->getResponse()->setRedirect(Mage::helper("adminhtml")->getUrl("adminhtml/customer/edit/", array("id"=>$customer_id)));

In your observer

  Mage::app()->getResponse()->setRedirect(Mage::helper("adminhtml")->getUrl("adminhtml/redirecttocustomer/edit/", array("id"=>$customer_id)));

See Mage_Adminhtml_Controller_Action

protected function _validateSecretKey()
{
    if (is_array($this->_publicActions) && in_array($this->getRequest()->getActionName(), $this->_publicActions)) {
        return true;
    }

    if (!($secretKey = $this->getRequest()->getParam(Mage_Adminhtml_Model_Url::SECRET_KEY_PARAM_NAME, null))
        || $secretKey != Mage::getSingleton('adminhtml/url')->getSecretKey()) {
        return false;
    }
    return true;
}