Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v5] Example 7 in the Readme is throwing error PHP Warning - Array to string conversion #43

Open
geminigeek opened this issue Oct 1, 2024 · 1 comment

Comments

@geminigeek
Copy link

geminigeek commented Oct 1, 2024

hi,

mautic version : v5.0.4
i am using example 7 from readme as it is , i am getting this error, it seems the example is missing a line to set cart ?

https://github.com/Logicify/mautic-advanced-templates-bundle?tab=readme-ov-file#example-7-rendering-structured-data-from-tokens

[2024-10-01T19:46:44.399235+00:00] mautic.WARNING: PHP Warning - Array to string conversion - in file /var/www/html/docroot/app/bundles/EmailBundle/Helper/MailHelper.php - at line 679 [] {"hostname":"7a0715642990","pid":3822}

the result of using the code is

Item Name: (SKU: )

post body used to send tokens

{
  "tokens":{
    "{cart}": [{"sku":"A100","name":"Item 1"},{"sku":"Z200","name":"Item 2"}]
    }
  }
@geminigeek geminigeek changed the title Example 7 in the Readme is throwing error PHP Warning - Array to string conversion [v5] Example 7 in the Readme is throwing error PHP Warning - Array to string conversion Oct 1, 2024
@ricardopxlcl
Copy link

Hello to everyone. To which endpoint you send the post? from example 7

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"}]
    }
}

I was trying to https://endpoint.com/mtc/event

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants