Marek123
Marek123

Reputation: 1211

Magento - Transaction E-Mails - Variables

is it somehow possible to use {{var invoice.increment_id}} in the creditmemo e-mails? It don't work if I do so...

<p><strong>Bestellnummer:</strong> {{var order.increment_id}}</p>
<p><strong>Datum:</strong> {{var creditmemo.created_at}}</p>
<p><strong>Rechnung:</strong> {{var invoice.increment_id}}</p>
<p>Liebe(r) {{htmlescape var=$order.getCustomerName()}},<br/><br/>  

Doesn't work. Does someone has a hint for me? Thanks!

EDIT
Is that correct? Edit the class Mage_Sales_Model_Order_Creditmemo and adding:

//Get Invocie from order Object 
        if ($order->hasInvoices()) {
            // "$_eachInvoice" is each of the Invoice object of the order "$order"
            foreach ($order->getInvoiceCollection() as $_eachInvoice) {
                $invoice = $_eachInvoice->getIncrementId();
            }

            //$invoice = $order->getInvoiceCollection();
        }

aswell as

$mailer->setTemplateParams(array(
                'order'      => $order,
                'creditmemo' => $this,
                'comment'    => $comment,
                'invoice'    => $invoice,
                'billing'    => $order->getBillingAddress()
            )
        );

and afterwards calling the variable {{var invoice}} in my email template?
But it doesn't show, what I'm missing here?

Upvotes: 0

Views: 1229

Answers (2)

Marek123
Marek123

Reputation: 1211

See my frist post. I got it right. Thanks to Zyava.
The problem was, you have to place this code one method above the sendUpdateEMail(), in sendEmail().

Thanks!

Upvotes: 0

Dmytro Zavalkin
Dmytro Zavalkin

Reputation: 5277

You should rewrite Mage_Sales_Model_Order_Creditmemo model in your module and add needed logic to sendUpdateEmail() method to get invoice object in credit memo email templates.

Upvotes: 2

Related Questions