Reputation: 311
I have created a custom template for customer registration
, but I don't know how to call it when I register a customer.
I have created a custom email template like this:
<template>
<email>
<vendor_suggestions_email_template translate="label">
<label>Vendor Suggestions</label>
<file>vendor_suggestions.html</file>
<type>html</type>
</vendor_suggestions_email_template >
</email>
</template>
My custom email template is loading in admin panel, I have checked it. Now I want to call this email for customer registration
. So I have to overwrite my customer model from mage/customer/model/customer.php
file to my local customer module.
Here is the customer model code for sending email for customer registration
const XML_PATH_REGISTER_EMAIL_TEMPLATE = 'customer/create_account/email_template';
public function sendNewAccountEmail($type = 'registered', $backUrl = '', $storeId = '0')
{
$types = array(
'registered' => self::XML_PATH_REGISTER_EMAIL_TEMPLATE, // welcome email, when confirmation is disabled
'confirmed' => self::XML_PATH_CONFIRMED_EMAIL_TEMPLATE, // welcome email, when confirmation is enabled
'confirmation' => self::XML_PATH_CONFIRM_EMAIL_TEMPLATE, // email with confirmation link
);
if (!isset($types[$type])) {
Mage::throwException(Mage::helper('customer')->__('Wrong transactional account email type'));
}
if (!$storeId) {
$storeId = $this->_getWebsiteStoreId($this->getSendemailStoreId());
}
$this->_sendEmailTemplate($types[$type], self::XML_PATH_REGISTER_EMAIL_IDENTITY,
array('customer' => $this, 'back_url' => $backUrl), $storeId);
return $this;
}
Now, I don't know what should I do to send my customer email template for customer registration
. I really don't understand how the above code works for sending email in customer registration and how to trigger my custom email template.
Can anyone help me????
Upvotes: 1
Views: 5554
Reputation: 3836
You can load your custom template in System >> Transactional Email
section in backend.
Then You need to assign that Email Template for Customer Registration from
System >> Configuration >> Customer Configuration
In create new Account options block select custom email template in Default Welcome Email
select box and save config. then Magento will use your custom email template for customer registration.
Upvotes: 2