Jump to content

How do I call a FrontController from within a module?


Recommended Posts

Hello,

I'm developing a module where I need to submit a request to my custom front controller. Basically, I need the FrontController to create new orders on the website, so I have my own class that checks the data received from an external source and, if eveything is fine, goes on with the process of importing the order.

In the past I performed this operation with a "loose" script, but lately Prestashop has become more strict and requires a FrontController in order to avoid kernel errors and other possible missing data.
The developer manual reports this:

The trick is to define it as an Ajax call to prevent the page template to be displayed.

Following this example and using the Context::getContext()->link->getModuleLink() function I manage to get a link like:

https://mywebsite.it/it/module/custommodule/CustommoduleController?param1=abc&param2=def

With this link how can I call my custom front controller so that it performs all the required operations? Do I have to call it using (for example) CURL or is there any other methods? As I wrote, CustommoduleController is a Front Controller that extends ModuleFrontController, but I need it to execute from my backoffice module and it's not something that will be visible at front.

Link to comment
Share on other sites

  • 1 year later...

Have same problem,
And I don't want to call via Ajax or direct from URL
Also CURL, is not permitted , because the Hosting is closed the CURL .

Any idea , how to call a controller method from a simple php file ? not from other Module , ...
Only direct from php 

Thx

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...