Skip to content

Commit e91be15

Browse files
authored
[Bug] Fix empty online shop order (#58)
* Fix broken detail view for online shop order if order is empty * Change back btn back to secondary
1 parent 0599bee commit e91be15

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/Model/Currency.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,12 @@ protected function getFormatter(): IntlFormatter
7272
return \Pimcore::getContainer()->get(IntlFormatter::class);
7373
}
7474

75-
public function toCurrency(float|int|string|Decimal $value, array|string $pattern = 'default'): string
75+
public function toCurrency(null|float|int|string|Decimal $value, array|string $pattern = 'default'): string
7676
{
77+
if($value == null) {
78+
return '';
79+
}
80+
7781
if (is_array($pattern)) {
7882
$symbol = $pattern['display'] ? $pattern['display'] : self::USE_SYMBOL;
7983
$position = $pattern['position'] ? $pattern['position'] : self::RIGHT;

src/Resources/views/admin_order/detail.html.twig

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,13 @@
391391
{% endfor %}
392392
{% endfor %}
393393

394-
<!-- Separator -->
395-
<div class="separator text-muted">
396-
<time>{{ formatter.formatDateTime(order.getOrderdate(), constant('\\Pimcore\\Localization\\IntlFormatter::DATETIME_MEDIUM')) }}</time>
397-
</div>
398-
<!-- /Separator -->
394+
{% if order.getOrderdate() %}
395+
<!-- Separator -->
396+
<div class="separator text-muted">
397+
<time>{{ formatter.formatDateTime(order.getOrderdate(), constant('\\Pimcore\\Localization\\IntlFormatter::DATETIME_MEDIUM')) }}</time>
398+
</div>
399+
<!-- /Separator -->
400+
{% endif %}
399401

400402
<article class="panel panel-default panel-outline">
401403
<div class="panel-heading icon alert-secondary">

0 commit comments

Comments
 (0)