Redirects with post parameters

Helo everyone,

 

I’m new to shopware so this might sound a bit odd but I am trying to achieve the following:

A redirect from a backend controller action to a frontend controller action with some post parameters, unfortunatelly get parameters in the url will not work for this speciffic task as one of these parameters is the CSRF token(wouldn’t want to put that in the url) and the rest of them are arrays which

$this->Front()->Router()->assemble()

 seems to be having a bit of an issue with. I tired to find an answer for this online but was fairly unsucesful, the only methods I found being the above and 

$this->redirect(['controller/action', 'param' => 'value', 'param2' => 'value2' ...])

which seems to be doing prety much the same thing in the redirect method(using assemble to create the url from the parameter array)

 

Question Backgound:

The reason I am trying to do this is something similar to the ‘log in as this customer’ functionality with the option to have a few products already added to the basket when signing in as the customer from the backend and I was thinking of leveraging the ‘repeat order’ functionality and redirect to the ‘checkout/add_accessories’ action with the products to be added as post parameters.

 

Any help would be really appreciated.

Regards,

Vlad

Hey,

its technically inpossible to do a 301 with Post Parameters :). Maybe think about GET parameters or use the session of the customer

1 Like

Hi Shyim,

The controller I was thinking of redirecting to uses post params and the params need to be arrays which seems very dificult with the redirect() function. I guess I’ll have to rewrite the functionality in a way that worksusing the session. Thanks for the advice.