Skip to content

Commit

Permalink
Merge pull request #28 from buckaroo-it/BP-3546-Use-object-as-array-i…
Browse files Browse the repository at this point in the history
…n-Buckaroo-HyvaCheckout-Block-Totals-Fee-getTotal-22

BP-3546-Use-object-as-array-in-Buckaroo-HyvaCheckout-Block-Totals-Fee-getTotal-22
  • Loading branch information
AlbinaBaraliu authored Jul 5, 2024
2 parents c8f66d7 + b3f8499 commit 040782a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 71 deletions.
63 changes: 0 additions & 63 deletions Block/Totals/Fee.php

This file was deleted.

7 changes: 3 additions & 4 deletions view/frontend/layout/hyva_checkout_components.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,13 @@
<block name="price-summary.total-segment.pretax_buckaroo_fee"
as="pretax_buckaroo_fee"
template="Buckaroo_HyvaCheckout::total-segments/empty.phtml"/>
<block name="price-summary.total-segment.buckaroo_fee"
class="Buckaroo\HyvaCheckout\Block\Totals\Fee"
as="buckaroo_fee"
<block name="price-summary.total-segment.buckaroo_fee_hyva"
as="buckaroo_fee_hyva"
template="Buckaroo_HyvaCheckout::total-segments/fee.phtml"/>
<block name="price-summary.total-segment.buckaroo_already_paid"
class="Buckaroo\HyvaCheckout\Block\Totals\AlreadyPaid"
as="buckaroo_already_paid"
template="Buckaroo_HyvaCheckout::total-segments/already-paid.phtml"/>
</referenceBlock>
</body>
</page>
</page>
10 changes: 6 additions & 4 deletions view/frontend/templates/total-segments/fee.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ use Hyva\Checkout\ViewModel\Checkout\Formatter as FormatterViewModel;
use Hyva\Theme\Model\ViewModelRegistry;

$formatterViewModel = $viewModels->require(FormatterViewModel::class);
$total = $block->getTotal();
if ($total != 0) {
$total = $block->getSegment();

if ($total['value'] != 0) {

?>
<div class="flex gap-4 justify-between md:gap-0">
<span class="label font-bold">
<?= $block->escapeHtml($block->getTitle()) ?>
<?= $block->escapeHtml($total['title']) ?>
</span>
<span class="value"><?= /* @noEscape */ $formatterViewModel->currency($total ?? 0) ?></span>
<span class="value"><?= /* @noEscape */ $formatterViewModel->currency($total['value'] ?? 0) ?></span>
</div>
<?php
}

0 comments on commit 040782a

Please sign in to comment.