0

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

1
  • instade of array pass the value usnig object, then you can access there. Commented Aug 2, 2019 at 11:23

1 Answer 1

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.

1
  • Hello Abdul, I tried this solution and its is working. Thank You so much. Commented Aug 2, 2019 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.