0

We have a "{{config path variable" like below and I am seeing the following:

This variable {{config path='web/unsecure/base_url'}} is visible in email templates and in newsletter templates

But not or sometimes in custom variables (HTML)

{{config path='web/unsecure/base_url'}}

With sometimes I mean sometimes. It looks like it has something to do with other variables that are or aren't found in the same template ... Please find some examples below


Question: has anyone experienced something similar before?


Some tests I conducted

TEST 1

Created an empty email template with the following 3 links, where TEST123 contains the same first 3 links:

{{config path='web/unsecure/base_url'}}

{{config path='snh/emailsettings/headerfnt'}}

{{store url''}}

________________________

{{customVar code=TEST123}}

The result is that var 1-2-3 do print, but 4-5-6 do not

TEST 2

Created an empty email template with the following 3 links, where TEST123 contains the same first 3 links:

    {{customVar code=TEST123}

________________________

{{config path='web/unsecure/base_url'}}

    {{config path='snh/emailsettings/headerfnt'}}

    {{store url''}}

The result is that var 1-2-3-4-5-6 do print


Conclusion so far My conclusion is that apparently there is something to do with the order of variables being found. customvars need to be found and processed BEFORE other variables are found. I am digging through Varien filter & Core Template to find some logic as to why

2
  • 1
    but what gets outputted? Blank? Have a look in the database core_variable tables. Are your custom variables saved correctly, or possible escaped/altered in some way?
    – ProxiBlue
    Aug 8, 2013 at 15:51
  • Updated question
    – snh_nl
    Aug 9, 2013 at 7:45

4 Answers 4

1

It's probably your database entries.

Take a look at core_config_data:

SELECT `value` FROM `core_config_data` WHERE `path` = 'snh/emailsettings/headerfnt';

If it does return something, then it'd be a scope problem then. Check if scope and scope_id checks out (global, website, store level?). Safest way to go is default and 0, respectively.

If it does not return anything, then you need to insert something for this. You obviously probably know now what to insert, right?

2
  • tested what exactly? there are a bunch of stuff to test above. Aug 9, 2013 at 7:06
  • Tested if the config value was set up correct. And it is.
    – snh_nl
    Aug 9, 2013 at 7:46
0

This seems to be known in Magento. Posted in bugs/features.

0

Unfortunately magento2 supports only specific list of configurations to use in email template as config path.

To use your custom config path in email template you need to override the core functionality.

Below article explained it very well.

https://gordonlesti.com/magento-2-email-template-config-directives/

0

You can find how Magento does it - vendor/magento/module-variable/etc/di.xml

It's allowed to add new configuration paths in your module di.xml and they will be supported by email templates

 <?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Variable\Model\Source\Variables">
        <arguments>
            <argument name="configPaths" xsi:type="array">
                <item name="general/store_information" xsi:type="array">
                    <item name="general/store_information/emergency_phone" xsi:type="string">1</item>
                    <item name="general/store_information/line_address" xsi:type="string">1</item>
                </item>
            </argument>
        </arguments>
    </type>
</config>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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