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 <?php $_items = $block->getCreditmemo()->getAllItems() ?>
11 
12 <section class="admin__page-section">
13  <div class="admin__page-section-title">
14  <span class="title"><?= /* @escapeNotVerified */ __('Items to Refund') ?></span>
15  </div>
16 
17  <?php if (count($_items)) : ?>
18  <div class="admin__table-wrapper">
19  <table class="data-table admin__table-primary order-creditmemo-tables">
20  <thead>
21  <tr class="headings">
22  <th class="col-product"><span><?= /* @escapeNotVerified */ __('Product') ?></span></th>
23  <th class="col-price"><span><?= /* @escapeNotVerified */ __('Price') ?></span></th>
24  <th class="col-ordered-qty"><span><?= /* @escapeNotVerified */ __('Qty') ?></span></th>
25  <?php if ($block->canReturnToStock()) : ?>
26  <th class="col-return-to-stock"><span><?= /* @escapeNotVerified */ __('Return to Stock') ?></span></th>
27  <?php endif; ?>
28  <th class="col-refund"><span><?= /* @escapeNotVerified */ __('Qty to Refund') ?></span></th>
29  <th class="col-subtotal"><span><?= /* @escapeNotVerified */ __('Subtotal') ?></span></th>
30  <th class="col-tax-amount"><span><?= /* @escapeNotVerified */ __('Tax Amount') ?></span></th>
31  <th class="col-discont"><span><?= /* @escapeNotVerified */ __('Discount Amount') ?></span></th>
32  <th class="col-total last"><span><?= /* @escapeNotVerified */ __('Row Total') ?></span></th>
33  </tr>
34  </thead>
35  <?php if ($block->canEditQty()): ?>
36  <tfoot>
37  <tr>
38  <td colspan="3">&nbsp;</td>
39  <td colspan="3">
40  <?= $block->getUpdateButtonHtml() ?>
41  </td>
42  <td colspan="3" class="last">&nbsp;</td>
43  </tr>
44  </tfoot>
45  <?php endif; ?>
46  <?php $i = 0; foreach ($_items as $_item): ?>
47  <?php if ($_item->getOrderItem()->getParentItem()) {
48  continue;
49  } else {
50  $i++;
51  } ?>
52  <tbody class="<?= /* @escapeNotVerified */ $i%2 ? 'even' : 'odd' ?>">
53  <?= $block->getItemHtml($_item) ?>
54  <?= $block->getItemExtraInfoHtml($_item->getOrderItem()) ?>
55  </tbody>
56  <?php endforeach; ?>
57  </table>
58  </div>
59  <?php else : ?>
60  <div class="no-items">
61  <?= /* @escapeNotVerified */ __('No Items To Refund') ?>
62  </div>
63  <?php endif; ?>
64 </section>
65 
66 <?php $orderTotalBar = $block->getChildHtml('order_totalbar'); ?>
67 
68 <?php if (!empty($orderTotalBar)): ?>
69 <section class="fieldset-wrapper">
70  <?= /* @escapeNotVerified */ $orderTotalBar ?>
71 </section>
72 <?php endif; ?>
73 
74 <section class="admin__page-section">
75  <input type="hidden" name="creditmemo[do_offline]" id="creditmemo_do_offline" value="0" />
76  <div class="admin__page-section-title">
77  <span class="title"><?= /* @escapeNotVerified */ __('Order Total') ?></span>
78  </div>
79  <div class="admin__page-section-content">
80  <div class="admin__page-section-item order-comments-history">
81  <div class="admin__page-section-item-title">
82  <span class="title"><?= /* @escapeNotVerified */ __('Credit Memo Comments') ?></span>
83  </div>
84  <div id="history_form" class="admin__fieldset-wrapper-content">
85  <div class="admin__field">
86  <label class="normal admin__field-label"
87  for="creditmemo_comment_text">
88  <span><?= /* @escapeNotVerified */ __('Comment Text') ?></span></label>
89  <div class="admin__field-control">
90  <textarea id="creditmemo_comment_text"
91  class="admin__control-textarea"
92  name="creditmemo[comment_text]"
93  rows="3"
94  cols="5"><?= /* @escapeNotVerified */ $block->getCreditmemo()->getCommentText() ?></textarea>
95  </div>
96  </div>
97  </div>
98  </div>
99  <div class="admin__page-section-item order-totals creditmemo-totals">
100  <div class="admin__page-section-item-title">
101  <span class="title"><?= /* @escapeNotVerified */ __('Refund Totals') ?></span>
102  </div>
103  <?= $block->getChildHtml('creditmemo_totals') ?>
104  <div class="order-totals-actions">
105  <div class="field choice admin__field admin__field-option field-append-comments">
106  <input id="notify_customer"
107  class="admin__control-checkbox"
108  name="creditmemo[comment_customer_notify]"
109  value="1"
110  type="checkbox" />
111  <label for="notify_customer" class="admin__field-label">
112  <span><?= /* @escapeNotVerified */ __('Append Comments') ?></span>
113  </label>
114  </div>
115  <?php if ($block->canSendCreditmemoEmail()):?>
116  <div class="field choice admin__field admin__field-option field-email-copy">
117  <input id="send_email"
118  class="admin__control-checkbox"
119  name="creditmemo[send_email]"
120  value="1"
121  type="checkbox" />
122  <label for="send_email" class="admin__field-label">
123  <span><?= /* @escapeNotVerified */ __('Email Copy of Credit Memo') ?></span>
124  </label>
125  </div>
126  <?php endif; ?>
127  <?= $block->getChildHtml('submit_before') ?>
128  <div class="actions">
129  <?= $block->getChildHtml('submit_offline') ?>
130  <?= $block->getChildHtml('submit_button') ?>
131  <?= $block->getChildHtml('submit_after') ?>
132  </div>
133  </div>
134  </div>
135  </div>
136 </section>
137 
138 <script>
139 require(['jquery', 'prototype'], function(jQuery){
140 
141 //<![CDATA[
142 var submitButtons = $$('.submit-button');
143 var updateButtons = $$('.update-button');
144 var fields = $$('.qty-input');
145 
146 updateButtons.each(function (elem) {elem.disabled=true;elem.addClassName('disabled');});
147 
148 for(var i=0;i<fields.length;i++){
149  fields[i].observe('change', checkButtonsRelation)
150  fields[i].baseValue = fields[i].value;
151 }
152 
153 function checkButtonsRelation() {
154  var hasChanges = false;
155  fields.each(function (elem) {
156  if (elem.baseValue != elem.value) {
157  hasChanges = true;
158  }
159  }.bind(this));
160  if (hasChanges) {
161  submitButtons.each(function (elem) {elem.disabled=true;elem.addClassName('disabled');});
162  updateButtons.each(function (elem) {elem.disabled=false;elem.removeClassName('disabled');});
163  }
164  else {
165  submitButtons.each(function (elem) {elem.disabled=false;elem.removeClassName('disabled');});
166  updateButtons.each(function (elem) {elem.disabled=true;elem.addClassName('disabled');});
167  }
168 }
169 
170 submitCreditMemo = function() {
171  if ($('creditmemo_do_offline')) $('creditmemo_do_offline').value=0;
172  // Temporary solution will be replaced after refactoring order functionality
173  jQuery('#edit_form').triggerHandler('save');
174 }
175 
176 submitCreditMemoOffline = function() {
177  if ($('creditmemo_do_offline')) $('creditmemo_do_offline').value=1;
178  // Temporary solution will be replaced after refactoring order functionality
179  jQuery('#edit_form').triggerHandler('save');
180 }
181 
182 var sendEmailCheckbox = $('send_email');
183 
184 if (sendEmailCheckbox) {
185  var notifyCustomerCheckbox = $('notify_customer');
186  var creditmemoCommentText = $('creditmemo_comment_text');
187  Event.observe(sendEmailCheckbox, 'change', bindSendEmail);
188  bindSendEmail();
189 }
190 
191 function bindSendEmail()
192 {
193  if (sendEmailCheckbox.checked == true) {
194  notifyCustomerCheckbox.disabled = false;
195  //creditmemoCommentText.disabled = false;
196  }
197  else {
198  notifyCustomerCheckbox.disabled = true;
199  //creditmemoCommentText.disabled = true;
200  }
201 }
202 
203 window.bindSendEmail = bindSendEmail;
204 window.checkButtonsRelation = checkButtonsRelation;
205 //]]>
206 
207 });
208 </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
if( $exist)( $type=='related'||$type=='upsell')($type=='related') else
Definition: items.phtml:154
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
$_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
if( $type=='related' &&$canItemsAddToCart)( 'Check items to add to the cart or') ?>< button type endif
Definition: items.phtml:169
$i
Definition: items.phtml:46
jQuery('.store-switcher .dropdown-menu li a').each(function()
Definition: switcher.phtml:203
$orderTotalBar
Definition: items.phtml:66