Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
grid.phtml
Go to the documentation of this file.
1 <?php
7 // @codingStandardsIgnoreFile
8 
9 ?>
10 <?php
14 ?>
15 
16 <?php $_items = $block->getItems() ?>
17 <?php if (empty($_items)): ?>
18  <div id="order-items_grid">
19  <div class="admin__table-wrapper">
20  <table class="data-table admin__table-primary order-tables">
21  <thead>
22  <tr class="headings">
23  <th class="col-product"><span><?= /* @escapeNotVerified */ __('Product') ?></span></th>
24  <th class="col-price"><span><?= /* @escapeNotVerified */ __('Price') ?></span></th>
25  <th class="col-qty"><span><?= /* @escapeNotVerified */ __('Qty') ?></span></th>
26  <th class="col-subtotal"><span><?= /* @escapeNotVerified */ __('Subtotal') ?></span></th>
27  <th class="col-discount"><span><?= /* @escapeNotVerified */ __('Discount') ?></span></th>
28  <th class="col-row-total"><span><?= /* @escapeNotVerified */ __('Row Subtotal') ?></span></th>
29  <th class="col-action"><span><?= /* @escapeNotVerified */ __('Action') ?></span></th>
30  </tr>
31  </thead>
32  <tbody>
33  <tr class="even">
34  <td class="empty-text" colspan="100"><?= /* @escapeNotVerified */ __('No ordered items') ?></td>
35  </tr>
36  </tbody>
37  </table>
38  </div>
39  </div>
40 <?php else: ?>
41  <div class="admin__table-wrapper" id="order-items_grid">
42  <?php if (count($_items)>10): ?>
43  <div class="actions update actions-update">
44  <?= $block->getButtonHtml(__('Update Items and Quantities'), 'order.itemsUpdate()', 'action-secondary') ?>
45  </div>
46  <?php endif; ?>
47  <table class="data-table admin__table-primary order-tables">
48  <thead>
49  <tr class="headings">
50  <th class="col-product"><span><?= /* @escapeNotVerified */ __('Product') ?></span></th>
51  <th class="col-price"><span><?= /* @escapeNotVerified */ __('Price') ?></span></th>
52  <th class="col-qty"><span><?= /* @escapeNotVerified */ __('Qty') ?></span></th>
53  <th class="col-subtotal"><span><?= /* @escapeNotVerified */ __('Subtotal') ?></span></th>
54  <th class="col-discount"><span><?= /* @escapeNotVerified */ __('Discount') ?></span></th>
55  <th class="col-row-total"><span><?= /* @escapeNotVerified */ __('Row Subtotal') ?></span></th>
56  <th class="col-action"><span><?= /* @escapeNotVerified */ __('Action') ?></span></th>
57  </tr>
58  </thead>
59  <tfoot>
60  <tr>
61  <td class="col-total"><?= /* @escapeNotVerified */ __('Total %1 product(s)', count($_items)) ?></td>
62  <td colspan="2" class="col-subtotal"><?= /* @escapeNotVerified */ __('Subtotal:') ?></td>
63  <td class="col-price"><strong><?= /* @escapeNotVerified */ $block->formatPrice($block->getSubtotal()) ?></strong></td>
64  <td class="col-price"><strong><?= /* @escapeNotVerified */ $block->formatPrice($block->getDiscountAmount()) ?></strong></td>
65  <td class="col-price"><strong>
66  <?php
67  /* @escapeNotVerified */ echo $block->formatPrice($block->getSubtotalWithDiscount());
68  ?></strong></td>
69  <td colspan="2">&nbsp;</td>
70  </tr>
71  </tfoot>
72  <?php $i = 0 ?>
73  <?php foreach ($_items as $_item):$i++ ?>
74  <tbody class="<?= /* @escapeNotVerified */ ($i%2) ? 'even' : 'odd' ?>">
75  <tr>
76  <td class="col-product">
77  <span id="order_item_<?= /* @escapeNotVerified */ $_item->getId() ?>_title"><?= $block->escapeHtml($_item->getName()) ?></span>
78  <div class="product-sku-block">
79  <span><?= /* @escapeNotVerified */ __('SKU') ?>:</span>
80  <?= implode('<br />', $this->helper('Magento\Catalog\Helper\Data')->splitSku($block->escapeHtml($_item->getSku()))) ?>
81  </div>
82  <div class="product-configure-block">
83  <?= $block->getConfigureButtonHtml($_item) ?>
84  </div>
85  </td>
86  <td class="col-price">
87 
88  <?= $block->getItemUnitPriceHtml($_item) ?>
89 
90  <?php $_isCustomPrice = $block->usedCustomPriceForItem($_item) ?>
91  <?php if ($_tier = $block->getTierHtml($_item)): ?>
92  <div id="item_tier_block_<?= /* @escapeNotVerified */ $_item->getId() ?>"<?php if ($_isCustomPrice): ?> style="display:none"<?php endif; ?>>
93  <a href="#" onclick="$('item_tier_<?= /* @escapeNotVerified */ $_item->getId() ?>').toggle();return false;"><?= /* @escapeNotVerified */ __('Tier Pricing') ?></a>
94  <div style="display:none" id="item_tier_<?= /* @escapeNotVerified */ $_item->getId() ?>"><?= /* @escapeNotVerified */ $_tier ?></div>
95  </div>
96  <?php endif; ?>
97  <?php if ($block->canApplyCustomPrice($_item)): ?>
98  <div class="custom-price-block">
99  <input type="checkbox"
100  class="admin__control-checkbox"
101  id="item_use_custom_price_<?= /* @escapeNotVerified */ $_item->getId() ?>"
102  <?php if ($_isCustomPrice): ?> checked="checked"<?php endif; ?>
103  onclick="order.toggleCustomPrice(this, 'item_custom_price_<?= /* @escapeNotVerified */ $_item->getId() ?>', 'item_tier_block_<?= /* @escapeNotVerified */ $_item->getId() ?>');"/>
104  <label
105  class="normal admin__field-label"
106  for="item_use_custom_price_<?= /* @escapeNotVerified */ $_item->getId() ?>">
107  <span><?= /* @escapeNotVerified */ __('Custom Price') ?>*</span></label>
108  </div>
109  <?php endif; ?>
110  <input id="item_custom_price_<?= /* @escapeNotVerified */ $_item->getId() ?>"
111  name="item[<?= /* @escapeNotVerified */ $_item->getId() ?>][custom_price]"
112  value="<?= /* @escapeNotVerified */ sprintf("%.2f", $block->getOriginalEditablePrice($_item)) ?>"
113  <?php if (!$_isCustomPrice): ?>
114  style="display:none"
115  disabled="disabled"
116  <?php endif; ?>
117  class="input-text item-price admin__control-text"/>
118  </td>
119  <td class="col-qty">
120  <input name="item[<?= /* @escapeNotVerified */ $_item->getId() ?>][qty]"
121  class="input-text item-qty admin__control-text"
122  value="<?= /* @escapeNotVerified */ $_item->getQty()*1 ?>"
123  maxlength="12" />
124  </td>
125  <td class="col-subtotal col-price">
126  <?= $block->getItemRowTotalHtml($_item) ?>
127  </td>
128  <td class="col-discount col-price">
129  <?= /* @escapeNotVerified */ $block->formatPrice(-$_item->getTotalDiscountAmount()) ?>
130  <div class="discount-price-block">
131  <input id="item_use_discount_<?= /* @escapeNotVerified */ $_item->getId() ?>"
132  class="admin__control-checkbox"
133  name="item[<?= /* @escapeNotVerified */ $_item->getId() ?>][use_discount]"
134  <?php if (!$_item->getNoDiscount()): ?>checked="checked"<?php endif; ?>
135  value="1"
136  type="checkbox" />
137  <label
138  for="item_use_discount_<?= /* @escapeNotVerified */ $_item->getId() ?>"
139  class="normal admin__field-label">
140  <span><?= /* @escapeNotVerified */ __('Apply') ?></span></label>
141  </div>
142 
143  </td>
144  <td class="col-price col-row-subtotal">
145  <?= $block->getItemRowTotalWithDiscountHtml($_item) ?>
146  </td>
147  <td class="col-actions last">
148  <select class="admin__control-select" name="item[<?= /* @escapeNotVerified */ $_item->getId() ?>][action]">
149  <option value=""><?= /* @escapeNotVerified */ __('Please select') ?></option>
150  <option value="remove"><?= /* @escapeNotVerified */ __('Remove') ?></option>
151  <?php if ($block->getCustomerId() && $block->getMoveToCustomerStorage()): ?>
152  <option value="cart"><?= /* @escapeNotVerified */ __('Move to Shopping Cart') ?></option>
153  <?php if ($block->isMoveToWishlistAllowed($_item)): ?>
154  <?php $wishlists = $block->getCustomerWishlists();?>
155  <?php if (count($wishlists) <= 1):?>
156  <option value="wishlist"><?= /* @escapeNotVerified */ __('Move to Wish List') ?></option>
157  <?php else: ?>
158  <optgroup label="<?= /* @escapeNotVerified */ __('Move to Wish List') ?>">
159  <?php foreach ($wishlists as $wishlist):?>
160  <option value="wishlist_<?= /* @escapeNotVerified */ $wishlist->getId() ?>"><?= $block->escapeHtml($wishlist->getName()) ?></option>
161  <?php endforeach;?>
162  </optgroup>
163  <?php endif; ?>
164  <?php endif; ?>
165  <?php endif; ?>
166  </select>
167  </td>
168  </tr>
169 
170  <?php $hasMessageError = false; ?>
171  <?php foreach ($_item->getMessage(false) as $messageError):?>
172  <?php if (!empty($messageError)) {
173  $hasMessageError = true;
174  }
175  ?>
176  <?php endforeach; ?>
177 
178  <?php if ($hasMessageError):?>
179  <tr class="row-messages-error">
180  <td colspan="100"> <!-- ToDo UI: remove the 100 -->
181  <?php foreach ($_item->getMessage(false) as $message):
182  if (empty($message)) {
183  continue;
184  }
185  ?>
186  <div class="message <?php if ($_item->getHasError()): ?>message-error<?php else: ?>message-notice<?php endif; ?>">
187  <?= $block->escapeHtml($message) ?>
188  </div>
189  <?php endforeach; ?>
190  </td>
191  </tr>
192  <?php endif;?>
193 
194  <?= $block->getItemExtraInfo($_item)->toHtml() ?>
195  </tbody>
196  <?php endforeach; ?>
197  </table>
198  <p><small><?= /* @escapeNotVerified */ $block->getInclExclTaxMessage() ?></small></p>
199  </div>
200 
201  <div class="order-discounts">
202  <?= $block->getButtonHtml(__('Update Items and Quantities'), 'order.itemsUpdate()', 'action-secondary') ?>
203  <div id="order-coupons" class="order-coupons"><?= $block->getChildHtml() ?></div>
204  </div>
205 
206  <script>
207  require([
208  'Magento_Sales/order/create/form'
209  ], function(){
210  order.itemsOnchangeBind()
211  });
212  </script>
213 
214 <?php if ($block->isGiftMessagesAvailable()) : ?>
215 <script>
216 require([
217  "prototype",
218  "Magento_Sales/order/giftoptions_tooltip"
219 ], function(){
220 
221 //<![CDATA[
225  function getGiftOptionsTooltipContent(itemId) {
226  var contentLines = [];
227  var headerLine = null;
228  var contentLine = null;
229 
230  $$('#gift_options_data_' + itemId + ' .gift-options-tooltip-content').each(function (element) {
231  if (element.down(0)) {
232  headerLine = element.down(0).innerHTML;
233  contentLine = element.down(0).next().innerHTML;
234  if (contentLine.length > 30) {
235  contentLine = contentLine.slice(0,30) + '...';
236  }
237  contentLines.push(headerLine + ' ' + contentLine);
238  }
239  });
240  return contentLines.join('<br/>');
241  }
242 
243  giftOptionsTooltip.setTooltipContentLoaderFunction(getGiftOptionsTooltipContent);
244 
245  window.getGiftOptionsTooltipContent = getGiftOptionsTooltipContent;
246 
247 //]]>
248 
249 });
250 </script>
251 <?php endif; ?>
252 <?php endif; ?>
$block setTitle( 'CMS Block Title') -> setIdentifier('fixture_block') ->setContent('< h1 >Fixture Block Title</h1 >< a href=" store url</a><p> Config value
Definition: block.php:9
__()
Definition: __.php:13
$message
$block
Definition: block.php:8
endif
Definition: grid.phtml:31
$wishlist
Definition: wishlist.php:10
$_count $_index $_prevOptionId if($block->getOrderOptions()|| $_item->getDescription()) foreach( $items as $_item)( $_item) ?><?php $attributes if( $_item->getOrderItem() ->getParentItem())($_prevOptionId !=$attributes['option_id'])</td >< td > & nbsp
Definition: renderer.phtml:33
$_item
Definition: default.phtml:11
$i
Definition: grid.phtml:36
$hasMessageError
Definition: grid.phtml:170
foreach( $block->getColumns() as $_column)() ?><? endforeach
Definition: grid.phtml:39
$_items
Definition: list.phtml:15