I got a package that contains few extensions. I want to redirect to my custom view once the package installation is fully complete.
I thought of trying via installer script using the postflight method as below.
public function postflight($route, JAdapterInstance $adapter){
$app = JFactory::getApplication();
$app->enqueueMessage('Post Installation... ');
$app->redirect('index.php?option=com_mycomponent&view=install');
}
Problem: It is like hijacking the installer in half way by redirect to a different view. Because of this the post installer processes like updating the update server, post cleanup steps are not fully complete...
I tweaked the postflight code a little bit as below using javascript redirect.
public function postflight($route, JAdapterInstance $adapter){
$jurl = JURI::base();
$app = JFactory::getApplication();
$app->enqueueMessage('Redirect to complete the Installation process... <script>window.location.href="'.$jurl.'index.php?option=com_mycomponent&view=install";</script>');
}
It looks like its working great... The redirect happens only after the complete installation of the package.
Need some expert advice here is there any decent way to achieve the same...