How to use multidimensional array values in magento email template
-
01-01-2021 - |
Question
I am using Magento 1.9.3.7 version. I am triggering a mail from the observer with multidimensional array values. How I can get and use it in the mail template.
Solution
We should include a block with the template from a current theme inside the email template instead, just like we do for CMS pages. See below:
{{block type='core/template' area='frontend' template='pathtotemplate/templatefilename.phtml' items=$items}}
Then, you just need to sort out your data in phtml-file, see the following example:
<?php foreach ($this->getItems() as $_item): ?>
<p><?php echo $_item['name'] ?></p>
I referred this link for the solution.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange