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

Abdul Pathan
2,84212 silver badges22 bronze badges
asked Aug 2, 2019 at 11:21
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.

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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.