简体   繁体   English

当用户通过API Magento注册时发送确认电子邮件

[英]Send confirmation email when user was registered by API Magento

I turned on the option System -> Configuration -> Customer Configuration -> Require Emails Confirmation and now when users registered by usual form they get the email with required account confirmation. 我打开了系统->配置->客户配置->要求电子邮件确认选项 ,现在,当用户以常规形式注册时,他们会收到带有所需帐户确认的电子邮件。 But now I need to do the same for users created by Magento API. 但是,现在我需要对Magento API创建的用户执行相同的操作。 I set this options: 我设置以下选项:

$result = $proxy->customerCustomerCreate($sessionId, [
    'email' => 'mycustomemail@gmail.com',
    'firstname' => 'testfirstname',
    'lastname' => 'testlastname',
    'password' => 'testpassword',
    'website_id' => 1,
    'store_id' => 1,
    'group_id' => 4,
]);

When I compared records in database for user created by form and API, they were exactly the same. 当我比较数据库中针对表单和API创建的用户的记录时,它们是完全相同的。 I mean fields website_id and store_id were the same. 我的意思是website_idstore_id字段相同。 How can I debug this or maybe you can tell me how to implement this feature into Magento's API? 我该如何调试它,或者您可以告诉我如何在Magento的API中实现此功能?

PS: System -> Configuration -> Customer Configuration -> Share Customer Accounts is set to Global . PS: 系统->配置->客户配置->共享客户帐户设置为全局

Well, the solution is to override Model Mage/Customer/Model/Customer/Api.php. 好吧,解决方案是覆盖Model Mage / Customer / Model / Customer / Api.php。 More about that here ! 更多关于这里

The following may be useful. 以下可能有用。 when using the Soap to register clients, the modified email is sent as follows. 使用Soap注册客户端时,修改后的电子邮件将按以下方式发送。

\ app \ code \ core \ Mage \ Customer \ Model \ Customer / Api.php

Line 64 will find 第64行会找到

public function create($customerData)
{
    $customerData = $this->_prepareData($customerData);
    try {
        $customer = Mage::getModel('customer/customer')
                    ->setData($customerData)
                    ->save();

Place the following often. 经常放置以下内容。

$customer->sendNewAccountEmail("registered","",1);

This will send the mail. 这将发送邮件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM