自定义模块的Prestashop cron作业



我用php脚本创建了一个prestashop模块。我需要为我的函数创建一个每天运行一次的cron作业,我该怎么做?

function get_orders_from_presta(){

我每天晚上都需要调用这个函数。提前谢谢。

最好是在模块目录中创建额外的文件(或者更好的是,控制器!(,如下所示:

include_once('../../config/config.inc.php');
include_once('../../init.php');
include_once('yourmodule.php');
// ...here you should have some token checking...
$module = new YourModule();
$module->yourFunction();

Prestashop标准方式:

您必须在模块中添加一个frontController。

遵循文档:https://devdocs.prestashop.com/1.7/modules/concepts/controllers/front-controllers/

最新更新