2

Is it possible to get a custom config value in transactional email template?

Unfortunately the following doesn't work:

{{config path='extraconfig_options/emailsettings/primarycolor'}}

Our system.xml looks like:

<?xml version="1.0"?>
<config>
    <tabs>
        <extraconfig translate="label" module="extraconfig">
            <label>Label</label>
            <sort_order>1</sort_order>
        </extraconfig>
    </tabs>
    <sections>
        <extraconfig_options translate="label" module="extraconfig">
            <label>Extra Config</label>
            <tab>extraconfig</tab>
            <frontend_type>text</frontend_type>
            <sort_order>1</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <emailsettings translate="label">
                    <label>Transactional Email Settings</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>1</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <primarycolor>
                            <label>Primary Color</label>
                            <frontend_type>text</frontend_type>
                            <validate>color</validate>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>           
                        </primarycolor>
                        <secondarycolor>
                            <label>Secondary Color</label>
                            <frontend_type>text</frontend_type>
                            <validate>color</validate>
                            <sort_order>2</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>             
                        </secondarycolor>
                    </fields>           
                </emailsettings>
            </groups>                
        </extraconfig_options>
    </sections>
</config>
  • It should work. Just make sure the path is correct – Marius Oct 22 '13 at 13:14
  • I edited the post with the module system.xml. I believe the path is correct. – Michael Oct 22 '13 at 13:29
  • Yea..it seams ok. And in the backend do you see a value in that field? I know the question may seam stupid. but I want to make sure. – Marius Oct 22 '13 at 13:38
  • Yeah, value is there :-) Good to know, a standard configuration like {{config path='trans_email/ident_support/email'}} is working properly. – Michael Oct 22 '13 at 13:43
  • 1
    Are there any values in your core_config_data table for other store views? Which email are you currently editing? – Kristof at Fooman Oct 22 '13 at 16:15
2

Copy the path from the config_core_data database table and paste it/check it against your code.

Check that your value and mail is sent in the correct store view scope

After this, start digging and check the code with xdebug

0

Putting this here in case it helps anyone else. Apparently, you have to grant permissions to use the newly added variable in System > Permissions > Variables. See: https://stackoverflow.com/a/36300891/8127660

For me, after I did this, it worked. Hope this helps someone else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.