Giter VIP home page Giter VIP logo

logicify / mautic-advanced-templates-bundle Goto Github PK

View Code? Open in Web Editor NEW
83.0 18.0 57.0 44 KB

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

Home Page: https://logicify.com/?utm_source=github&utm_campaign=mautic-templates&utm_medium=opensource

License: MIT License

PHP 100.00%
mautic twig marketing-automation marketing

mautic-advanced-templates-bundle's Introduction

Mautic Advanced Templates Bundle

Plugin extends default email template capabilities with TWIG block so you can use advanced templating techniques like conditions, loops etc. Support has also been extended to sms templates.

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 v4.4.0
  • PHP v8.0

There pluggin is compatible with other 5.x versions. Will not work with versions lower than 4.x.

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
  • json_encode, json_decode twig implementations

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 with the command (php bin/console cache:clear).
  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 %}

Example 6: Using lead.tags

        {% TWIG_BLOCK %}
            {% set tags = lead.tags %}     
            Tags:
            <ul> 
                {% for item in tags %}
                <li>{{item}}</li>
                {% endfor %}
            </ul>                                           
        {% END_TWIG_BLOCK %}

Example 7: Rendering structured data from tokens

Instead of pushing data to a custom field, you can specify dynamic data when using the Email Send API. When making the API call, set your POST body to a JSON object including a tokens key like below:

{
    "tokens": {
        "{cart}": [{"sku":"A100","name":"Item 1"},{"sku":"Z200","name":"Item 2"}]
    }
}

To render, code something like this:

{% TWIG_BLOCK %}
  Your cart:
  <ul>
  {% for item in cart %}
    <li>Item Name: {{ item.name }} (SKU: {{ item.sku }})</li>
  {% endfor %}
  </ul>
{% END_TWIG_BLOCK %}

Credits

Contributors

Thanks goes to these wonderful people

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.

mautic-advanced-templates-bundle's People

Contributors

aleksandr-block avatar corvis avatar kuzmany avatar marketsmart avatar pabloveintimilla avatar pjeby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mautic-advanced-templates-bundle's Issues

Can't use any variables

I can't seem to get custom tokens variables to work in the subject/body.

My main use case:
I want to specify the subject from the API. How I send the custom tokens work in the vanilla templating system, but Twig doesn't get them.
Template:
Subject: {% TWIG_BLOCK %}{% subject %}{% END_TWIG_BLOCK %}
Body:

{content}

{signature}

{unsubscribe_text}

Request:
POST https://mautic.varigergo.hu/api/emails/EMAIL_ID/contact/CONTACT_ID/send

{ "tokens": { "subject": "xxxx", "content": "xxxxx" } }

Error:

[2023-04-09 13:37:09] mautic.CRITICAL: Uncaught PHP Exception Twig\Error\SyntaxError: "Unknown "subject" tag in "__string_template__63495053935a5082041ab9769b6c41ccf06b0329b0eeb8cb21a49cc072432a2c" at line 1." at /var/www/html/vendor/twig/twig/src/Parser.php line 160 {"exception":"[object] (Twig\\Error\\SyntaxError(code: 0): Unknown \"subject\" tag in \"__string_template__63495053935a5082041ab9769b6c41ccf06b0329b0eeb8cb21a49cc072432a2c\" at line 1. at /var/www/html/vendor/twig/twig/src/Parser.php:160)"} {"hostname":"ae6df2b3b54a","pid":50}

RSS item image

Thanks for the plugin. Do you plan to add support for item image in the future?

TWIG_BLOCK unknown

Mautic Version: 2.15.1
PHP Version: 7.0.18

This seems working on Email Template creation through 'Code Mode' option. But when I tried to applied it on the theme that I created, it breaks. I got this error:

mautic.CRITICAL: Uncaught PHP Exception Twig_Error_Syntax: "Unknown "TWIG_BLOCK" tag." at /var/www/html/mautic/themes/hp-transactional/html/email.html.twig line 90 {"exception":"[object] (Twig_Error_Syntax(code: 0): Unknown "TWIG_BLOCK" tag. at /var/www/html/mautic/themes/hp-transactional/html/email.html.twig:90)"} []

.

.

Plugin is installed but is not working on Mautic 2

