如何在observer magento中访问Varien对象值

时间:2012-12-24 05:01:48

标签: magento magento-1.7

嗨,在我的自定义模块中,我使用cms_page_save_after事件来保存更多数据与cms页面。虽然在oberver中我得到了这种类型的数据无法处理。

Varien_Event_Observer Object
(
    [_data:protected] => Array
        (
            [event] => Varien_Event Object
                (
                    [_observers:protected] => Varien_Event_Observer_Collection Object
                        (
                            [_observers:protected] => Array
                                (
                                )

                        )

                    [_data:protected] => Array
                        (
                            [data_object] => Mage_Cms_Model_Page Object
                                (
                                    [_cacheTag:protected] => cms_page
                                    [_eventPrefix:protected] => cms_page
                                    [_eventObject:protected] => object
                                    [_resourceName:protected] => cms/page
                                    [_resource:protected] => 
                                    [_resourceCollectionName:protected] => cms/page_collection
                                    [_dataSaveAllowed:protected] => 1
                                    [_isObjectNew:protected] => 
                                    [_data:protected] => Array
                                        (
                                            [form_key] => 1TVTYLITcZn3dUZm
                                            [page_id] => 3
                                            [title] => About Us
                                            [identifier] => about-magento-demo-store
                                            [stores] => Array
                                                (
                                                    [0] => 1
                                                )

                                            [is_active] => 1
                                            [content_heading] => 
                                            [content] => 

我尝试使用$ observer-> getData('page_id')代码但不显示任何内容。有人知道如何使用此对象。提前感谢。

1 个答案:

答案 0 :(得分:3)

$observer->getEvent()->getDataObject()->getPageId()