Tuesday, August 17, 2010

Confirmation Email Facility to customer on submission of contact us form

· Open app\code\core\Mage\Contacts\etc\system.xml, and find below code,


<email_template translate="label">

<label>Email Template</label>

<frontend_type>select</frontend_type>

<source_model>adminhtml/system_config_source_email_template</source_model>

<sort_order>30</sort_order>

<show_in_default>1</show_in_default>

<show_in_website>1</show_in_website>

<show_in_store>1</show_in_store>

</email_template>

Add below code after above code in system.xml,


<confirmation_email_template translate="label">

<label>Customer Email Template</label>

<frontend_type>select</frontend_type>

<source_model>adminhtml/system_config_source_email_template</source_model>

<sort_order>30</sort_order>

<show_in_default>1</show_in_default>

<show_in_website>1</show_in_website>

<show_in_store>1</show_in_store>

</confirmation_email_template>


· Now open app\code\core\Mage\Contacts\controllers\IndexController.php & find below code,

const XML_PATH_EMAIL_TEMPLATE = 'contacts/email/email_template';

Add below code after above code,

const XML_PATH_CONFIRMATION_EMAIL_TEMPLATE = 'contacts/email/confirmation_email_template';

Now find below code in same file,

$mailTemplate->setDesignConfig(array('area' => 'frontend'))

->setReplyTo($post['email'])

->sendTransactional(

Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE),

Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER),

Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT),

null,

array('data' => $postObject)

);

Add below code after above code,

$mailTemplate->setDesignConfig(array('area' => 'frontend'))

->setReplyTo(self::XML_PATH_EMAIL_SENDER)

->sendTransactional(

Mage::getStoreConfig(self::XML_PATH_CONFIRMATION_EMAIL_TEMPLATE),

Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER),

$post['email'],

null,

array('data' => $postObject)

);

You will need to create new email template from Admin->Configuration->Transactional Emails, & then set that new email template to Customer Email Configuration option in Email options in Contacts


1 comment:

  1. Your blog is really a great resourceful to me because i got a knowledge so visit your blog and i would like to thank you for the efforts which you have made in fabricated this article.Magento Themes

    ReplyDelete