how do I get bundle product options labels with value in my custom email templates? My custom email template code is here..
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// phpcs:disable Magento2.Templates.ThisInTemplate
/** @var $block \Magento\Sales\Block\Order\Email\Items */
?>
<?php $_order = $block->getOrder() ?>
<?php $_imageHelper = $this->helper(\Magento\Catalog\Helper\Image::class); ?>
<?php if ($_order) : ?>
<?php $_items = $_order->getAllVisibleItems(); ?>
<table class="email-items">
<thead>
<tr>
<th>
</th>
<th class="item-info">
<?= $block->escapeHtml(__('Product')) ?>
</th>
<th class="item-info">
<?= $block->escapeHtml(__('SKU')) ?>
</th>
<th class="item-info">
<?= $block->escapeHtml(__('Qty')) ?>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($_items as $_item) : ?>
<tr>
<td>
<?php if($_item->getProduct()): ?>
<img src="<?= $_imageHelper->init($_item->getProduct(), 'small_image', ['type'=>'small_image'])->keepAspectRatio(true)->resize('120','120')->getUrl();?>" alt="<?= __('Product Image');?>">
<?php endif; ?>
</td>
<td>
<p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p>
</td>
<td>
<p class="product-sku"><?= $block->escapeHtml($_item->getSku()) ?></p>
</td>
<td class="item-qty">
<?= (float) $_item->getQtyOrdered() ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
Layout code is here..
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Email Order Items List" design_abstraction="custom">
<update handle="sales_email_order_renderers"/>
<update handle="sales_email_item_price"/>
<body>
<block class="Magento\Sales\Block\Order\Email\Items" name="items" template="Vendor_Extension::order/email/items.phtml" cacheable="false">
<block class="Magento\Framework\View\Element\RendererList" name="sales.email.order.renderers" as="renderer.list"/>
<block class="Magento\Sales\Block\Order\Totals" name="order_totals" template="Magento_Sales::order/totals.phtml">
<arguments>
<argument name="label_properties" xsi:type="string">colspan="2"</argument>
</arguments>
<block class="Magento\Tax\Block\Sales\Order\Tax" name="tax" template="Magento_Tax::order/tax.phtml">
<action method="setIsPlaneMode">
<argument name="value" xsi:type="string">1</argument>
</action>
</block>
</block>
</block>
<block class="Magento\Framework\View\Element\Template" name="additional.product.info" template="Magento_Theme::template.phtml"/>
</body>
</page>