Question

I have two extensions, I want to redirect from one to another in a certain action. This is my redirect code in the saveAction of my bpsmessagecontroller of my bpsmessagecentre extension:

 $this->redirect('list', 'Coupon', 'Bpscoupons', array('message' => 'Look Ma, no syntax errors!' ));

When that runs it just redirects back to they list page of the calling extension (bpsmessagecenter), it doesn't seem to find the Bpscoupons extension at all.

When I try the same code with a forward call instead of redirect I get a 500 error.

The 'list' action is accessible and works from a link on the site and from some other redirects inside the bpscoupons extension.

Why won't that redirect work? Is there something about internal or external redirects I have to configure somewhere?

I am using typo3 4.5.32 . Thanks

PS, btw in my query string I see I get these params:

tx_bpscoupons_bpsmessagecentre[message]:Hi ma... etc
tx_bpscoupons_bpsmessagecentre[action]:list
tx_bpscoupons_bpsmessagecentre[controller]:Coupon 

Looks to me like it is looking for a bpsmessagecentre object a bpscoupons object but I don't know.

Was it helpful?

Solution

Are those 2 Plugins on the same page? If this is not the case, you have to pass the PageId of the target page as well, as $this->redirect in an extbase conroller takes the following arguments:

/**
 * Redirects the request to another action and / or controller.
 *
 * @param string $actionName Name of the action to forward to
 * @param string $controllerName Unqualified object name of the controller to forward to. If not specified, the current controller is used.
 * @param string $extensionName Name of the extension containing the controller to forward to. If not specified, the current extension is assumed.
 * @param array $arguments Arguments to pass to the target action
 * @param integer $pageUid Target page uid. If NULL, the current page uid is used
 * @param integer $delay (optional) The delay in seconds. Default is no delay.
 * @param integer $statusCode (optional) The HTTP status code for the redirect. Default is "303 See Other"
 */    
protected function redirect(
        $actionName,
        $controllerName = NULL,
        $extensionName = NULL,
        array $arguments = NULL,
        $pageUid = NULL, 
        $delay = 0, 
        $statusCode = 303
    )

And I think the extension name should start with a lower case letter.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top