Menu Close
    Start a Project Request quote Reading list Switch to dark mode
    magento-hyperlocal-marketplace-guide

    Magento Collection Iteration in Email Template

    In this blog i’ll discuss about how to iterate(using foreach loop) the Collection in your custom email templates.

    Let’s think situations like when you have to send an email which contains multiple customer addresses or product items, then you must need to iteration the collections in your custom email template.

    Magento provide very simple architecture to implement this feature in your project:

    Step 1: Add Below line in your email template


    template:- here you have to specify your custom phtml file path which should be kept inside magento frontend part.

    addresses:- it’s your Address collection which you want to iterate(using foreach loop) in your phtml file.

    PHTML Path:- app/design/frontend/default/default/template/yourmodule

    Now you can easily fetch your $addresses inside your phtml file like below:


    Now It’s done you’re ready to send the email with multiple addresses.

    I Hope this blog will help someone who needs above feature.

    Thanks

     

    . . .

    Comment (1)

    Add Your Comment

  • Akshay Taru
    Hi, I have tried exactly the same, But it is not working. My block not able to find the for loop template. Please help.
  • Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close