I currently work on a magento payment module which has to check if certain fields in a users profile/account are set.
If they do not exist/have no content, I want to either 1. redirect to /customer/account/edit/ 2. display a notice that the fields in question has to be filled
or the other way around.
This is initialized by an AJAX call from Magentos core OnePage Checkout.
I tried several things like
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('customer/account/edit/')); Mage::app()->getResponse()->sendResponse(); exit;
and other things.
From the observer I somehow get a redirect but always end at /default/checkout/cart (which is default?)
In the model I see in chromes network tab that the correct page gets loaded but somehow it wont redirect to the page.
Please let me know if you need more Infos on the problem.
Edit 1: got rid of the second Mage::getURL, still no redirect.
Edit 2: I guess that if I could somehow 'hijack' the response for opcheckout.js it could do the redirect. Or should I maybe just add an extra js which listens as well? I think because the hole thing is triggered by an AJAX call the redirect just doesn't take place at the correct place. More ideas are welcome.
Edit 3: I try to figure at the moment out how to build a response fo the mentioned opcheckout.js which does not trigger the next step but does trigger redirect