Use handle="sales_email_order_items"
instead of handle="sales_email_order_invoice_items"
because, some times invoice not be created automatically and you cannot use invoice items in your phtml. Invoice creation related to payment or your store payment configuration. New order email will sent when order state (not status) is changed to processing
. Order state will be processing
when payment approved or invoice created manually in the backend. See original email templates to figure out the situation.
Your route contacts/index/post
- I assume is part of the core Mage_Contacts
module in Magento. If so, that template can be configured via Magento admin at System > Configuration > Contacts
; see also:
http://www.magentocommerce.com/wiki/modules_reference/english/mage_adminhtml/system_config/edit/contacts
If you were to inspect the controller, you would see it referenced:
# File: app/code/core/Mage/Contacts/controllers/IndexController.php
# postAction, lines ~96-99
....
$mailTemplate->setDesignConfig(array('area' => 'frontend'))
->setReplyTo($post['email'])
->sendTransactional(
Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE),
...
And the constant XML_PATH_EMAIL_TEMPLATE
resolves to the configuration path contacts/email/email_template
.
If you continue to read this postAction
method, you can see that it passes the entire POST
data to the template. Therefore, all of its data should be available to you during the transactional e-mail processing:
array('data' => $postObject) // $postObject Varien_Object
So your e-mail template can call in the POST
data like so:
{{var data.getFormFieldName()}}
Now, regarding your AJAX response, you may have to override the controller in order to generate a useful JSON response. Otherwise the response is going to be the HTML output of the controller's _redirect
call. If you did extend the controller to return your desired JSON, it can be accessed as the first parameter in your callback:
...
onComplete: function(transport) {
var response = transport.responseText.evalJSON();
alert(response.custom_response_property);
}
...
Best Answer
The code which sends the contacts email is:
You can see, it uses the value
email
which was posted from the contacts form, which actually is exactly what you want. Some modification you or an extension you installed must have changed the default behavior.