0

Error filtering template: Warning: Invalid argument supplied for foreach() in /var/www/html/magento2/app/code/Vendorname/Modulename/view/frontend/templates/email_items.phtml on line 10

<?php $items = $block->getItemDetails() ?>
 <table>
  <thead>
<tr>
    <td><strong>Name</strong></td>
    <td><strong>Condition</strong></td>
</tr>
</thead>
<tbody>
<?php foreach ($items as $key => $itemName): ?>
    <tr>
        <td><?php echo $key; ?></td>
        <td><?= $itemName ?></td>
    </tr>
<?php endforeach; ?>
</tbody>

1 Answer 1

1

It appears that your variable $items isn't an array. What does the method getItemDetails return? What kind of class is $block?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.