66// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
77/** @var $block \Magento\Bundle\Block\Sales\Order\Items\Renderer */
88$ parentItem = $ block ->getItem ();
9- $ items = array_merge ([$ parentItem ], $ parentItem ->getChildrenItems ());
9+ $ items = $ block ->getOrderItems ((int )$ parentItem ->getOrderId (), (int )$ parentItem ->getId ());
10+
1011$ index = 0 ;
1112$ prevOptionId = '' ;
1213?>
1314
14- <?php foreach ($ items as $ item ) : ?>
15+ <?php foreach ($ items as $ item ): ?>
1516
1617 <?php if ($ block ->getItemOptions ()
1718 || $ parentItem ->getDescription ()
1819 || $ this ->helper (Magento \GiftMessage \Helper \Message::class)->isMessagesAllowed ('order_item ' , $ parentItem )
19- && $ parentItem ->getGiftMessageId ()) : ?>
20+ && $ parentItem ->getGiftMessageId ()): ?>
2021 <?php $ showLastRow = true ; ?>
21- <?php else : ?>
22+ <?php else : ?>
2223 <?php $ showLastRow = false ; ?>
2324 <?php endif ; ?>
2425
25- <?php if ($ item ->getParentItem ()) : ?>
26+ <?php if ($ item ->getParentItem ()): ?>
2627 <?php $ attributes = $ block ->getSelectionAttributes ($ item ) ?>
27- <?php if ($ prevOptionId != $ attributes ['option_id ' ]) : ?>
28+
29+ <?php if (isset ($ attributes ['option_id ' ]) && $ prevOptionId != $ attributes ['option_id ' ]): ?>
2830 <tr class="options-label">
2931 <td class="col label" colspan="5"><?= $ block ->escapeHtml ($ attributes ['option_label ' ]); ?> </td>
3032 </tr>
3133 <?php $ prevOptionId = $ attributes ['option_id ' ] ?>
3234 <?php endif ; ?>
3335 <?php endif ; ?>
3436<tr id="order-item-row-<?= /* @noEscape */ $ item ->getId () ?> "
35- class="<?php if ($ item ->getParentItem ()) : ?>
37+ class="<?php if ($ item ->getParentItem ()): ?>
3638 item-options-container
37- <?php else : ?>
39+ <?php else : ?>
3840 item-parent
3941 <?php endif ; ?> "
40- <?php if ($ item ->getParentItem ()) : ?>
41- data-th="<?= $ block ->escapeHtmlAttr ($ attributes ['option_label ' ]); ?> "
42+ <?php if ($ item ->getParentItem ()): ?>
43+ data-th="<?= $ block ->escapeHtmlAttr ($ attributes ['option_label ' ] ?? '' ); ?> "
4244 <?php endif ; ?> >
43- <?php if (!$ item ->getParentItem ()) : ?>
45+ <?php if (!$ item ->getParentItem ()): ?>
4446 <td class="col name" data-th="<?= $ block ->escapeHtmlAttr (__ ('Product Name ' )); ?> ">
4547 <strong class="product name product-item-name"><?= $ block ->escapeHtml ($ item ->getName ()); ?> </strong>
4648 </td>
47- <?php else : ?>
49+ <?php else : ?>
4850 <td class="col value" data-th="<?= $ block ->escapeHtmlAttr (__ ('Product Name ' )); ?> ">
4951 <?= $ block ->getValueHtml ($ item ); ?>
5052 </td>
@@ -53,82 +55,82 @@ $prevOptionId = '';
5355 <?= /* @noEscape */ $ block ->prepareSku ($ item ->getSku ()); ?>
5456 </td>
5557 <td class="col price" data-th="<?= $ block ->escapeHtmlAttr (__ ('Price ' )); ?> ">
56- <?php if (!$ item ->getParentItem ()) : ?>
58+ <?php if (!$ item ->getParentItem ()): ?>
5759 <?= /* @noEscape */ $ block ->getItemPriceHtml (); ?>
58- <?php else : ?>
60+ <?php else : ?>
5961
6062 <?php endif ; ?>
6163 </td>
6264 <td class="col qty" data-th="<?= $ block ->escapeHtmlAttr (__ ('Quantity ' )); ?> ">
6365 <?php if (($ item ->getParentItem () && $ block ->isChildCalculated ()) ||
6466 (!$ item ->getParentItem () && !$ block ->isChildCalculated ()) ||
65- ($ item ->getQtyShipped () > 0 && $ item ->getParentItem () && $ block ->isShipmentSeparately ())) : ?>
67+ ($ item ->getQtyShipped () > 0 && $ item ->getParentItem () && $ block ->isShipmentSeparately ())): ?>
6668 <ul class="items-qty">
6769 <?php endif ; ?>
6870 <?php if (($ item ->getParentItem () && $ block ->isChildCalculated ()) ||
69- (!$ item ->getParentItem () && !$ block ->isChildCalculated ())) : ?>
70- <?php if ($ item ->getQtyOrdered () > 0 ) : ?>
71+ (!$ item ->getParentItem () && !$ block ->isChildCalculated ())): ?>
72+ <?php if ($ item ->getQtyOrdered () > 0 ): ?>
7173 <li class="item">
7274 <span class="title"><?= $ block ->escapeHtml (__ ('Ordered ' )); ?> </span>
7375 <span class="content"><?= /* @noEscape */ $ item ->getQtyOrdered () * 1 ; ?> </span>
7476 </li>
7577 <?php endif ; ?>
76- <?php if ($ item ->getQtyShipped () > 0 && !$ block ->isShipmentSeparately ()) : ?>
78+ <?php if ($ item ->getQtyShipped () > 0 && !$ block ->isShipmentSeparately ()): ?>
7779 <li class="item">
7880 <span class="title"><?= $ block ->escapeHtml (__ ('Shipped ' )); ?> </span>
7981 <span class="content"><?= /* @noEscape */ $ item ->getQtyShipped () * 1 ; ?> </span>
8082 </li>
8183 <?php endif ; ?>
82- <?php if ($ item ->getQtyCanceled () > 0 ) : ?>
84+ <?php if ($ item ->getQtyCanceled () > 0 ): ?>
8385 <li class="item">
8486 <span class="title"><?= $ block ->escapeHtml (__ ('Canceled ' )); ?> </span>
8587 <span class="content"><?= /* @noEscape */ $ item ->getQtyCanceled () * 1 ; ?> </span>
8688 </li>
8789 <?php endif ; ?>
88- <?php if ($ item ->getQtyRefunded () > 0 ) : ?>
90+ <?php if ($ item ->getQtyRefunded () > 0 ): ?>
8991 <li class="item">
9092 <span class="title"><?= $ block ->escapeHtml (__ ('Refunded ' )); ?> </span>
9193 <span class="content"><?= /* @noEscape */ $ item ->getQtyRefunded () * 1 ; ?> </span>
9294 </li>
9395 <?php endif ; ?>
94- <?php elseif ($ item ->getQtyShipped () > 0 && $ item ->getParentItem () && $ block ->isShipmentSeparately ()) : ?>
96+ <?php elseif ($ item ->getQtyShipped () > 0 && $ item ->getParentItem () && $ block ->isShipmentSeparately ()): ?>
9597 <li class="item">
9698 <span class="title"><?= $ block ->escapeHtml (__ ('Shipped ' )); ?> </span>
9799 <span class="content"><?= /* @noEscape */ $ item ->getQtyShipped () * 1 ; ?> </span>
98100 </li>
99- <?php else : ?>
101+ <?php else : ?>
100102 <span class="content"><?= /* @noEscape */ $ parentItem ->getQtyOrdered () * 1 ; ?> </span>
101103 <?php endif ; ?>
102104 <?php if (($ item ->getParentItem () && $ block ->isChildCalculated ()) ||
103105 (!$ item ->getParentItem () && !$ block ->isChildCalculated ()) ||
104- ($ item ->getQtyShipped () > 0 && $ item ->getParentItem () && $ block ->isShipmentSeparately ())) :?>
106+ ($ item ->getQtyShipped () > 0 && $ item ->getParentItem () && $ block ->isShipmentSeparately ())):?>
105107 </ul>
106108 <?php endif ; ?>
107109 </td>
108110 <td class="col subtotal" data-th="<?= $ block ->escapeHtmlAttr (__ ('Subtotal ' )) ?> ">
109- <?php if (!$ item ->getParentItem ()) : ?>
111+ <?php if (!$ item ->getParentItem ()): ?>
110112 <?= /* @noEscape */ $ block ->getItemRowTotalHtml (); ?>
111- <?php else : ?>
113+ <?php else : ?>
112114
113115 <?php endif ; ?>
114116 </td>
115117</tr>
116118<?php endforeach ; ?>
117119
118- <?php if ($ showLastRow && (($ options = $ block ->getItemOptions ()) || $ block ->escapeHtml ($ item ->getDescription ()))) : ?>
120+ <?php if ($ showLastRow && (($ options = $ block ->getItemOptions ()) || $ block ->escapeHtml ($ item ->getDescription ()))): ?>
119121<tr>
120122 <td class="col options" colspan="5">
121- <?php if ($ options = $ block ->getItemOptions ()) : ?>
123+ <?php if ($ options = $ block ->getItemOptions ()): ?>
122124 <dl class="item-options">
123- <?php foreach ($ options as $ option ) : ?>
125+ <?php foreach ($ options as $ option ): ?>
124126 <dt><?= $ block ->escapeHtml ($ option ['label ' ]) ?> </dt>
125- <?php if (!$ block ->getPrintStatus ()) : ?>
127+ <?php if (!$ block ->getPrintStatus ()): ?>
126128 <?php $ formattedOptionValue = $ block ->getFormatedOptionValue ($ option ) ?>
127- <dd<?php if (isset ($ formattedOptionValue ['full_view ' ])) : ?>
129+ <dd<?php if (isset ($ formattedOptionValue ['full_view ' ])): ?>
128130 class="tooltip wrapper"
129131 <?php endif ; ?> >
130132 <?= /* @noEscape */ $ formattedOptionValue ['value ' ] ?>
131- <?php if (isset ($ formattedOptionValue ['full_view ' ])) : ?>
133+ <?php if (isset ($ formattedOptionValue ['full_view ' ])): ?>
132134 <div class="tooltip content">
133135 <dl class="item options">
134136 <dt><?= $ block ->escapeHtml ($ option ['label ' ]); ?> </dt>
@@ -137,7 +139,7 @@ $prevOptionId = '';
137139 </div>
138140 <?php endif ; ?>
139141 </dd>
140- <?php else : ?>
142+ <?php else : ?>
141143 <dd><?= $ block ->escapeHtml ((isset ($ option ['print_value ' ]) ?
142144 $ option ['print_value ' ] :
143145 $ option ['value ' ])); ?>
0 commit comments