dazmania Posted January 29, 2015 Share Posted January 29, 2015 Hi all, I'm attempting to use the postProcess function in my module, all I would like to do is run some task and then return the user to the same page that they were on. To do this I try to use Tools::redirectAdmin but my browser opens another window. Is there a way to prevent a new window from opening ? Here is the code: public function postProcess() { if (Tools::isSubmit('dosomething') ) { $order_id = Tools::getValue('dosomething'); $file = fopen("/var/tmp/didsomething","a"); echo fwrite($file, $order_id); fclose($file); Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token); } Many thanks ! ( again ) D Link to comment Share on other sites More sharing options...
jsmit2 Posted January 29, 2015 Share Posted January 29, 2015 Hmm you mean a refresh? You can try to echo javascript (<script>location.reload();</script>) Link to comment Share on other sites More sharing options...
dazmania Posted January 29, 2015 Author Share Posted January 29, 2015 Hi thanks for posting back to me. You mean: public function postProcess(){if (Tools::isSubmit('dosomething') ) {$order_id = Tools::getValue('dosomething');$file = fopen("/var/tmp/didsomething","a");echo fwrite($file, $order_id);fclose($file);echo javascript (<script>location.reload();</script>) } I'm not sure that this will work. I post params to Adminmymodule ( dosomething ) and then would like to return back to the same page without opening a new window. The call looks like: mydomain/index.php?controller=Adminmymodule&token=14a8e744b208adc9691f8ad15c18b5d3&submitAction=dosomething&dosomething=5 When I've processed the data I want to return to mydomain/index.php?controller=Adminmymodule&token=14a8e744b208adc9691f8ad15c18b5d3 Without opening a new browser window / tab. Cheers, D Link to comment Share on other sites More sharing options...
jsmit2 Posted January 30, 2015 Share Posted January 30, 2015 Lookup in google Window.open() With that function you can open a page in a new tab or window Link to comment Share on other sites More sharing options...
dazmania Posted January 30, 2015 Author Share Posted January 30, 2015 The page already opens in a new tab but I don't want this. I think I will need to look at making an ajax call from inside the page to a new AdminModule.php - could be a long night zzz Link to comment Share on other sites More sharing options...
dazmania Posted January 30, 2015 Author Share Posted January 30, 2015 O dear, now I feel silly. The answer is so simple - back to basics stuff: Calling html: target="_self" Get out of here ! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now