Hi I am trying to pass multi-dimension array to email template Magento 1.9
CODE FOR SENDING EMAIL
$emailVariables['appointment']=$appointmentArray; //it is appointment data array
$emailVariables['store_info']=$storeInfoArray; //it is store info array
$emailVariables['customer']=$appointmentCustomer; //it is customer info array
I have created this function for sending mail with Email Variables
$this->sendEmail($templateId,$sender,$email,$customer_name,$emailVariables);
CODE IN EMAIL TEMPLATE I AM USING
{{var customer.firstname}}
I tried this code for store info as well. like
{{var store_info.store_id}}
It is not showing any information/first name only it is showing Array
-
instade of array pass the value usnig object, then you can access there.Dhiren Vasoya– Dhiren Vasoya2019年08月02日 11:23:20 +00:00Commented Aug 2, 2019 at 11:23
1 Answer 1
Magento Allows you to pass Varien Objects to email templates. If you see into order email templates you will get to know how order data is fetched from order object.
Try setting data
$customerObject = new Varien_Object();
$customerObject->setData($appointmentCustomer);
$emailVariables['customer']=$customerObject;
And in email template fetch the data as
{{var customer.getName()}} // Here your customer array key would be **name**
Hope it finds helpful.
-
Hello Abdul, I tried this solution and its is working. Thank You so much.indrajit patil– indrajit patil2019年08月02日 12:10:12 +00:00Commented Aug 2, 2019 at 12:10