init
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/** @var \Magento\Checkout\Block\Cart\Totals $block */
|
||||
$totals = $block->getTotals();
|
||||
$getTotalValue = static function (string $code) use ($totals): float {
|
||||
return isset($totals[$code]) ? (float)$totals[$code]->getValue() : 0.0;
|
||||
};
|
||||
$formatPrice = static function (float $amount) use ($block): string {
|
||||
return $block->getQuote()->getStore()->getCurrentCurrency()->format($amount, [], false);
|
||||
};
|
||||
$rewardPointsUsed = (int)$block->getQuote()->getData('reward_points_used');
|
||||
?>
|
||||
<div id="cart-totals" class="cart-totals esun-cart-page-totals">
|
||||
<div class="esun-cart-page-total-row">
|
||||
<span><?= $block->escapeHtml(__('Subtotal')) ?></span>
|
||||
<strong><?= $block->escapeHtml($formatPrice($getTotalValue('subtotal'))) ?></strong>
|
||||
</div>
|
||||
<div class="esun-cart-page-total-row">
|
||||
<span><?= $block->escapeHtml(__('Discount')) ?></span>
|
||||
<strong><?= $block->escapeHtml($formatPrice($getTotalValue('discount'))) ?></strong>
|
||||
</div>
|
||||
<?php if ($getTotalValue('reward_discount') != 0.0): ?>
|
||||
<div class="esun-cart-page-total-row">
|
||||
<span><?= $block->escapeHtml(__('Points Discount (%1 points)', $rewardPointsUsed)) ?></span>
|
||||
<strong><?= $block->escapeHtml($formatPrice($getTotalValue('reward_discount'))) ?></strong>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="esun-cart-page-total-row">
|
||||
<span><?= $block->escapeHtml(__('Estimated Shipping')) ?></span>
|
||||
<strong><?= $block->escapeHtml($formatPrice($getTotalValue('shipping'))) ?></strong>
|
||||
</div>
|
||||
<div class="esun-cart-page-total-row esun-cart-page-total-row--grand">
|
||||
<span><?= $block->escapeHtml(__('Total')) ?></span>
|
||||
<strong><?= $block->escapeHtml($formatPrice($getTotalValue('grand_total'))) ?></strong>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user