Child pages
  • [emails] Same text blocks in emails which sended one right after another when using DefineElement and RenderElement tags
Skip to end of metadata
Go to start of metadata

If use DefineElement in email design, RenderElement in email templates and send couple letters one right after another in code then text blocks in second letter will be the same as in first.

Steps for reproduction:

  1. Go to "Configuration > Website > Regional" -> then edit language pack -> "E-mail Design Templates";
  2. Edit text or HTML version of email design (depends on which you need) — paste some DefineElement, something like that:

    <inp2:m_DefineElement name="text">
    	<span class="mega-text">
    		<inp2:m_Param name="content"/>
    	</span>
    </inp2:m_DefineElement>
  3. Then go to you two email templates (make sure that they are sending one right after another) and add similar RenderElement blocks for it, like this one:

    <inp2:m_RenderElement design="text">
    	Text which differs
    </inp2:m_RenderElement>
  4. Send this emails.


Related Tasks

INP-1354 - Getting issue details... STATUS

1 Comment

  1. Problem turned out to be quite interesting. The template parser is converting markup into PHP code and creates a function for every block tag (e.g. DefineElement, RenderElement). To make sure, that function names doesn't collide for blocks named the same it's adding following to it's name:

    • name of the file, where tag was found
    • line number where tag definition starts

    Unluckily for us the name of template during e-mail sending is always the same email_template so it the RenderElement tag placed in same line in 2 different e-mails that are sent one after another will result in 1st PHP function to be used instead of 2nd one.

    To solve this I propose to generate template name (for the parser) using following formula: 

    et_ + EmailTemplateId + crc(text_to_be_parsed)