Magento事件观察器不能在一些机器上工作 [英] Magento event observer not working on some machines

查看:157
本文介绍了Magento事件观察器不能在一些机器上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎不知道为什么我的事件观察者从我的机器(和另一个同事),但不是从办公室的其他机器工作。

I cannot seem to figure out why my event observer works from my machine (and another coworkers) but not from other machines in the office.

例如,我有监听事件的观察者:

For example, I have an observer that listens for the event:

controller_action_postdispatch_adminhtml_process_reindexProcess

我的代码检测到事件并运行一些代码。当我运行重新索引进程,我的代码执行。当办公室里的某些其他机器运行重建索引时,事件不会触发,或者我的观察者没有检测到它。

My code detects the event and runs some code. When I run the re-index process, my code executes. When certain other machines here in the office run the re-index, either the event is not fired, or my observer isn't detecting it.

为什么计算机或用户点击管理面板中的重新索引按钮会更改事件如何触发或观察的任何事情?

Why would the computer or the user clicking on the re-index button in the admin panel change anything for how events are fired or observed?

我已经研究了这个问题,我最好的,我发现这个post。

I have researched this problem as best I could and found this post.

不启动或观察员不在magento工作的事件

但这似乎与不同的安装有关。在我的问题,它工作在某些计算机上的给定安装,而不是从其他人,所以我觉得这篇文章不直接相关。

But that seemed to pertain to different installations. In my problem, it works on a given installation on certain computers and not from others so I felt that this article was not directly relevant.

这个问题正在驱使我疯了。任何帮助将非常感激。

This problem is driving me crazy. Any help would be greatly appreciated.

推荐答案

有很多你可以尝试的voodoo,到最后是从这里开始

There's a whole lot of voodoo you could try, but what you'll end up having to in the end is start here

#File: app/Mage.php

public static function dispatchEvent($name, array $data = array())
{
    Varien_Profiler::start('DISPATCH EVENT:'.$name);
    $result = self::app()->dispatchEvent($name, $data);
    #$result = self::registry('events')->dispatch($name, $data);
    Varien_Profiler::stop('DISPATCH EVENT:'.$name);
    return $result;
}

并调试/记录事件的执行,在某些情况下发射。

and debug/log the execution of your event to determine why it isn't firing in certain situations.

具体回答从评论中


我能够看到,从复选标记重新索引调用不同的事件,而不是简单地点击重建索引流程文本。一个痛苦的长时间错误调试,但一个简单的解决方案。再次感谢! -

Thanks! I was able to see that re-indexing from the check marks calls a different event than simply clicking on the re-index process text. A painfully long error to debug but a simple solution. Thanks again! –

这篇关于Magento事件观察器不能在一些机器上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