Customer.php ファイル ( import/export ) を変更して、CSV ファイルから顧客をインポートするときに新しいアカウントの詳細を自動的に送信できるようにしようとしています。
新しい行ごとに呼び出された (メールを受信した) 単純な mail() 呼び出しを削除したので、適切な領域で作業しています。問題は、新しいランダム パスワードを生成して新しいアカウントの詳細を送信しようとしたときに発生します。メールはまったく送信されず、理由もわかりません。コードは次のとおりです( app/code/local/Mage/ImportExport/Model/Import/Entity/Customer.php から編集)
/**
* Update and insert data in entity table.
*
* @param array $entityRowsIn Row for insert
* @param array $entityRowsUp Row for update
* @return Mage_ImportExport_Model_Import_Entity_Customer
*/
protected function _saveCustomerEntity(array $entityRowsIn, array $entityRowsUp)
{
if ($entityRowsIn) {
$this->_connection->insertMultiple($this->_entityTable, $entityRowsIn);
// BEGIN: Send New Account Email
$cust = Mage::getModel('customer/customer');
$cust->setWebsiteId(Mage::app()->getWebsite()->getId());
foreach($entityRowsIn as $idx => $u){
// Failed
$cust->loadByEmail($u['email']);
$cust->setConfirmation(NULL);
$cust->setPassword($cust->generatePassword(8));
$cust->save();
$cust->sendNewAccountEmail();
//$cust->sendPasswordReminderEmail(); // this call doesnt work either
}
// END: Send New Account Email
}
if ($entityRowsUp) {
$this->_connection->insertOnDuplicate(
$this->_entityTable,
$entityRowsUp,
array('group_id', 'store_id', 'updated_at', 'created_at')
);
}
return $this;
}