Skip to content

Cleanup duplicate html class #28639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,38 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

/**
* @var \Magento\Sales\Block\Order\PrintOrder\Shipment $block
* @var \Magento\Framework\Escaper $escaper
*/
?>
<?php /* @var $block \Magento\Sales\Block\Order\PrintOrder\Shipment */ ?>
<?php $order = $block->getOrder(); ?>
<?php if (!$block->getObjectData($order, 'is_virtual')) : ?>
<?php foreach ($block->getShipmentsCollection() as $shipment) : ?>
<?php if (!$block->getObjectData($order, 'is_virtual')): ?>
<?php foreach ($block->getShipmentsCollection() as $shipment): ?>
<div class="order-details-items shipments">
<div class="order-title">
<strong><?= $block->escapeHtml(__('Shipment #%1', $block->getObjectData($shipment, 'increment_id'))) ?></strong>
<strong>
<?= $escaper->escapeHtml(
__(
'Shipment #%1',
$block->getObjectData($shipment, 'increment_id')
)
) ?>
</strong>
</div>
<div class="table-wrapper order-items-shipment">
<table class="data table table-order-items shipment" id="my-shipment-table-<?= (int) $block->getObjectData($shipment, 'id') ?>">
<caption class="table-caption"><?= $block->escapeHtml(__('Items Invoiced')) ?></caption>
<table class="data table table-order-items shipment"
id="my-shipment-table-<?= (int)$block->getObjectData($shipment, 'id') ?>">
<caption class="table-caption"><?= $escaper->escapeHtml(__('Items Invoiced')) ?></caption>
<thead>
<tr>
<th class="col name"><?= $block->escapeHtml(__('Product Name')) ?></th>
<th class="col sku"><?= $block->escapeHtml(__('SKU')) ?></th>
<th class="col price"><?= $block->escapeHtml(__('Qty Shipped')) ?></th>
</tr>
<tr>
<th class="col name"><?= $escaper->escapeHtml(__('Product Name')) ?></th>
<th class="col sku"><?= $escaper->escapeHtml(__('SKU')) ?></th>
<th class="col price"><?= $escaper->escapeHtml(__('Qty Shipped')) ?></th>
</tr>
</thead>
<?php foreach ($block->getShipmentItems($shipment) as $item) : ?>
<?php foreach ($block->getShipmentItems($shipment) as $item): ?>
<tbody>
<?= $block->getItemHtml($item) ?>
</tbody>
Expand All @@ -31,12 +43,12 @@
</div>
<div class="block block-order-details-view">
<div class="block-title">
<strong><?= $block->escapeHtml(__('Order Information')) ?></strong>
<strong><?= $escaper->escapeHtml(__('Order Information')) ?></strong>
</div>
<div class="block-content">
<div class="box box-order-shipping-address">
<div class="box-title">
<strong><?= $block->escapeHtml(__('Shipping Address')) ?></strong>
<strong><?= $escaper->escapeHtml(__('Shipping Address')) ?></strong>
</div>
<div class="box-content">
<address><?= $block->getShipmentAddressFormattedHtml($shipment) ?></address>
Expand All @@ -45,25 +57,29 @@

<div class="box box-order-shipping-method">
<div class="box-title">
<strong><?= $block->escapeHtml(__('Shipping Method')) ?></strong>
<strong><?= $escaper->escapeHtml(__('Shipping Method')) ?></strong>
</div>
<div class="box-content">
<?= $block->escapeHtml($block->getObjectData($order, 'shipping_description')) ?>
<?= $escaper->escapeHtml($block->getObjectData($order, 'shipping_description')) ?>
<?php $tracks = $block->getShipmentTracks($shipment);
if ($tracks) : ?>
if ($tracks): ?>
<dl class="order-tracking">
<?php foreach ($tracks as $track) : ?>
<dt class="tracking-title"><?= $block->escapeHtml($block->getObjectData($track, 'title')) ?></dt>
<dd class="tracking-content"><?= $block->escapeHtml($block->getObjectData($track, 'number')) ?></dd>
<?php foreach ($tracks as $track): ?>
<dt class="tracking-title">
<?= $escaper->escapeHtml($block->getObjectData($track, 'title')) ?>
</dt>
<dd class="tracking-content">
<?= $escaper->escapeHtml($block->getObjectData($track, 'number')) ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif; ?>
</div>
</div>

<div class="box box-order-billing-method">
<div class="box box-order-billing-address">
<div class="box-title">
<strong><?= $block->escapeHtml(__('Billing Address')) ?></strong>
<strong><?= $escaper->escapeHtml(__('Billing Address')) ?></strong>
</div>
<div class="box-content">
<address><?= $block->getBillingAddressFormattedHtml($order) ?></address>
Expand All @@ -72,7 +88,7 @@

<div class="box box-order-billing-method">
<div class="box-title">
<strong><?= $block->escapeHtml(__('Payment Method')) ?></strong>
<strong><?= $escaper->escapeHtml(__('Payment Method')) ?></strong>
</div>
<div class="box-content">
<?= $block->getPaymentInfoHtml() ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private function assertOrderInformation(OrderInterface $order, string $html): vo
foreach ([$order->getShippingAddress(), $order->getBillingAddress()] as $address) {
$addressBoxXpath = ($address->getAddressType() == 'shipping')
? "//div[contains(@class, 'box-order-shipping-address')]//address[contains(., '%s')]"
: "//div[contains(@class, 'box-order-billing-method')]//address[contains(., '%s')]";
: "//div[contains(@class, 'box-order-billing-address')]//address[contains(., '%s')]";
$this->assertEquals(
1,
Xpath::getElementsCountForXpath(sprintf($addressBoxXpath, $address->getName()), $html),
Expand Down