Frage

I want to redirect user to external link. When this statement is executed:

$observer->getRequest()->setParam('return_url','http://www.google.com/');

I always get the following error:

External urls redirect to "google.com/"; denied!

Did somebody have the same issue?

War es hilfreich?

Lösung

Try Following in your Observer

<?php 
    Mage::app()->getResponse()->setRedirect($url)->sendResponse(); 
    // or 
    Mage::app()->getFrontController()->getResponse()->setRedirect($url)->sendResponse(); 
?>

More information you can find here and here

Andere Tipps

You cannot redirect from php in an ajax call.

You need to send the right information back from your php script to your java script and do the redirect from there, using the parameters you got back from php.

In your ajax response you can check status of request and then you have to check if it's success then you can redirect using javacript

        window.location.href = "http://www.google.com";

Let me know if you have any query

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top