How to use nested array in email templateHow to show array in email template file?Nested if Statements in Email TemplatesNested email template variables - var order.increment_id not workingHow to use email template 'password_new' after setting the passwordHow to Use Custom Variable in Email Template?How to create a custom Filter directive (e.g. for emails)?Use custom email template in another email templateHow to use multidimensional array values in magento email templateHow to display an array in a email template (for-loop)?Pass array of data from email template to phtml in Magento 2.2.5How to use Google fonts in email template
Filter any system log file by date or date range
Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)
How old can references or sources in a thesis be?
What would happen to a modern skyscraper if it rains micro blackholes?
Is it unprofessional to ask if a job posting on GlassDoor is real?
Why doesn't Newton's third law mean a person bounces back to where they started when they hit the ground?
DC-DC converter from low voltage at high current, to high voltage at low current
Are astronomers waiting to see something in an image from a gravitational lens that they've already seen in an adjacent image?
How to source a part of a file
Was any UN Security Council vote triple-vetoed?
Has there ever been an airliner design involving reducing generator load by installing solar panels?
What does it mean to describe someone as a butt steak?
How can I prevent hyper evolved versions of regular creatures from wiping out their cousins?
Modeling an IP Address
Is it legal for company to use my work email to pretend I still work there?
Could an aircraft fly or hover using only jets of compressed air?
How much of data wrangling is a data scientist's job?
Can a monk's single staff be considered dual wielded, as per the Dual Wielder feat?
Which country benefited the most from UN Security Council vetoes?
Why is Minecraft giving an OpenGL error?
Convert two switches to a dual stack, and add outlet - possible here?
How do I deal with an unproductive colleague in a small company?
Cross compiling for RPi - error while loading shared libraries
I'm flying to France today and my passport expires in less than 2 months
How to use nested array in email template
How to show array in email template file?Nested if Statements in Email TemplatesNested email template variables - var order.increment_id not workingHow to use email template 'password_new' after setting the passwordHow to Use Custom Variable in Email Template?How to create a custom Filter directive (e.g. for emails)?Use custom email template in another email templateHow to use multidimensional array values in magento email templateHow to display an array in a email template (for-loop)?Pass array of data from email template to phtml in Magento 2.2.5How to use Google fonts in email template
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a nested array that I am passing as templateVar.
setTemplateVars(['details' => $arr])
The array($arr) is
[0] => [
["key1"]=>value1
["key2]=>value2
]
[1]=>[
["key1"]=>value1
["key2]=>value2
]
.
.
.
All arrays have same keys.
I have tried both updates mentioned in How to show array in email template file?
In the template file, I'm trying to use it as -
<?php foreach($details as $detail) : ?>
<p>trans ' %val' val=$detail.key1</p>
<?php endforeach; ?>
I cannot pass it as a string as the array can be an array of 100s of arrays with same keys.
email-templates
add a comment |
I have a nested array that I am passing as templateVar.
setTemplateVars(['details' => $arr])
The array($arr) is
[0] => [
["key1"]=>value1
["key2]=>value2
]
[1]=>[
["key1"]=>value1
["key2]=>value2
]
.
.
.
All arrays have same keys.
I have tried both updates mentioned in How to show array in email template file?
In the template file, I'm trying to use it as -
<?php foreach($details as $detail) : ?>
<p>trans ' %val' val=$detail.key1</p>
<?php endforeach; ?>
I cannot pass it as a string as the array can be an array of 100s of arrays with same keys.
email-templates
you can use foreach loop
– magefms
Apr 2 at 21:45
add a comment |
I have a nested array that I am passing as templateVar.
setTemplateVars(['details' => $arr])
The array($arr) is
[0] => [
["key1"]=>value1
["key2]=>value2
]
[1]=>[
["key1"]=>value1
["key2]=>value2
]
.
.
.
All arrays have same keys.
I have tried both updates mentioned in How to show array in email template file?
In the template file, I'm trying to use it as -
<?php foreach($details as $detail) : ?>
<p>trans ' %val' val=$detail.key1</p>
<?php endforeach; ?>
I cannot pass it as a string as the array can be an array of 100s of arrays with same keys.
email-templates
I have a nested array that I am passing as templateVar.
setTemplateVars(['details' => $arr])
The array($arr) is
[0] => [
["key1"]=>value1
["key2]=>value2
]
[1]=>[
["key1"]=>value1
["key2]=>value2
]
.
.
.
All arrays have same keys.
I have tried both updates mentioned in How to show array in email template file?
In the template file, I'm trying to use it as -
<?php foreach($details as $detail) : ?>
<p>trans ' %val' val=$detail.key1</p>
<?php endforeach; ?>
I cannot pass it as a string as the array can be an array of 100s of arrays with same keys.
email-templates
email-templates
edited 2 days ago
coderGeek
asked Apr 2 at 20:54
coderGeekcoderGeek
214
214
you can use foreach loop
– magefms
Apr 2 at 21:45
add a comment |
you can use foreach loop
– magefms
Apr 2 at 21:45
you can use foreach loop
– magefms
Apr 2 at 21:45
you can use foreach loop
– magefms
Apr 2 at 21:45
add a comment |
1 Answer
1
active
oldest
votes
Providing you an static way to get the specific value of array key. You can pass it like this:
setTemplateVars(['details' => $arr[0]->key1]) //get key1 value from array 0
setTemplateVars(['details' => $arr[1]->key1]) //get key1 value from array 1
Using foreach loop
foreach($arr as $detail)
setTemplateVars(['details'=> $detail["key1"]);
<?php foreach($details as $detail) : ?>
<p>trans ' %val' val = $detail["key1"]</p>
<?php endforeach; ?>
Can you elaborate how to use foreach? I've tried - foreach($details as detail): <p>$detail.key1</p> - This doesn't work
– coderGeek
2 days ago
check updated ans
– magefms
2 days ago
How to use this is the template file?
– coderGeek
2 days ago
can you update your question with your code in the template file
– magefms
2 days ago
can you try this<?php foreach($details as $detail) : ?> <p>trans ' %val' val = $detail["key1"]</p> <?php endforeach; ?>
– magefms
2 days ago
|
show 1 more comment
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268427%2fhow-to-use-nested-array-in-email-template%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Providing you an static way to get the specific value of array key. You can pass it like this:
setTemplateVars(['details' => $arr[0]->key1]) //get key1 value from array 0
setTemplateVars(['details' => $arr[1]->key1]) //get key1 value from array 1
Using foreach loop
foreach($arr as $detail)
setTemplateVars(['details'=> $detail["key1"]);
<?php foreach($details as $detail) : ?>
<p>trans ' %val' val = $detail["key1"]</p>
<?php endforeach; ?>
Can you elaborate how to use foreach? I've tried - foreach($details as detail): <p>$detail.key1</p> - This doesn't work
– coderGeek
2 days ago
check updated ans
– magefms
2 days ago
How to use this is the template file?
– coderGeek
2 days ago
can you update your question with your code in the template file
– magefms
2 days ago
can you try this<?php foreach($details as $detail) : ?> <p>trans ' %val' val = $detail["key1"]</p> <?php endforeach; ?>
– magefms
2 days ago
|
show 1 more comment
Providing you an static way to get the specific value of array key. You can pass it like this:
setTemplateVars(['details' => $arr[0]->key1]) //get key1 value from array 0
setTemplateVars(['details' => $arr[1]->key1]) //get key1 value from array 1
Using foreach loop
foreach($arr as $detail)
setTemplateVars(['details'=> $detail["key1"]);
<?php foreach($details as $detail) : ?>
<p>trans ' %val' val = $detail["key1"]</p>
<?php endforeach; ?>
Can you elaborate how to use foreach? I've tried - foreach($details as detail): <p>$detail.key1</p> - This doesn't work
– coderGeek
2 days ago
check updated ans
– magefms
2 days ago
How to use this is the template file?
– coderGeek
2 days ago
can you update your question with your code in the template file
– magefms
2 days ago
can you try this<?php foreach($details as $detail) : ?> <p>trans ' %val' val = $detail["key1"]</p> <?php endforeach; ?>
– magefms
2 days ago
|
show 1 more comment
Providing you an static way to get the specific value of array key. You can pass it like this:
setTemplateVars(['details' => $arr[0]->key1]) //get key1 value from array 0
setTemplateVars(['details' => $arr[1]->key1]) //get key1 value from array 1
Using foreach loop
foreach($arr as $detail)
setTemplateVars(['details'=> $detail["key1"]);
<?php foreach($details as $detail) : ?>
<p>trans ' %val' val = $detail["key1"]</p>
<?php endforeach; ?>
Providing you an static way to get the specific value of array key. You can pass it like this:
setTemplateVars(['details' => $arr[0]->key1]) //get key1 value from array 0
setTemplateVars(['details' => $arr[1]->key1]) //get key1 value from array 1
Using foreach loop
foreach($arr as $detail)
setTemplateVars(['details'=> $detail["key1"]);
<?php foreach($details as $detail) : ?>
<p>trans ' %val' val = $detail["key1"]</p>
<?php endforeach; ?>
edited 2 days ago
answered 2 days ago
magefmsmagefms
2,3872426
2,3872426
Can you elaborate how to use foreach? I've tried - foreach($details as detail): <p>$detail.key1</p> - This doesn't work
– coderGeek
2 days ago
check updated ans
– magefms
2 days ago
How to use this is the template file?
– coderGeek
2 days ago
can you update your question with your code in the template file
– magefms
2 days ago
can you try this<?php foreach($details as $detail) : ?> <p>trans ' %val' val = $detail["key1"]</p> <?php endforeach; ?>
– magefms
2 days ago
|
show 1 more comment
Can you elaborate how to use foreach? I've tried - foreach($details as detail): <p>$detail.key1</p> - This doesn't work
– coderGeek
2 days ago
check updated ans
– magefms
2 days ago
How to use this is the template file?
– coderGeek
2 days ago
can you update your question with your code in the template file
– magefms
2 days ago
can you try this<?php foreach($details as $detail) : ?> <p>trans ' %val' val = $detail["key1"]</p> <?php endforeach; ?>
– magefms
2 days ago
Can you elaborate how to use foreach? I've tried - foreach($details as detail): <p>$detail.key1</p> - This doesn't work
– coderGeek
2 days ago
Can you elaborate how to use foreach? I've tried - foreach($details as detail): <p>$detail.key1</p> - This doesn't work
– coderGeek
2 days ago
check updated ans
– magefms
2 days ago
check updated ans
– magefms
2 days ago
How to use this is the template file?
– coderGeek
2 days ago
How to use this is the template file?
– coderGeek
2 days ago
can you update your question with your code in the template file
– magefms
2 days ago
can you update your question with your code in the template file
– magefms
2 days ago
can you try this
<?php foreach($details as $detail) : ?> <p>trans ' %val' val = $detail["key1"]</p> <?php endforeach; ?>– magefms
2 days ago
can you try this
<?php foreach($details as $detail) : ?> <p>trans ' %val' val = $detail["key1"]</p> <?php endforeach; ?>– magefms
2 days ago
|
show 1 more comment
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268427%2fhow-to-use-nested-array-in-email-template%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
you can use foreach loop
– magefms
Apr 2 at 21:45