So far I have created file MyModule/ProductAlert/view/frontend/email/stock.html -
<!--@subject {{trans "Products back in stock alert"}} @-->
<!--@vars {
"var alertGrid|raw":"Alert Data Grid",
"var email":"Customer Email",
"template config_path=\"design\/email\/footer_template\"":"Email Footer Template",
"template config_path=\"design\/email\/header_template\"":"Email Header Template"
} @-->
{{template config_path="design/email/header_template"}}
{{var alertGrid|raw}}
{{template config_path="design/email/footer_template"}}
And I would like to pass my variable email to .phtml file in
MyModule/ProductAlert/view/frontend/templates/email/stock.phtml and call it there -
<?php
use MyModule\ProductAlert\Block\Email\Stock;
/** @var $block Stock */
?>
<?php if ($_products = $block->getProducts()): ?>
<?php foreach ($_products as $_product): ?>
<p><?= __('Hello!') ?></p>
<p>Your email: <?php $block->getData('email') ?></p> // Email should be here
<?php endforeach; ?>
<?php endif; ?>
Currently it returns me nothing. How can I achieve that? Thank you!
stock.phtmlfile display dynamic email data? – Chirag Patel May 20 '19 at 04:38