33 * Copyright © Magento, Inc. All rights reserved.
44 * See COPYING.txt for license details.
55 */
6- // phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
6+ // phpcs:disable Magento2.Templates.ThisInTemplate
77/** @var $block \Magento\Bundle\Block\Sales\Order\Items\Renderer */
8+ /** @var $viewModel \Magento\Bundle\ViewModel\Sales\Order\Items\Renderer */
89$ parentItem = $ block ->getItem ();
9- $ items = array_merge ([$ parentItem ], $ parentItem ->getChildrenItems ());
10+ $ viewModel = $ block ->getViewModel ();
11+ $ items = $ viewModel ->getOrderItems ((int )$ parentItem ->getOrderId (), (int )$ parentItem ->getId ());
1012$ index = 0 ;
1113$ prevOptionId = '' ;
1214?>
1315
14- <?php foreach ($ items as $ item ) : ?>
16+ <?php foreach ($ items as $ item ): ?>
1517
1618 <?php if ($ block ->getItemOptions ()
1719 || $ parentItem ->getDescription ()
1820 || $ this ->helper (Magento \GiftMessage \Helper \Message::class)->isMessagesAllowed ('order_item ' , $ parentItem )
19- && $ parentItem ->getGiftMessageId ()) : ?>
21+ && $ parentItem ->getGiftMessageId ()): ?>
2022 <?php $ showLastRow = true ; ?>
21- <?php else : ?>
23+ <?php else : ?>
2224 <?php $ showLastRow = false ; ?>
2325 <?php endif ; ?>
2426
25- <?php if ($ item ->getParentItem ()) : ?>
27+ <?php if ($ item ->getParentItem ()): ?>
2628 <?php $ attributes = $ block ->getSelectionAttributes ($ item ) ?>
27- <?php if ($ prevOptionId != $ attributes ['option_id ' ]) : ?>
29+
30+ <?php if (isset ($ attributes ['option_id ' ]) && $ prevOptionId != $ attributes ['option_id ' ]): ?>
2831 <tr class="options-label">
2932 <td class="col label" colspan="5"><?= $ block ->escapeHtml ($ attributes ['option_label ' ]); ?> </td>
3033 </tr>
3134 <?php $ prevOptionId = $ attributes ['option_id ' ] ?>
3235 <?php endif ; ?>
3336 <?php endif ; ?>
3437<tr id="order-item-row-<?= /* @noEscape */ $ item ->getId () ?> "
35- class="<?php if ($ item ->getParentItem ()) : ?>
38+ class="<?php if ($ item ->getParentItem ()): ?>
3639 item-options-container
37- <?php else : ?>
40+ <?php else : ?>
3841 item-parent
3942 <?php endif ; ?> "
40- <?php if ($ item ->getParentItem ()) : ?>
41- data-th="<?= $ block ->escapeHtmlAttr ($ attributes ['option_label ' ]); ?> "
43+ <?php if ($ item ->getParentItem ()): ?>
44+ data-th="<?= $ block ->escapeHtmlAttr ($ attributes ['option_label ' ] ?? '' ); ?> "
4245 <?php endif ; ?> >
43- <?php if (!$ item ->getParentItem ()) : ?>
46+ <?php if (!$ item ->getParentItem ()): ?>
4447 <td class="col name" data-th="<?= $ block ->escapeHtmlAttr (__ ('Product Name ' )); ?> ">
4548 <strong class="product name product-item-name"><?= $ block ->escapeHtml ($ item ->getName ()); ?> </strong>
4649 </td>
47- <?php else : ?>
50+ <?php else : ?>
4851 <td class="col value" data-th="<?= $ block ->escapeHtmlAttr (__ ('Product Name ' )); ?> ">
4952 <?= $ block ->getValueHtml ($ item ); ?>
5053 </td>
@@ -53,82 +56,82 @@ $prevOptionId = '';
5356 <?= /* @noEscape */ $ block ->prepareSku ($ item ->getSku ()); ?>
5457 </td>
5558 <td class="col price" data-th="<?= $ block ->escapeHtmlAttr (__ ('Price ' )); ?> ">
56- <?php if (!$ item ->getParentItem ()) : ?>
59+ <?php if (!$ item ->getParentItem ()): ?>
5760 <?= /* @noEscape */ $ block ->getItemPriceHtml (); ?>
58- <?php else : ?>
61+ <?php else : ?>
5962
6063 <?php endif ; ?>
6164 </td>
6265 <td class="col qty" data-th="<?= $ block ->escapeHtmlAttr (__ ('Quantity ' )); ?> ">
6366 <?php if (($ item ->getParentItem () && $ block ->isChildCalculated ()) ||
6467 (!$ item ->getParentItem () && !$ block ->isChildCalculated ()) ||
65- ($ item ->getQtyShipped () > 0 && $ item ->getParentItem () && $ block ->isShipmentSeparately ())) : ?>
68+ ($ item ->getQtyShipped () > 0 && $ item ->getParentItem () && $ block ->isShipmentSeparately ())): ?>
6669 <ul class="items-qty">
6770 <?php endif ; ?>
6871 <?php if (($ item ->getParentItem () && $ block ->isChildCalculated ()) ||
69- (!$ item ->getParentItem () && !$ block ->isChildCalculated ())) : ?>
70- <?php if ($ item ->getQtyOrdered () > 0 ) : ?>
72+ (!$ item ->getParentItem () && !$ block ->isChildCalculated ())): ?>
73+ <?php if ($ item ->getQtyOrdered () > 0 ): ?>
7174 <li class="item">
7275 <span class="title"><?= $ block ->escapeHtml (__ ('Ordered ' )); ?> </span>
7376 <span class="content"><?= /* @noEscape */ $ item ->getQtyOrdered () * 1 ; ?> </span>
7477 </li>
7578 <?php endif ; ?>
76- <?php if ($ item ->getQtyShipped () > 0 && !$ block ->isShipmentSeparately ()) : ?>
79+ <?php if ($ item ->getQtyShipped () > 0 && !$ block ->isShipmentSeparately ()): ?>
7780 <li class="item">
7881 <span class="title"><?= $ block ->escapeHtml (__ ('Shipped ' )); ?> </span>
7982 <span class="content"><?= /* @noEscape */ $ item ->getQtyShipped () * 1 ; ?> </span>
8083 </li>
8184 <?php endif ; ?>
82- <?php if ($ item ->getQtyCanceled () > 0 ) : ?>
85+ <?php if ($ item ->getQtyCanceled () > 0 ): ?>
8386 <li class="item">
8487 <span class="title"><?= $ block ->escapeHtml (__ ('Canceled ' )); ?> </span>
8588 <span class="content"><?= /* @noEscape */ $ item ->getQtyCanceled () * 1 ; ?> </span>
8689 </li>
8790 <?php endif ; ?>
88- <?php if ($ item ->getQtyRefunded () > 0 ) : ?>
91+ <?php if ($ item ->getQtyRefunded () > 0 ): ?>
8992 <li class="item">
9093 <span class="title"><?= $ block ->escapeHtml (__ ('Refunded ' )); ?> </span>
9194 <span class="content"><?= /* @noEscape */ $ item ->getQtyRefunded () * 1 ; ?> </span>
9295 </li>
9396 <?php endif ; ?>
94- <?php elseif ($ item ->getQtyShipped () > 0 && $ item ->getParentItem () && $ block ->isShipmentSeparately ()) : ?>
97+ <?php elseif ($ item ->getQtyShipped () > 0 && $ item ->getParentItem () && $ block ->isShipmentSeparately ()): ?>
9598 <li class="item">
9699 <span class="title"><?= $ block ->escapeHtml (__ ('Shipped ' )); ?> </span>
97100 <span class="content"><?= /* @noEscape */ $ item ->getQtyShipped () * 1 ; ?> </span>
98101 </li>
99- <?php else : ?>
102+ <?php else : ?>
100103 <span class="content"><?= /* @noEscape */ $ parentItem ->getQtyOrdered () * 1 ; ?> </span>
101104 <?php endif ; ?>
102105 <?php if (($ item ->getParentItem () && $ block ->isChildCalculated ()) ||
103106 (!$ item ->getParentItem () && !$ block ->isChildCalculated ()) ||
104- ($ item ->getQtyShipped () > 0 && $ item ->getParentItem () && $ block ->isShipmentSeparately ())) :?>
107+ ($ item ->getQtyShipped () > 0 && $ item ->getParentItem () && $ block ->isShipmentSeparately ())):?>
105108 </ul>
106109 <?php endif ; ?>
107110 </td>
108111 <td class="col subtotal" data-th="<?= $ block ->escapeHtmlAttr (__ ('Subtotal ' )) ?> ">
109- <?php if (!$ item ->getParentItem ()) : ?>
112+ <?php if (!$ item ->getParentItem ()): ?>
110113 <?= /* @noEscape */ $ block ->getItemRowTotalHtml (); ?>
111- <?php else : ?>
114+ <?php else : ?>
112115
113116 <?php endif ; ?>
114117 </td>
115118</tr>
116119<?php endforeach ; ?>
117120
118- <?php if ($ showLastRow && (($ options = $ block ->getItemOptions ()) || $ block ->escapeHtml ($ item ->getDescription ()))) : ?>
121+ <?php if ($ showLastRow && (($ options = $ block ->getItemOptions ()) || $ block ->escapeHtml ($ item ->getDescription ()))): ?>
119122<tr>
120123 <td class="col options" colspan="5">
121- <?php if ($ options = $ block ->getItemOptions ()) : ?>
124+ <?php if ($ options = $ block ->getItemOptions ()): ?>
122125 <dl class="item-options">
123- <?php foreach ($ options as $ option ) : ?>
126+ <?php foreach ($ options as $ option ): ?>
124127 <dt><?= $ block ->escapeHtml ($ option ['label ' ]) ?> </dt>
125- <?php if (!$ block ->getPrintStatus ()) : ?>
128+ <?php if (!$ block ->getPrintStatus ()): ?>
126129 <?php $ formattedOptionValue = $ block ->getFormatedOptionValue ($ option ) ?>
127- <dd<?php if (isset ($ formattedOptionValue ['full_view ' ])) : ?>
130+ <dd<?php if (isset ($ formattedOptionValue ['full_view ' ])): ?>
128131 class="tooltip wrapper"
129132 <?php endif ; ?> >
130133 <?= /* @noEscape */ $ formattedOptionValue ['value ' ] ?>
131- <?php if (isset ($ formattedOptionValue ['full_view ' ])) : ?>
134+ <?php if (isset ($ formattedOptionValue ['full_view ' ])): ?>
132135 <div class="tooltip content">
133136 <dl class="item options">
134137 <dt><?= $ block ->escapeHtml ($ option ['label ' ]); ?> </dt>
@@ -137,7 +140,7 @@ $prevOptionId = '';
137140 </div>
138141 <?php endif ; ?>
139142 </dd>
140- <?php else : ?>
143+ <?php else : ?>
141144 <dd><?= $ block ->escapeHtml ((isset ($ option ['print_value ' ]) ?
142145 $ option ['print_value ' ] :
143146 $ option ['value ' ])); ?>
0 commit comments