Hi. I've installed the plugin (Mautic v2.16.2) and I can see it on the plugins list but the Twyg code inside emails templates is not rendered (even inside emails preview and emails sent).
See attached screenshot. What can I do to fix this ?
Thanks for your help !
InkedBildschirmfoto 2020-08-25 um 15 32 24_LI

Webview of campaign mails have the same values for all contacts

When viewing a campaign email that has been sent to multiple contacts through the web view the values within the twig template are the same for all contacts. This can be replicated by sending a campaign to multiple contacts containing a twig block referencing a variable that's unique to the contact and then either opening the webview URL in the email or by opening the email in the contact details.

This issue was previously affecting the actual sent emails as well, but was fixed in #10 (issue #6 ). But others have experienced the same issue concerning the webview (comment here).

If I check the actual values saved to the database you can see that the referenced copy (email_copy) sent to the contact in email_stats is the same for all users and contains the values of the first contact, but the tokens row does actually contain a dynamiccontent="Dynamic Content 1" containing the whole email with the correct values for that contact.

For now we removed the {webview_url} variable from our email templates to mitigate this issue by at least not showing faulty information to users or leaking sensible data.

Need Help, Its Not Working for Me

I am having trouble with the "Mautic Advanced Templates Bundle" plugin in my Mautic instance. I have installed the plugin and followed the instructions, but I am still encountering issues.

Mautic Version: v4.1.2
PHP: 7.4

Steps taken so far:

  • Installed and Activated the "Mautic Advanced Templates Bundle" plugin.
  • Created a new Email Template, edited in source code mode.
  • Sent the Email.
  • Didn't Received the required result

Screenshots:
Template Code:
image

Received In Email:
image

Accessing lead tags

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.

Does it support email subjects?

Hi!

I'm wondering if this supports email subjects. I need to output a different vowel in a word depending on the gender of the contact. In the body it was somewhat easy to solve with the dynamic content feature, but it's not supported for subjects in Mautic. Can I include TWIG conditionals in the email subject if I use your plugin?

Thanks!

Mautic doesn't recognize the plugin if you just clone it

I was not able to get my Mautic installation to recognize the plugin until I renamed the directory fro mautic-advanced-templates-bundle to MauticAdvancedTemplatesBundle. It would be good to mention this in the documentation, or perhaps to change the name of the repository so that cloning it will work correctly by default.

Does this work with Mautic 3?

running Mautic 3 and cannot get the plugin to show. Am i doing something wrong or does this not work with Mautic 3 yet...

Twig for SMS

Working on getting this to work with sms sends as well. So far it seems doable.

Wanted to check if this impossible, really hard or already in progress.

Reusable code snippets/Dynamic content does not work in Mautic 4.4.10

Trying to use dynamic content as per Example 3: Reusable code snippets using the following...

{% TWIG_BLOCK %} {{include('dc:test_content')}} {% END_TWIG_BLOCK %}

I get the error...

mautic.NOTICE: Swift_TransportException: Error while rendering part text: line 1: attempt to call non-existent macro 'include' (uncaught exception) at /var/www/mautic/app/bundles/EmailBundle/Swiftmailer/Transport/AbstractTokenArrayTransport.php line 291 while running console command mautic:emails:send []

Implement isFresh method

Currently Twig_Loader_DynamicContent->isFresh() just returns always false. Would like to see this method implemented in the future somehow.

Reusable code snippets - Error

Hi !
I'm trying to use a reusable code snippet creating a Dynamic Content and including it on my email using the next code:

{% TWIG_BLOCK %} {{ include('dc:featured-products') }} {% END_TWIG_BLOCK %}

In the Dynamic Content I declare some variables using {% set products = items.products %}, but It returns me a 500 Error.

On the Mautic error log I got this message:
[2020-03-09 12:36:09] mautic.CRITICAL: Uncaught PHP Exception Twig_Error_Syntax: "Unexpected token "operator" of value "%" in "dc:featured-products" at line 3." at /vendor/twig/twig/lib/Twig/ExpressionParser.php line 208 {"exception":"[object] (Twig_Error_Syntax(code: 0): Unexpected token \"operator\" of value \"%\" in \"dc:featured-products\" at line 3. at /vendor/twig/twig/lib/Twig/ExpressionParser.php:208)"} []

