我在让 cron 工作在 Magentos cron 系统中工作时遇到了一些问题。
我的模块文件夹结构如下:
/app/code/local/Nnn/AbandonedCartEmails/etc/config.xml
/app/code/local/Nnn/AbandonedCartEmails/Model/Observer.php
我的配置xml如下:
<config>
<!--
The module's node contains basic
information about each Magento module
-->
<modules>
<!--
This must exactly match the namespace and module's folder
names, with directory separators replaced by underscores
-->
<Nnn_AbandonedCartEmails>
<!-- The version of our module, starting at 0.0.1 -->
<version>0.0.1</version>
</Nnn_AbandonedCartEmails>
</modules>
<global>
<!-- Defining models -->
<models>
<!--
Unique identifier in the model's node.
By convention, we put the module's name in lowercase.
-->
<nnn_abandonedcartemails>
<!--
The path to our models directory, with directory
separators replaced by underscores
-->
<class>Nnn_AbandonedCartEmails_Model</class>
</nnn_abandonedcartemails>
</models>
</global>
<crontab>
<jobs>
<nnn_abandonedcartemails>
<schedule>
<cron_expr>*/5 * * * *</cron_expr>
</schedule>
<run>
<model>abandonedcartemails/observer::processEmails</model>
</run>
</nnn_abandonedcartemails>
</jobs>
</crontab>
我的观察者类如下所示:
class Nnn_AbandonedCartEmails_Model_Observer
{
public function processEmails()
{
/***/
因此,cron 作业正在注册并被添加到 cron_schedule 表中,但是每当它尝试执行时,它都会产生错误,如下所示
exception 'Mage_Core_Exception' with message 'Invalid callback: abandonedcartemails/observer::processEmails does not exist' in /pathtosite/www/app/Mage.php:594
所以看起来我有一个配置问题,但我似乎看不出问题出在哪里。Magento 的 xml 文件中的命名空间和命名约定非常令人沮丧,因此希望有一双新的眼睛可以看到我犯了错误的地方。
任何帮助总是很感激。
谢谢