Logicify / mautic-advanced-templates-bundle

Plugin extends default email template capabilities with TWIG block so you can use advanced scripting techniques like conditions, loops etc
https://logicify.com/?utm_source=github&utm_campaign=mautic-templates&utm_medium=opensource
MIT License
86 stars 57 forks source link

Accessing lead tags #9

Closed arashsoheili closed 2 years ago

arashsoheili commented 4 years ago

Anyway to access the lead tags. It doesn't seem to be on the lead property. How can this be added. I can make a PR if you guide me a bit.

arashsoheili commented 4 years ago

I figured this out. I can make a PR of this is useful to others.

corvis commented 4 years ago

Hey @arashsoheili have you solved your issue? If so could you please share the solution here to make it easier for others? Probably this is something I should include into the doc? Otherwise let's close this issue...

arashsoheili commented 4 years ago

@corvis I will make a PR today.

kamikazebr commented 4 years ago

Miss call the use Mautic\CoreBundle\Factory\ModelFactory;

UPDATED: in class EmailSubscriber to work partially

Yet i get none tags from that.

{% TWIG_BLOCK %}
Oi {{lead.firstname}}
{% set tags = lead.tags | json_decode %}     
    Suas Tags:
    <ul> 
    {% for item in tags %}
      Item: {{item}}
      {{ include('dc:270410h') }}
    {% endfor %}
    </ul>                                           
{% END_TWIG_BLOCK %}

Changed {% set tags = lead.tags | json_decode %} To {% set tags = lead.tags %}

In Debuger log it says expect string type but it array.

Now all it WORKS!

leog commented 4 years ago

Looking for this to work, any chance it could be merged and added to the docs @corvis?

MarketSmart commented 2 years ago

This has been added to the 1.2-beta branch.