I'm using the cashondelivery ( core module ) and I would like to add informations in the email order.
In the admin there is a field for informations. It's displaying during the checkout but I don't know how to display this field in the order confirmation mail.
I think I should create a file cashondelivery.phtml in this folder
app/design/adminhtml/default/default/template/payment/info/
But I don't know what to put inside this file.
Can someone help me ?
Did you solve this problem, I am facing this exact same issue. Please share if you have a solution.
Hi
Make sure cash on delivery form coming at file path
app\design\frontend\base\default\template\payment\form\cashondelivery.phtml
So please copy base file to your theme at path app\design\frontend\Yourpackage\default\template\payment\form\cashondelivery.phtml and replace code from
<?php if ($this->getInstructions()): ?>
<ul class="form-list checkout-agreements" id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none;">
<li>
<div class="<?php echo $this->getMethodCode() ?>-instructions-content agreement-content">
<?php echo nl2br($this->getInstructions()) ?>
</div>
</li>
</ul>
<?php endif; ?>TO
<?php $_code=$this->getMethodCode() ?>
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
<li>
<?php echo 'add custom form code here....'?>
</li>
<?php if ($this->getInstructions()): ?>
<li>
<div class="<?php echo $_code ?>-instructions-content agreement-content">
<?php echo nl2br($this->getInstructions()) ?>
</div>
</li>
<?php endif; ?>
</ul>Since I already had 'companyname' as one of my attributes I retrieved the value of this field and passed it as a param in the following function
app/code/core/Mage/Sales/Model/Order.php
public function sendNewOrderEmail()
{
/*Existing Code*/
if ($this->getCustomerIsGuest()) {
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId);
$customerId = Mage::getModel('customer/customer')->load($this->getCustomerId());
$companyname = $customerId->getCompanyname();
$customerName = $this->getBillingAddress()->getName();
} else {
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId);
$customerId = Mage::getModel('customer/customer')->load($this->getCustomerId());
$companyname = $customerId->getCompanyname();
$customerName = $this->getCustomerName();
}
/*Existing Code*/
$mailer->setTemplateParams(array(
'order' => $this,
'billing' => $this->getBillingAddress(),
'payment_html' => $paymentBlockHtml,
'companyname' => $companyname
));
/*Rest of the code remains the same*/
}After making this change. I edited my Transactional Email to include this param. Since I wanted to display inside Shipping Address, I placed my variable just before this line in
System > Transactional Emails > New Order Email
{{ var companyname }}
{{var order.getShippingAddress.format('html')}}