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


Send confirmation email when user was registered by API Magento

我打开了选项系统->配置->客户配置->需要电子邮件确认,现在当用户通过常规表格注册时,他们会收到带有所需帐户确认的电子邮件。但现在我需要为Magento API创建的用户做同样的事情。我设置了这个选项:

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

当我比较由表单和API创建的用户在数据库中的记录时,它们完全相同。我的意思是字段website_idstore_id

p.S:系统->配置->客户配置->共享客户帐户设置为全局

好吧,解决方案是覆盖Model Mage/Customer/Model/Customer/Api.php。点击此处了解更多信息!

以下内容可能很有用。当使用Soap注册客户端时,修改后的电子邮件发送如下。

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

第64行将找到

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

经常放置以下物品。

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

这将发送邮件。