Does the 'include' TWIG function support variable declaration or anything that starts with {% ?
In the example of this plugin there is only variable printing with {{ }}.

How do I get Owner information?

I tried pulling in lead.owner and lead.owner_id but that was empty in the email preview. Is there any way to get the contact owner, even if just their ID? In the database, the field is right on the leads table and it's called owner_id.

Thanks!

Same value for different contacts in campaign batch

It looks the twig expression result value from the email template for the first contact in campaign is repeated for every contact in a campaign (e.g. lastname - each contact gets the same lastname)

To reproduce:

  1. Create email template with Twig expression extracting data from contact/lead
    {% TWIG_BLOCK %}

    Hi {{lead.firstname}},

{% END_TWIG_BLOCK %}
2. Select segment with more than 1 contact
3. Start campaign

-> each contact gets an email with the lastnameof the first contact

Localized dynamic content upon template parsing

Greetings,
thank you for the wonderful work so far. I am setting Mautic as a marketing suite for an ecomm operating in 15+ countries and template localization is a big feature for me. With your plugin I was able to bake into my grapejs templates references to dynamic content for the message generation(mostly footers and impressum). Although it became apparent that these includes are 'strict' without attempt to get their translated entities for leads(contacts) which have their preferred locale set.
After a few hours into code inspection I was able to modify the plugin as to fetch the translated entities for dynamic content and it works. Yet in a very hacky way using PHP globals to pass the lead from EmailSubscriber to Twig_Loader_DynamicContent.
Basically this in TemplateProcessor.php :

private function processTwigBlock($lead, $tokens = null)
    {
        $this->lead = $lead;
        $GLOBALS['lead'] = $lead;

And then in Twig_Loader_DynamicContent:

private function findTemplate($resourceAlias)
    {
        $model = $this->modelFactory->getModel('dynamicContent');
        $result = $model->getEntities(
            [
                'filter' => [
                    'where' => [
                        [
                            'col' => 'e.name',
                            'expr' => 'eq',
                            'val' => $resourceAlias,
                        ],
                        [
                            'col'  => 'e.isPublished',
                            'expr' => 'eq',
                            'val'  => 1,
                        ]
                    ]
                ],
                'ignore_paginator' => true,
            ]);

        if (count($result) === 0) {
            return null;
        }

        /**** The result array key is the dynamic content ID - So use array_keys and get the first (and only) found key  ****/

        $keys = array_keys($result);  

        $originalEntity = $result[$keys[0]];
        
        $translatedEntity = $model->getTranslatedEntity($originalEntity,$GLOBALS['lead']);
        
        $this->logger->debug("Templates: The resolved base entity is :".print_r($translatedEntity[1]->getId(),true));
        $this->logger->debug("Templates: The current lead prefered locale is:".$GLOBALS['lead']['id'] . " and locale is :".$GLOBALS['lead']['preferred_locale'] );

        return $translatedEntity[1]; 
    }

Would you care to hint a more elegant way of passing the Lead down the Twig chain?
And would you plan merging such a feature into master for the community?

Regards,
Daniel

Plugin broke emojis in emails

When plugin is enabled emojis doesn't work correctly in all emails - no matter is there {% TWIG_BLOCK %} in it or no.
Emojis are visible in email builder and preview ๐Ÿ€ but in sent emails it shows as :four_leaf_clover:
Removing plugin fix this.
Mautic v4.4.6

Feature Request: Add ability to extend TWIG files

Hello,

I've been using the Mautic Advanced Templates Bundle and it's been a great help in expanding Mautic's email template capabilities. I appreciate the support for advanced Twig templating techniques that the bundle offers.

One feature of Twig that I find useful in other contexts is the extend function, which allows for a base "skeleton" template that has blocks that child templates can override. This provides a consistent layout across different emails or templates and promotes reusability of code.

I didn't see explicit mention in the documentation about support for the extend function in this bundle. I believe adding this functionality would benefit many users who want to further organize their templates and streamline their work.

JSON Scripting Issue - TWIG outputs does not match RAW data.

I'm seeing several scenarios where the TWIG template is outputting the wrong values when I run campaigns.

In the example you can see the output data does not match the raw JSON data when you compare stocks #s.

SAMPLE:
image

CODE:

<!-- INVENTORY SNIPPETS --> 
{% TWIG_BLOCK %} 
    {% set items = lead.c_inventory_json | json_decode %}
    {% for item in items %}
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="em_full_wrap" bgcolor="{contactfield=d_page_bgcolor}" style="table-layout:fixed;">
  <tr>
    <td align="center" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="em_full_wrap" bgcolor="{contactfield=d_page_bgcolor}" style=" table-layout:fixed;">
        <tr>
          <td align="center" valign="top"><table align="center" width="580" border="0" cellspacing="0" cellpadding="0" class="em_main_table" style="width:580px; table-layout:fixed; background-color: {contactfield=d_body_bgcolor};" data-section-wrapper="1">
              <tr>
                <td valign="top" align="center" data-section="1"><table width="580" border="0" cellspacing="0" cellpadding="0" align="center" style="width: 580px;" class="em_wrapper" data-slot-container="1">
                    <tbody>
                      <tr>
                        <td valign="top" align="center" style="padding: 0px 16px 16px 16px;" class="em_ptblr15"><div data-slot="text">
                            <table border="0" cellspacing="0" cellpadding="0" align="center" width="100%">
                              <tbody>
                                <tr>
                                  <td valign="top" align="center"><table border="0" cellspacing="0" cellpadding="0" align="left" width="267" style="width: 267px;" class="em_wrapper">
                                      <tbody>
                                        <tr>
                                          <td valign="top" align="center" class="em_full_img em_btn_butm"><a href="{{ item.VDP_URL }}" ses:tags="campaign:lead-accelerator-21d-new-inventory;content:explore-vehicle-cta;handraiser:yes;type:image" target="_blank" style="text-decoration: none;"><img src="{{ item.MainImage }}" width="267" alt="" style="display: block; border: 0px; max-width: 267px; color: #000000; font-size: 18px; line-height: 22px; font-family: Arial, sans-serif;" class="em_full_img" /></a></td>
                                        </tr>
                                      </tbody>
                                    </table>
                                    
                                    <!--[if gte mso 9]></td><td valign="top"><![endif]-->
                                    
                                    <table width="265" border="0" cellspacing="0" cellpadding="0" align="right" style="width: 265px;" class="em_wrapper">
                                      <tbody>
                                        <tr>
                                          <td height="35" style="height: 35px;" class="em_hide"></td>
                                        </tr>
                                        <tr>
                                          <td valign="top" align="center"><a ses:tags="campaign:lead-accelerator-21d-new-inventory;content:explore-vehicle-cta;handraiser:yes;type:button"  href="{{ item.VDP_URL }}?utm_source=3birds&utm_medium=email&utm_campaign={contactfield=c_customer_id}_leadaccelerator_21d_new_inventory" target="_blank" style="text-decoration: none;"> <span style="font-family: {contactfield=d_font_family}; color: {contactfield=d_body_color}; font-size: 16px; line-height: 17px;padding-bottom: 2px;"> {{ item.VehicleType }} {{ item.Year }} {{ item.Make }}</span><br>
                                            <span style="font-family: {contactfield=d_font_family}; color: {contactfield=d_body_color}; font-size: 25px; line-height: 17px;padding-bottom: 5px;"> {{ item.Model }}  {{ item.Trim1 }}</span></a></td>
                                        </tr>
                                        <tr>
                                          <td valign="top" align="center" style="font-family: {contactfield=d_font_family}; color: {contactfield=d_body_color}; font-size: 13px; line-height: 17px;padding-bottom: 19px;"> {{ item.Mileage }} miles<br />
                                            Stock #: {{ item.StockNumber }}<br /></td>
                                        </tr>
                                        <tr>
                                          <td valign="top" align="center"><table width="261" style="width: 261px;" border="0" cellspacing="4" cellpadding="0" align="center" class="em_wrapper">
                                              <tbody>
                                                <tr>
                                                  <td valign="middle" align="center" height="36" bgcolor="{contactfield=d_btn_bgcolor}" style="height: 36px; font-family: {contactfield=d_font_family}; color: {contactfield=d_btn_color}; font-size: 12px; font-weight: bold; border-radius: {contactfield=d_btn_radius}px;"><a ses:tags="campaign:lead-accelerator-21d-new-inventory;content:explore-vehicle-cta;handraiser:yes;type:button"  href="{{ item.VDP_URL }}?utm_source=3birds&utm_medium=email&utm_campaign={contactfield=c_customer_id}_leadaccelerator_21d_new_inventory" target="_blank" style="text-decoration: none; color: {contactfield=d_btn_color}; line-height: 36px; display: block;">GET TODAY'S PRICE</a></td>
                                                </tr>
                                              </tbody>
                                            </table></td>
                                        </tr>
                                      </tbody>
                                    </table></td>
                                </tr>
                              </tbody>
                            </table>
                          </div></td>
                      </tr>
                    </tbody>
                  </table></td>
              </tr>
            </table></td>
        </tr>
      </table></td>
  </tr>
</table>
{% endfor %}
{% END_TWIG_BLOCK %} 
<!-- END INVENTORY SNIPPET --> 

JSON:

[ { "Vin": "WA1GAAFYXN2020549", "StockNumber": "125232", "Make": "Audi", "Model": "Q5", "Trim1": "S line Premium", "BodyStyle": "SUV", "Year": 2022, "VehicleType": "New", "IsCertified": false, "Mileage": 10, "VDP_URL": "http://www.jackdanielsparamusaudi.com/catcher.esl?vehicleId=3bbafeb80a0e09a863ce5adb3236638f", "DateInStock": "2021-10-09", "MSRP": 0, "DateCreated": "2021-10-09", "InternetPrice": 0, "MainImage": "https://content.homenetiol.com/640x480/9d93fecf64c543749930a746798da91e.jpg", "StockImage": "https://content.homenetiol.com/stock_images/5/2022AUS02_640/2022AUS020001_640_01.jpg" }, { "Vin": "WA1GAAFY0N2019569", "StockNumber": "125233", "Make": "Audi", "Model": "Q5", "Trim1": "S line Premium", "BodyStyle": "SUV", "Year": 2022, "VehicleType": "New", "IsCertified": false, "Mileage": 10, "VDP_URL": "http://www.jackdanielsparamusaudi.com/catcher.esl?vehicleId=3bbafd0f0a0e09a97fb17999bd212a47", "DateInStock": "2021-10-09", "MSRP": 0, "DateCreated": "2021-10-09", "InternetPrice": 0, "MainImage": "https://content.homenetiol.com/640x480/1365fd683f3444bebf81e68861881a1c.jpg", "StockImage": "https://content.homenetiol.com/stock_images/5/2022AUS02_640/2022AUS020001_640_01.jpg" }, { "Vin": "WA1EAAFY7N2020161", "StockNumber": "125234", "Make": "Audi", "Model": "Q5", "Trim1": "S line Premium Plus", "BodyStyle": "SUV", "Year": 2022, "VehicleType": "New", "IsCertified": false, "Mileage": 10, "VDP_URL": "http://www.jackdanielsparamusaudi.com/catcher.esl?vehicleId=3bbafc8a0a0e09a97fb17999835188e2", "DateInStock": "2021-10-09", "MSRP": 0, "DateCreated": "2021-10-09", "InternetPrice": 0, "MainImage": "https://content.homenetiol.com/640x480/d5dabe9bf25f442792ad52540cb4ca20.jpg", "StockImage": "https://content.homenetiol.com/stock_images/5/2022AUS02_640/2022AUS020001_640_01.jpg" }, { "Vin": "WA1EAAFY2N2019550", "StockNumber": "125236", "Make": "Audi", "Model": "Q5", "Trim1": "S line Premium Plus", "BodyStyle": "SUV", "Year": 2022, "VehicleType": "New", "IsCertified": false, "Mileage": 10, "VDP_URL": "http://www.jackdanielsparamusaudi.com/catcher.esl?vehicleId=3bbafaee0a0e09a97fb17999f2f624fc", "DateInStock": "2021-10-09", "MSRP": 0, "DateCreated": "2021-10-09", "InternetPrice": 0, "MainImage": "https://content.homenetiol.com/640x480/0e12d14246a14377ae4a8f7858c03d05.jpg", "StockImage": "https://content.homenetiol.com/stock_images/5/2022AUS02_640/2022AUS020001_640_01.jpg" }, { "Vin": "WA1EAAFY5N2019560", "StockNumber": "125235", "Make": "Audi", "Model": "Q5", "Trim1": "S line Premium Plus", "BodyStyle": "SUV", "Year": 2022, "VehicleType": "New", "IsCertified": false, "Mileage": 11, "VDP_URL": "http://www.jackdanielsparamusaudi.com/catcher.esl?vehicleId=3bbafbcd0a0e09a97fb179992e604df1", "DateInStock": "2021-10-09", "MSRP": 0, "DateCreated": "2021-10-09", "InternetPrice": 0, "MainImage": "https://content.homenetiol.com/640x480/bd4820362b2f4c9184d22d6ebbb94af9.jpg", "StockImage": "https://content.homenetiol.com/stock_images/5/2022AUS02_640/2022AUS020001_640_01.jpg" }, { "Vin": "WA1EAAFY0N2019465", "StockNumber": "125238", "Make": "Audi", "Model": "Q5", "Trim1": "S line Premium Plus", "BodyStyle": "SUV", "Year": 2022, "VehicleType": "New", "IsCertified": false, "Mileage": 11, "VDP_URL": "http://www.jackdanielsparamusaudi.com/catcher.esl?vehicleId=3bbaf9030a0e097120e50d484db79fd4", "DateInStock": "2021-10-09", "MSRP": 0, "DateCreated": "2021-10-09", "InternetPrice": 0, "MainImage": "https://content.homenetiol.com/640x480/fe2abb1b45504cf0b81de4ae002fc323.jpg", "StockImage": "https://content.homenetiol.com/stock_images/5/2022AUS02_640/2022AUS020001_640_01.jpg" }, { "Vin": "WA1EAAFY1N2020110", "StockNumber": "125237", "Make": "Audi", "Model": "Q5", "Trim1": "S line Premium Plus", "BodyStyle": "SUV", "Year": 2022, "VehicleType": "New", "IsCertified": false, "Mileage": 11, "VDP_URL": "http://www.jackdanielsparamusaudi.com/catcher.esl?vehicleId=3bbaf9d40a0e09a97fb1799903d738dd", "DateInStock": "2021-10-09", "MSRP": 0, "DateCreated": "2021-10-09", "InternetPrice": 0, "MainImage": "https://content.homenetiol.com/640x480/038fb403ed0a4e9e840686330eea57c5.jpg", "StockImage": "https://content.homenetiol.com/stock_images/5/2022AUS02_640/2022AUS020001_640_01.jpg" }, { "Vin": "WA1BAAFY6M2071281", "StockNumber": "124551", "Make": "Audi", "Model": "Q5", "Trim1": "Premium Plus", "BodyStyle": "SUV", "Year": 2021, "VehicleType": "New", "IsCertified": false, "Mileage": 10, "VDP_URL": "http://www.jackdanielsparamusaudi.com/catcher.esl?vehicleId=2112a0f00a0e0a173e8f42ae818f0bb7", "DateInStock": "2021-04-02", "MSRP": 0, "DateCreated": "2021-09-30", "InternetPrice": 0, "MainImage": "https://content.homenetiol.com/640x480/9e052de1c6d34daaab9447fbe6cfef16.jpg", "StockImage": "https://content.homenetiol.com/stock_images/5/2021AUS02_640/2021AUS020001_640_01.jpg" }, { "Vin": "WA1BAAFY5M2136783", "StockNumber": "125085", "Make": "Audi", "Model": "Q5", "Trim1": "Premium Plus", "BodyStyle": "SUV", "Year": 2021, "VehicleType": "New", "IsCertified": false, "Mileage": 10, "VDP_URL": "http://www.jackdanielsparamusaudi.com/catcher.esl?vehicleId=f73d23280a0e09b1110b8372a5c9f31b", "DateInStock": "2021-08-13", "MSRP": 0, "DateCreated": "2021-09-30", "InternetPrice": 0, "MainImage": "https://content.homenetiol.com/640x480/406c5f03fc5b4c0ba41f35a92e27a3fb.jpg", "StockImage": "https://content.homenetiol.com/stock_images/5/2021AUS02_640/2021AUS020001_640_01.jpg" }, { "Vin": "WA1BAAFY5M2031466", "StockNumber": "S124170", "Make": "Audi", "Model": "Q5", "Trim1": "Premium Plus", "BodyStyle": "SUV", "Year": 2021, "VehicleType": "New", "IsCertified": false, "Mileage": 45, "VDP_URL": "http://www.jackdanielsparamusaudi.com/catcher.esl?vehicleId=783855c20a0e0adf6a6e7a177787ba53", "DateInStock": "2020-12-18", "MSRP": 0, "DateCreated": "2021-09-30", "InternetPrice": 0, "MainImage": "https://content.homenetiol.com/640x480/186be7fe66c741e9ba9d9026127c0c83.jpg", "StockImage": "https://content.homenetiol.com/stock_images/5/2021AUS02_640/2021AUS020001_640_01.jpg" } ]

NOTE: IF I SEND THE SAME TEMPLATE TO THE SAME CONTACT USING THE "CONTACT > SEND EMAIL" FEATURE, IT WORKS JUST FINE. HOWEVER, WHEN I'M RUNNING BATCH CAMPAIGNS IT DOES NOT WORK. IT APPEARS THERE IS A STATE ISSUE WHERE THE SCOPE OF THE OBJECT IS NOT BEING RESET PER RECIPIENT.

Cannot declare class MauticPlugin\MauticAdvancedTemplatesBundle\MauticAdvancedTemplatesBundle, because the name is already in use

Tried to install the plugin on a fairly fresh Mautic instance:

cd www/mautic/docroot/plugins/
wget https://github.com/Logicify/mautic-advanced-templates-bundle/archive/refs/tags/1.2.zip
unzip 1.2.zip
mv mautic-advanced-templates-bundle-1.2/ LogicifyMauticAdvancedTemplatesBundle
php /var/www/mautic/bin/console cache:clear


 // Clearing the cache for the prod environment with debug false                                                        

[22-Aug-2023 13:50:29 Europe/Berlin] PHP Fatal error:  Cannot declare class MauticPlugin\MauticAdvancedTemplatesBundle\MauticAdvancedTemplatesBundle, because the name is already in use in /var/www/mautic/docroot/plugins/LogicifyMauticAdvancedTemplatesBundle/MauticAdvancedTemplatesBundle.php on line 0

In MauticAdvancedTemplatesBundle.php line n/a:
                                                                                                                                                   
  Compile Error: Cannot declare class MauticPlugin\MauticAdvancedTemplatesBundle\MauticAdvancedTemplatesBundle, because the name is already in use

cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

I installed only one additional plugin before: Jotaworks Mautic DOI-Plugin

ls -al
total 56
drwxrwxr-x. 17 startygn startygn  4096 Aug 22 13:49 .
drwxrwxr-x.  8 startygn startygn   240 Aug 18 15:47 ..
-rw-rw-r--.  1 startygn startygn 26110 Aug 22 13:49 1.2.zip
drwxrwxr-x. 15 startygn startygn  4096 Jan 17  2023 GrapesJsBuilderBundle
drwxrwxr-x. 14 startygn startygn  4096 Jul 18 11:51 JotaworksDoiBundle
drwxrwxr-x.  7 startygn startygn   193 Mar 14 19:00 LogicifyMauticAdvancedTemplatesBundle
drwxrwxr-x. 18 startygn startygn  4096 May 24 20:40 MauticCitrixBundle
drwxrwxr-x. 13 startygn startygn   252 May 13  2022 MauticClearbitBundle
drwxrwxr-x. 10 startygn startygn   212 May 13  2022 MauticCloudStorageBundle
drwxrwxr-x. 16 startygn startygn  4096 May 19 11:37 MauticCrmBundle
drwxrwxr-x. 10 startygn startygn   200 May 13  2022 MauticEmailMarketingBundle
drwxrwxr-x. 17 startygn startygn  4096 Nov 14  2022 MauticFocusBundle
drwxrwxr-x. 14 startygn startygn   272 May 13  2022 MauticFullContactBundle
drwxrwxr-x.  7 startygn startygn   155 May 13  2022 MauticGmailBundle
drwxrwxr-x.  8 startygn startygn   170 May 13  2022 MauticOutlookBundle
drwxrwxr-x. 18 startygn startygn  4096 May 13  2022 MauticSocialBundle
drwxrwxr-x. 14 startygn startygn   259 May 13  2022 MauticTagManagerBundle
drwxrwxr-x.  5 startygn startygn   117 May 13  2022 MauticZapierBundle

What is wrong here? Is this a bug or user error?

  • Mautic 4.4.9 - app/prod (env: prod, debug: false)
  • PHP Version 8.0.30
  • Red Hat Enterprise Linux Server release 7.9 (Maipo)
  • x86_64
  • FPM/FastCGI

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.