0

I'm looking for a way to grab all the filled out fields when a new customer registers and email the information to the admin. This includes some custom fields that are on the registration page.

I'm by no means an expert developer and would love a tutorial if it's even possible to accomplish this. I've yet to be able to find anything specific to what I need.

To elaborate step by step what I need:

User fills out new registration form

-->

After submit, all the data (Name, Email, Address, Custom fields)
will be emailed to the admin email.

Any ideas?

1 Answer 1

1

Use Magento Event System to handle it.

app/etc/modules/Your_Module.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Your_Module>
            <active>true</active>
            <codePool>local</codePool>
        </Your_Module>
    </modules>
</config>

app/core/local/Your/Module/etc/config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <global>
        <models>
            <your_module>
                <class>Your_Module_Model</class>
            </your_module>
        </models>
    </global>
    <frontend>
        <events>
            <customer_save_after>
                <observers>
                    <your_module>
                        <type>model</type>
                        <class>your_module/observer</class>
                        <method>customerSaveAfter</method>
                    </your_module>
                </observers>
            </customer_save_after>
        </events>
    </frontend>
</config>

app/code/local/Your/Module/Model/Observer.php

<?php

class Your_Module_Model_Observer
{
    public function customerSaveAfter(Varien_Event_Observer $o)
    {
        //Array of customer data
        $customerData = $o->getCustomer()->getData();

        //email address from System > Configuration > Contacts
        $contactEmail = Mage::getStoreConfig('contacts/email/recipient_email');

        //Mail sending logic here.

        if (!$o->getCustomer()->getOrigData()) {
            //customer is new, otherwise it's an edit 
        }
    }
}
?>

Hope this would help

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.