Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
recent.phtml
Go to the documentation of this file.
1 <?php
7 // @codingStandardsIgnoreFile
8 
9 ?>
10 <div class="block block-dashboard-orders">
11 <?php
12  $_orders = $block->getOrders();
13  $count = count($_orders);
14 ?>
15  <div class="block-title order">
16  <strong><?= /* @escapeNotVerified */ __('Recent Orders') ?></strong>
17  <?php if ($count > 0): ?>
18  <a class="action view" href="<?= /* @escapeNotVerified */ $block->getUrl('sales/order/history') ?>">
19  <span><?= /* @escapeNotVerified */ __('View All') ?></span>
20  </a>
21  <?php endif; ?>
22  </div>
23  <div class="block-content">
24  <?= $block->getChildHtml() ?>
25  <?php if ($count > 0): ?>
26  <div class="table-wrapper orders-recent">
27  <table class="data table table-order-items recent" id="my-orders-table">
28  <caption class="table-caption"><?= /* @escapeNotVerified */ __('Recent Orders') ?></caption>
29  <thead>
30  <tr>
31  <th scope="col" class="col id"><?= /* @escapeNotVerified */ __('Order #') ?></th>
32  <th scope="col" class="col date"><?= /* @escapeNotVerified */ __('Date') ?></th>
33  <th scope="col" class="col shipping"><?= /* @escapeNotVerified */ __('Ship To') ?></th>
34  <th scope="col" class="col total"><?= /* @escapeNotVerified */ __('Order Total') ?></th>
35  <th scope="col" class="col status"><?= /* @escapeNotVerified */ __('Status') ?></th>
36  <th scope="col" class="col actions"><?= /* @escapeNotVerified */ __('Action') ?></th>
37  </tr>
38  </thead>
39  <tbody>
40  <?php foreach ($_orders as $_order): ?>
41  <tr>
42  <td data-th="<?= $block->escapeHtml(__('Order #')) ?>" class="col id"><?= /* @escapeNotVerified */ $_order->getRealOrderId() ?></td>
43  <td data-th="<?= $block->escapeHtml(__('Date')) ?>" class="col date"><?= /* @escapeNotVerified */ $block->formatDate($_order->getCreatedAt()) ?></td>
44  <td data-th="<?= $block->escapeHtml(__('Ship To')) ?>" class="col shipping"><?= $_order->getShippingAddress() ? $block->escapeHtml($_order->getShippingAddress()->getName()) : '&nbsp;' ?></td>
45  <td data-th="<?= $block->escapeHtml(__('Order Total')) ?>" class="col total"><?= /* @escapeNotVerified */ $_order->formatPrice($_order->getGrandTotal()) ?></td>
46  <td data-th="<?= $block->escapeHtml(__('Status')) ?>" class="col status"><?= /* @escapeNotVerified */ $_order->getStatusLabel() ?></td>
47  <td data-th="<?= $block->escapeHtml(__('Actions')) ?>" class="col actions">
48  <a href="<?= /* @escapeNotVerified */ $block->getViewUrl($_order) ?>" class="action view">
49  <span><?= /* @escapeNotVerified */ __('View Order') ?></span>
50  </a>
51  <?php if ($this->helper('Magento\Sales\Helper\Reorder')->canReorder($_order->getEntityId())) : ?>
52  <a href="#" data-post='<?php /* @escapeNotVerified */ echo
53  $this->helper(\Magento\Framework\Data\Helper\PostHelper::class)
54  ->getPostData($block->getReorderUrl($_order))
55  ?>' class="action order">
56  <span><?= /* @escapeNotVerified */ __('Reorder') ?></span>
57  </a>
58  <?php endif ?>
59  </td>
60  </tr>
61  <?php endforeach; ?>
62  </tbody>
63  </table>
64  </div>
65  <?php else: ?>
66  <div class="message info empty"><span><?= /* @escapeNotVerified */ __('You have placed no orders.') ?></span></div>
67  <?php endif; ?>
68  </div>
69 </div>
$count
Definition: recent.phtml:13
$parentItem $_order
Definition: default.phtml:12
__()
Definition: __.php:13
$block
Definition: block.php:8
endif
Definition: recent.phtml:36
$_orders
Definition: recent.phtml:12
endforeach
Definition: recent.phtml:32