如何从观察者中获取已删除类别的ID?
config.xml标记
<adminhtml>
<events>
<catalog_category_delete_after>
<observers>
<my_module>
<type>singleton</type>
<class>my_module/observer</class>
<method>onCategoryDeleteAfter</method>
</my_module>
</observers>
</catalog_category_delete_after>
</events>
</adminhtml>
观察者代码类似于:
class My_Module_Model_Observer
{
public function onCategoryDeleteAfter() {
#do something with deleted category id
}
}
答案 0 :(得分:0)
使用传递的$ observer变量。
class My_Module_Model_Observer
{
public function onCategoryDeleteAfter($observer) {
$observer->getEvent()->getCategory();
}
}