Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
items.phtml
Go to the documentation of this file.
1 <?php
7 // @codingStandardsIgnoreFile
8 
9 ?>
10 
11 <section class="admin__page-section">
12  <div class="admin__page-section-title">
13  <span class="title"><?= /* @escapeNotVerified */ __('Items to Ship') ?></span>
14  </div>
15  <div class="admin__table-wrapper">
16  <table class="data-table admin__table-primary order-shipment-table">
17  <thead>
18  <tr class="headings">
19  <th class="col-product"><span><?= /* @escapeNotVerified */ __('Product') ?></span></th>
20  <th class="col-ordered-qty"><span><?= /* @escapeNotVerified */ __('Qty') ?></span></th>
21  <th class="col-qty<?php if ($block->isShipmentRegular()): ?> last<?php endif; ?>">
22  <span><?= /* @escapeNotVerified */ __('Qty to Ship') ?></span>
23  </th>
24  <?php if (!$block->canShipPartiallyItem()): ?>
25  <th class="col-ship last"><span><?= /* @escapeNotVerified */ __('Ship') ?></span></th>
26  <?php endif; ?>
27  </tr>
28  </thead>
29  <?php $_items = $block->getShipment()->getAllItems() ?>
30  <?php $_i = 0; foreach ($_items as $_item): if ($_item->getOrderItem()->getParentItem()): continue; endif; $_i++ ?>
31  <tbody class="<?= /* @escapeNotVerified */ $_i%2 ? 'odd' : 'even' ?>">
32  <?= $block->getItemHtml($_item) ?>
33  <?= $block->getItemExtraInfoHtml($_item->getOrderItem()) ?>
34  </tbody>
35  <?php endforeach; ?>
36  </table>
37  </div>
38 </section>
39 
40 <section class="admin__page-section">
41  <div class="admin__page-section-title">
42  <span class="title"><?= /* @escapeNotVerified */ __('Shipment Total') ?></span>
43  </div>
44  <div class="admin__page-section-content order-comments-history">
45  <div class="admin__page-section-item">
46  <div class="admin__page-section-item-title">
47  <span class="title"><?= /* @escapeNotVerified */ __('Shipment Comments') ?></span>
48  </div>
49  <div class="admin__page-section-item-content">
50  <div id="order-history_form" class="admin__field">
51  <label class="admin__field-label"
52  for="shipment_comment_text">
53  <span><?= /* @escapeNotVerified */ __('Comment Text') ?></span></label>
54  <div class="admin__field-control">
55  <textarea id="shipment_comment_text"
56  class="admin__control-textarea"
57  name="shipment[comment_text]"
58  rows="3"
59  cols="5"><?= /* @escapeNotVerified */ $block->getShipment()->getCommentText() ?></textarea>
60  </div>
61  </div>
62  </div>
63  </div>
64  </div>
65  <div class="admin__page-section-item order-totals order-totals-actions">
66  <div class="admin__page-section-item-title">
67  <span class="title"><?= /* @escapeNotVerified */ __('Shipment Options') ?></span>
68  </div>
69  <div class="admin__page-section-item-content">
70  <?php if ($block->canCreateShippingLabel()): ?>
71  <div class="field choice admin__field admin__field-option field-create">
72  <input id="create_shipping_label"
73  class="admin__control-checkbox"
74  name="shipment[create_shipping_label]"
75  value="1"
76  type="checkbox"
77  onclick="toggleCreateLabelCheckbox();"/>
78  <label class="admin__field-label"
79  for="create_shipping_label">
80  <span><?= /* @escapeNotVerified */ __('Create Shipping Label') ?></span></label>
81  </div>
82  <?php endif ?>
83 
84  <div class="field choice admin__field admin__field-option field-append">
85  <input id="notify_customer"
86  class="admin__control-checkbox"
87  name="shipment[comment_customer_notify]"
88  value="1"
89  type="checkbox"/>
90  <label class="admin__field-label"
91  for="notify_customer">
92  <span><?= /* @escapeNotVerified */ __('Append Comments') ?></span></label>
93  </div>
94 
95  <?php if ($block->canSendShipmentEmail()): ?>
96  <div class="field choice admin__field admin__field-option field-email">
97  <input id="send_email"
98  class="admin__control-checkbox"
99  name="shipment[send_email]"
100  value="1"
101  type="checkbox"/>
102  <label class="admin__field-label"
103  for="send_email">
104  <span><?= /* @escapeNotVerified */ __('Email Copy of Shipment') ?></span></label>
105  </div>
106  <?php endif; ?>
107  <?= $block->getChildHtml('submit_before') ?>
108  <div class="order-history-comments-actions actions">
109  <?= $block->getChildHtml('submit_button') ?>
110  <?= $block->getChildHtml('submit_after') ?>
111  </div>
112  </div>
113  </div>
114 </section>
115 <script>
116 require([
117  "jquery",
118  "Magento_Ui/js/modal/alert",
119  "prototype"
120 ], function(jQuery, alert){
121 
122 //<![CDATA[
123 var sendEmailCheckbox = $('send_email');
124 if (sendEmailCheckbox) {
125  var notifyCustomerCheckbox = $('notify_customer');
126  var shipmentCommentText = $('shipment_comment_text');
127  Event.observe(sendEmailCheckbox, 'change', bindSendEmail);
128  bindSendEmail();
129 }
130 function bindSendEmail() {
131  if (sendEmailCheckbox.checked == true) {
132  notifyCustomerCheckbox.disabled = false;
133  }
134  else {
135  notifyCustomerCheckbox.disabled = true;
136  }
137 }
138 window.toggleCreateLabelCheckbox = function() {
139  var checkbox = $('create_shipping_label');
140  var submitButton = checkbox.up('.order-totals').select('.submit-button span')[0];
141  if (checkbox.checked) {
142  submitButton.innerText += '...';
143  } else {
144  submitButton.innerText = submitButton.innerText.replace(/\.\.\.$/, '');
145  }
146 }
147 window.submitShipment = function(btn) {
148  if (!validQtyItems()) {
149  alert({
150  content: '<?= /* @escapeNotVerified */ __('Invalid value(s) for Qty to Ship') ?>'
151  });
152  return;
153  }
154  var checkbox = $(btn).up('.order-totals').select('#create_shipping_label')[0];
155  if (checkbox && checkbox.checked) {
156  packaging.showWindow();
157  } else {
158  disableElements('submit-button');
159  // Temporary solution will be replaced after refactoring order functionality
160  jQuery('#edit_form').on('invalid-form.validate', function() {
161  enableElements('submit-button');
162  jQuery('#edit_form').off('invalid-form.validate');
163  });
164  jQuery('#edit_form').triggerHandler('save');
165  }
166 }
167 window.validQtyItems = function() {
168  var valid = true;
169  $$('.qty-item').each(function(item) {
170  var val = parseFloat(item.value);
171  if (isNaN(val) || val < 0) {
172  valid = false;
173  }
174  });
175  return valid;
176 }
177 
178 window.bindSendEmail = bindSendEmail;
179 
180 window.shipmentCommentText = shipmentCommentText;
181 window.notifyCustomerCheckbox = notifyCustomerCheckbox;
182 window.sendEmailCheckbox = sendEmailCheckbox;
183 //]]>
184 
185 });
186 </script>
$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
$_items $_i
Definition: items.phtml:41
if( $block->getQuote() ->hasVirtualItems())( 'Other items in your order') ?></strong >< a hrefforeach( $block->getVirtualQuoteItems() as $_item)(__( 'Product Name')) ?>"><? endforeach
Definition: items.phtml:31
$_items
Definition: items.phtml:27
__()
Definition: __.php:13
$block
Definition: block.php:8
$_item
Definition: default.phtml:11
if( $type=='related' &&$canItemsAddToCart)( 'Check items to add to the cart or') ?>< button type endif
Definition: items.phtml:169
jquery extjs ext tree checkbox
Definition: tree.phtml:41
jQuery('.store-switcher .dropdown-menu li a').each(function()
Definition: switcher.phtml:203