我有一些问题得到一个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>
Run Code Online (Sandbox Code Playgroud)
我的观察者类看起来像这样:
class Nnn_AbandonedCartEmails_Model_Observer
{
public function processEmails()
{
/***/
Run Code Online (Sandbox Code Playgroud)
所以cron作业正在注册并被添加到cron_schedule表中,但是无论何时它尝试执行它都会产生并出现错误.
exception 'Mage_Core_Exception' with message 'Invalid callback: abandonedcartemails/observer::processEmails does not exist' in /pathtosite/www/app/Mage.php:594
Run Code Online (Sandbox Code Playgroud)
所以看起来我有配置问题,但我似乎无法看到问题所在.Magento的xml文件中的命名空间和命名约定使用起来非常令人沮丧,所以希望一副新鲜的眼睛可以看到我犯了错误的地方.
任何帮助总是赞赏.
谢谢
您的型号名称错误.
在<model>标签中,写<abandonedcartemails>而不是<nnn_abandonedcartemails>.
你的模特没有打电话.这就是为什么这是错误的原因