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.
- CreatorTopic
- December 11, 2015 at 1:04 am #36172
How can I access addresses or order items of entity “Magento Order” in email templates? Realtions “oneToMany” are not accessible.
- CreatorTopic
- AuthorReplies
- December 11, 2015 at 2:24 am #36173
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?
December 11, 2015 at 2:55 am #36174Thank 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?
December 11, 2015 at 3:03 am #36175What about extending this config with “oneToMany”
YAML123#line 9 at platform/src/Oro/Bundle/EmailBundle/Resources/config/entity_config.ymlallowed_type: [string, text, integer, smallint, bigint, boolean, datetime, date, time, float, decimal, money, percent, enum, multiEnum, file, image, ref-one, manyToOne]December 11, 2015 at 5:24 am #36176I 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).
July 9, 2016 at 4:09 pm #36177Hi, 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”
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!
July 21, 2016 at 8:12 am #36178No news so far; we have the feature in our backlog but don’t have an implementation timeline yet. Please follow our updates.
- AuthorReplies
The forum ‘OroPlatform – How do I? Questions’ is closed to new topics and replies.