test312 Posted May 23, 2020 Share Posted May 23, 2020 (edited) I developed a module for my customer which submits a simple form and sends an email to admin in order to request a budget estimation. This is the front where the form is, just a simple form on the cart actions and i print a link to my module controller where the mail is sent: cart-detailed-actions.tpl {if $requires_budget} <form action="{$link->getModuleLink('mymodule', 'mycontroller', [], true)|escape:'html'}" method="post"> {if ! $customer.is_logged} <div class="form-group"> <label for="budget-nom" style="width: 100%;text-align: left;">{l s='Name' d='Shop.Theme.Actions'}</label> <input id="budget-nom" type="text" name="name" class="form-control" required> </div> <div class="form-group"> <label for="budget-email" style="width: 100%;text-align: left;">{l s='Email' d='Shop.Theme.Actions'}</label> <input id="budget-email" type="email" name="email" class="form-control" required> </div> {/if} <div class="form-group"> <label for="budget-comments" style="width: 100%;text-align: left;">{l s='Comments' d='Shop.Theme.Actions'}</label> <textarea class="form-control" name="comments" id="budget-comments" minlength="10" required></textarea> </div> <button type="submit" name="request-budget-form" class="btn btn-primary"> {l s='Request quotation' d='Shop.Theme.Actions'} </button> </form> {else} <a href="{$urls.pages.order}" class="btn btn-primary">{l s='Proceed to checkout' d='Shop.Theme.Actions'}</a> {hook h='displayExpressCheckout'} {/if} My controller method in /modules/mymodule/controllers/front/mycontroller.php public function postProcess() { if (Tools::getIsset('request-budget-form')) { $this->requestBudget(); $this->success[] = 'Success message.'; $this->redirectWithNotifications('/'); } die('This gets executed in local server but not in production. Controller is never reached, instead it redirects the user to the Admin login page.'); Tools::redirect('/'); } PROBLEM: Its working perfectly in the local server. But in production, when submitting the form, it redirects the user to the admin login page, and if i'm logged in as admin, it brings me to the Admin dashboard. Also tried to do a get request to mywebsite.com/module/mymodule/mycontroller but also got redirected. In local i can access the controller. Any ideas of what's can be happening? Thanks! Edit 1: Also tried to disable the debug mode in local installation to replicate the production environment. But still working on local and not working on production server. Edited May 23, 2020 by test312 (see edit history) 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