OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – How do I? Questions OneToMany relations in email templates

This topic contains 6 replies, has 3 voices, and was last updated by  Artem Liubeznyi 7 years, 9 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #36172

    Kadir Yücel
    Participant

    How can I access addresses or order items of entity “Magento Order” in email templates? Realtions “oneToMany” are not accessible.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #36173

    Artem Liubeznyi
    Spectator

    Hi Kadir,

    We currently do not support one-to-many relations because there is no way to specify the exact order you want to include into the template.

    One possible solution is to base your template on the Magento Order entity. You will be able to use its address and access customer details via relations too.

    Will this solve your use case?

    #36174

    Kadir Yücel
    Participant

    Thank you Artem for you quick response.

    I can access the customer entity but this not the same like billing and shipping addresses saved in order (table orocrm_magento_order_address). Furthermore I want to list the purchased items for information or invoice purpose.

    Are there any tricks to do that?

    #36175

    Kadir Yücel
    Participant

    What about extending this config with “oneToMany”

    #36176

    Artem Liubeznyi
    Spectator

    I am not sure about the results of such expansion; most likely, the variable will return only the first address in the collection, but there will be no way to distinguish billing and shipping addresses, nor guarantee that a specific address type will be returned.

    Looks like we need to extend our template capabilities to properly handle one-to-many relations. I will add this feature to our backlog, thank you very much for the heads up. I’ll keep you posted about the implementation progress, too (no idea on the timeline yet though).

    #36177

    roldan
    Participant

    Hi, is thereany news about this feature?

    i’ve created an email template associated to “Order” entity but i get:

    Calling “getlineitems” method on a “OroB2B\Bundle\OrderBundle\Entity\Order” object is not allowed

    How can i access this method in the template? I see that “lineItems” are not displaying in the “Entity variables” tab.

    Here says that “All fields that available in email templates stored in EntityConfigBundle, and can be configured in UI”

    https://github.com/orocrm/platform/blob/master/src/Oro/Bundle/EmailBundle/Resources/doc/email_templates.md

    and it’s true, the property “lineItems” is shown on “Entity management” but not in the template.
    How can i access OneToMany or ManyToMany properties on email templates?

    Thanks in advance!

    #36178

    Artem Liubeznyi
    Spectator

    No news so far; we have the feature in our backlog but don’t have an implementation timeline yet. Please follow our updates.

Viewing 6 replies - 1 through 6 (of 6 total)

The forum ‘OroPlatform – How do I? Questions’ is closed to new topics and replies.

Back to top