【发布时间】:2017-05-23 22:24:45
【问题描述】:
我正在尝试编写一个 cron 脚本来自动化我的模块,但我在使用 Prestashop 1.6 Core 时遇到了一些错误。
我想从商店中检索所有具有核心功能的产品。在 Prestashop 后台工作正常,但是当我只想使用它执行 cron 时,我在上下文中遇到错误:“尝试获取非对象的属性”
我检索所有产品的功能是这样的:
public static function getAllProducts() {
$lang = (int)Configuration::get('PS_LANG_DEFAULT');
return (Product::getProducts($lang, 0, 0, 'id_product', 'DESC', false, false, null));
}
我的 cron_script.php 是这样的:
include(dirname(__FILE__).'/../../config/config.inc.php');
require_once('mymodule.php');
$products = MyModule::getAllProducts();
是否有任何方法可以在不使用上下文且不使用 SQL 语句的情况下检索所有产品?
谢谢
【问题讨论】:
标签: php cron prestashop