本文介绍了magento customer_save_after模型/未调用观察者,捕获客户->编辑->保存功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是magento的新手,正在尝试为它写一点扩展名(magento 1.7).

I'm new on magento and trying to write little extension for it (magento 1.7).

我已经在customer-> edit中创建了选项卡,它会打印多选,没关系,问题是在保存并将其保存到数据库的自定义表之前,我无法进入观察器文件来捕获多选选项.

I have created tab in customer->edit, it prints multiselect, thats ok, the problem is that i cant get in observer file to catch multiselect options before saving and save them to my custom table in database.

有一些代码片段:app/code/local/Gone/Brands/etc/config.xml

there is some code snippets:app/code/local/Gone/Brands/etc/config.xml

    <adminhtml>
    <layout>
        <updates>
            <customertab>
                <file>customertab.xml</file>
            </customertab>
        </updates>
    </layout>
    <events>
        <customer_save_after>
            <observers>
                <brands_hide_manufacturers>
                    <type>model</type>
                    <class>Gone_Brands_Model_Observer</class>
                    <method>saveHideManufacturers</method>
                </brands_hide_manufacturers>
            </observers>
        </customer_save_after>
    </events>
</adminhtml>

app/code/local/Gone/Brands/Model/Observer.php

app/code/local/Gone/Brands/Model/Observer.php

<?php
class Gone_Brands_Model_Observer
{
 public function _construct()
 {
    echo "ssssssssssssssssssssssssssss";
    echo "<script>alert('aaa');</script>";
 }

 public function saveHideManufacturers() {
    echo "ssssssssssssssssssssssssssss";
    echo "<script>alert('bbbb');</script>";
 }
}

也许还有其他解决方案,如何从客户->编辑->我创建的带有自定义字段的标签中捕获表单?

Maye there are other solutions how to catch form from customer->edit -> my created tab with custom field?

谢谢.

==================================================================================

最后,花了四个小时.也许这对其他人有帮助.

Finally, four hours spent for this. Maybe this helps for someone else.

config.xml

config.xml

customer_save_after -> change to -> adminhtml_customer_save_after

现在可以正常工作.

推荐答案

最后,花费了四个小时.也许这对其他人有帮助.

Finally, four hours spent for this. Maybe this helps for someone else.

config.xml

config.xml

customer_save_after -> change to -> adminhtml_customer_save_after

现在可以正常工作.

这篇关于magento customer_save_after模型/未调用观察者,捕获客户-&gt;编辑-&gt;保存功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 17:15