Skip to content

Get config value inside template email #37533

Open
@mrtuvn

Description

@mrtuvn

Description

Current when see template email i only find core use this way to get dynamic url

base_url=$this.getUrl($store,'',[_nosid:1])

But should be convenion if we have approach way to get value config instead only have getUrl function
Example

Expected behavior

example_config=$this.getConfig('config_path_url','scope_website')

Example

url=$this.getConfig('general/web/row_web_unsecure_base_url','scope_website')
urlExample2=$this.getConfig('general/web/row_web_unsecure_base_url','scope_store')

This will make code more flexible and easier to read for example below
{{trans '<a href="%urlFromConfig">test</a> Long text herere.' urlFromConfig=$this.getConfig('general/web/row_web_unsecure_base_url','scope_store')
|raw}}

Benefits

Instead hard code value every where in template we can use custom variable for get config value. Ability to get dynamic value from backend and fill into email template

Additional information

Current we have this work but it's will not work with some case
{{config path="sales_email/sales_email_config/base_url"}}


Example you put string above between

{{trans '<a href="{{config path="sales_email/sales_email_config/base_url"}}">test</a>Long text herere'}} <== this will break text output 

Release note

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Ready for Grooming

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions