All Projects → Logicify → mautic-advanced-templates-bundle

Logicify / mautic-advanced-templates-bundle

Licence: MIT license
Plugin extends default email template capabilities with TWIG block so you can use advanced scripting techniques like conditions, loops etc

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to mautic-advanced-templates-bundle

mautic-api-services
Add an external API as a service in Mautic
Stars: ✭ 13 (-79.37%)
Mutual labels:  marketing-automation, mautic
MauticFBAdsLeadAdsBundle
Enables synchnronization of Facebook Lead Ads as leads into Mautic.
Stars: ✭ 45 (-28.57%)
Mutual labels:  marketing-automation, mautic
mautic-contact-ledger
Historical accounting for contacts in Mautic.
Stars: ✭ 17 (-73.02%)
Mutual labels:  marketing-automation, mautic
Mautic
Mautic: Open Source Marketing Automation Software.
Stars: ✭ 4,887 (+7657.14%)
Mutual labels:  marketing-automation, mautic
Facebook-Auto-Pilot
Automate common Facebook activities such as posting to groups and pages walls. Effortlessly post to multiple groups or pages.
Stars: ✭ 126 (+100%)
Mutual labels:  marketing, marketing-automation
Flowy
The minimal javascript library to create flowcharts ✨
Stars: ✭ 8,636 (+13607.94%)
Mutual labels:  marketing, marketing-automation
python-automated-bulk-whatsapp-messages
It is a python script to send automated bulk WhatsApp messages to multiple recipients from an excel sheet at once.
Stars: ✭ 56 (-11.11%)
Mutual labels:  marketing, marketing-automation
Erxes
Free and open fair-code licensed all-in-one growth marketing & management software
Stars: ✭ 1,988 (+3055.56%)
Mutual labels:  marketing, marketing-automation
drip-nodejs
The complete Nodejs wrapper for the Drip REST API
Stars: ✭ 18 (-71.43%)
Mutual labels:  marketing-automation
startup-marketing-checklist
A checklist of tactics for marketing your startup.
Stars: ✭ 5,214 (+8176.19%)
Mutual labels:  marketing
standard-edition
Roadiz CMS v1 standard edition (not-headless)
Stars: ✭ 32 (-49.21%)
Mutual labels:  twig
mautic-recaptcha
This Plugin brings reCAPTCHA integration to mautic.
Stars: ✭ 43 (-31.75%)
Mutual labels:  mautic
19h47.fr
🔥
Stars: ✭ 25 (-60.32%)
Mutual labels:  twig
cssinliner-extension
[DEPRECATED] CSS inliner support for Twig
Stars: ✭ 30 (-52.38%)
Mutual labels:  twig
phpPgAdmin6
PHP7+ Based administration tool for PostgreSQL 9.3+
Stars: ✭ 45 (-28.57%)
Mutual labels:  twig
twig-bulma-form-theme-bundle
A Twig Form Theme for Bulma 0.3.x for use with the Symfony 2.8 / 3.x framework
Stars: ✭ 24 (-61.9%)
Mutual labels:  twig
landingpress
Este é um tema wordpress extremamente simples e livre de qualquer formatação para ser usado com o plugin Elementor / This is a wordpress theme extremely simple and free from any format to be used with Elementor plugin to building Landing Pages
Stars: ✭ 13 (-79.37%)
Mutual labels:  mautic
Symfony-code-snippets
Over 100 Symfony Code Snippets for PhP code And Over 80 Twig Code Snippets. Just type the letters 'sf' to get a list of all available Symfony Code Snippets. For Twig Just Type the Tag name and you will get AutoCompletion.
Stars: ✭ 15 (-76.19%)
Mutual labels:  twig
Magento2 NewsletterSubscribeAtCheckout
This Magento 2 module allows you to enable a newsletter subscription checkbox on the checkout page.
Stars: ✭ 13 (-79.37%)
Mutual labels:  marketing
markdown-extra
Markdown extension for Twig
Stars: ✭ 83 (+31.75%)
Mutual labels:  twig

Mautic Advanced Templates Bundle

Plugin extends default email template capabilities with TWIG block so you can use advanced templating techniques like conditions, loops etc.

Purpose

For example, you need a slightly different content of your email depending on the information you already know about your contact (e.g., country, gender, whatever). Instead of creating tons of very similar emails, you can create one with conditions coded inside.

Another example: you might want to include dynamic content to your email. Let's say you are implementing an Abandoned Cart feature and you want your customers to see exact content of their cart. Again, the solution might be to push cart content in JSON format to your contact via API and then iterate through the items in your template to render picture, name and price for each one.

Compatibility

This plugin was tested with:

  • Mautic v2.14.2
  • PHP v7.1.23

There is a high probability it is compatible with other environments, but we never tested it.

Features

  • TWIG templates could be used in the emails. Just create an email and put your TWIG template between special tags:
    {% TWIG_BLOCK %} 
    Your template TWIG goes here....                                        
    {% END_TWIG_BLOCK %}
  • Reusable TWIG snippets could be loaded form Dynamic Content entities.
  • TWIG extended with some useful functions and filters (see below).
  • RSS support
  • RSS items related to contact's segment preferences center and RSS category

Installation

  1. Download or clone this bundle into your Mautic /plugins folder. Make sure the name of the folder containing plugin files is MauticAdvancedTemplatesBundle (case sensitive). Rename it if it isn't, otherwise it will not be recognized.
  2. Delete your cache (app/cache/prod).
  3. In the Mautic GUI, go to the gear and then to Plugins.
  4. Click "Install/Upgrade Plugins".
  5. You should see the Advanced Templates Bundle in your list of plugins.

Usage

Once installed, the plugin is ready to be used (no configuration required). Shortly saying, the text between {% TWIG_BLOCK %} and {% END_TWIG_BLOCK %} in your emails will be treated as a TWIG template. Please check out TWIG official documentation to familiarize yourself with syntax and capabilities.

You can also avoid lots of copy-and-paste with include() function available in templates. Just put reusable pieces of templates into Dynamic Content entity and use it in your main email templates (see examples below).

Note: The context will be shared with included template so each variable available outside will be available in the included snippet.

Context

The table below explains which variables are exposed to the context. Also it contains the list of extra functions and filters available. Please note that all standard library of tags\filter\functions as per official TWIG documents is available as well.

Entity Type Description Example
lead Variable Holds a Lead entity (contact). You should refer fields by alias name (see example). {{lead.firstname}}, {{lead.country}}
json_decode Filter Converts string in JSON format into object. `{% set cart = lead.cart

Example 1: Basic scenario

Let's say you'd like to add an extra paragraph about weather in New York for people from that area:

  1. Navigate to the Channels / Emails / New / Builder
  2. Open the editor for the slot you need to update (Source code mode is preferable)
  3. Put the following inside your template:
    {% TWIG_BLOCK %} 
        <p>Hi {{lead.firstname}},</p>
        {% if lead.city == 'New York' %}
            <p>What a great weather is in New York this week!</p>
        {% endif %}
        
        <p>Main letter content goes here</p>         
    {% END_TWIG_BLOCK %}

Example 2: Rendering structured data

Imaging you need to remind your prospect about incomplete purchase (Abandoned Cart feature).

We assume you have an integration with your e-commerce software which pushes cart information into Mautic contact entity in the custom field cart.

Assume cart information is JSON and has the following format:

  [
    {"sku": "123456", "name": "My cool product 1"},
    {"sku": "8574865", "name": "My cool product 2"}
  ]

Thus, in order to render all items, you should code something like this:

{% TWIG_BLOCK %} 
    {% set cart = lead.cart | json_decode %}     
    Your cart:
    <ul> 
    {% for item in cart %}
      <li>Item Name: {{ item.name }}</li>
    {% endfor %}
    </ul>             
{% END_TWIG_BLOCK %}

Example 3: Reusable code snippets

It might happen you need similar blocks to be included into multiple emails. In this case, it is a good idea to improve maintainability and keep common pieces in a single place. The solution this bundle offers is to leverage Dynamic Content entity and TWIG built-in function include().

Let's continue with the previous example but turn template for rendering a single item into a reusable snippet.

  1. Navigate to Components / Dynamic Content
  2. Create new entity with name email-cart-item.
  3. Put the following into Content area:
    <li>Sku: {{ item.sku }}, Name: {{ item.name }}.</li>
  4. Update your email template with the following:
    {% TWIG_BLOCK %} 
        {% set cart = lead.cart | json_decode %}     
        Your cart:
        <ul> 
        {% for item in cart %}
          {{ include('dc:email-cart-item') }}
        {% endfor %}
        </ul>             
    {% END_TWIG_BLOCK %}
    Notice prefix dc: which instructs template resolver to look for dynamic content instance.

Example 4: RSS support

     {% TWIG_BLOCK %} 
          {% set items = 'http://domain.tld/feed/' | rss %}     
          <ul> 
          {% for item in items %}
              <li>
               <a href=''{{ item.link }}'>{{ item.title }}</a> ({{ item.pubDate|date('m/d/Y') }})
               <br />{{ item.description|raw }}
               </li>
          {% endfor %}
          </ul>             
      {% END_TWIG_BLOCK %}

Example 5: RSS related items to contact's segments

        {% TWIG_BLOCK %} 
            {% set items = 'http://domain.tld/feed/' | rss('segments') %}     
            <ul> 
            {% for item in items %}
                <li>
                 <a href=''{{ item.link }}'>{{ item.title }}</a> ({{ item.pubDate|date('m/d/Y') }})
                 <br />{{ item.description|raw }}
                 </li>
            {% endfor %}
            </ul>             
        {% END_TWIG_BLOCK %}

Credits

Dmitry Berezovsky, Logicify (http://logicify.com/)

Disclaimer

This plug-in is licensed under MIT. This means you are free to use it even in commercial projects.

The MIT license clearly explains that there is no warranty for this free software. Please see the included LICENSE file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].