Skip to content

Commit

Permalink
bug #12126 Fix incorrect money format being used (kayue)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.8 branch.

Discussion
----------

Only format accept currency as argument. 
Fix #11941.

| Q               | A
| --------------- | -----
| Branch?         | 1.8
| Bug fix?        | yes
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | fixes #11941
| License         | MIT

A "Cart" menu/collector is added in Sylius 1.8, but this feature requires Channel to exist in the debugger/profiler's route, otherwise user will get the following error:

> An exception has been thrown during the rendering of a template ("Channel could not be found! Tip: You can use the Web Debug Toolbar to switch between channels in development.").

The error is triggered by `convertAndFormat()` in the Twig file. Change it to `format()` fix the problem. I think it was meant to use `format` since method signature was incorrect also.

Commits
-------

33f91d8 Fix incorrect money format being used
  • Loading branch information
AdamKasp committed Feb 24, 2021
2 parents d39b31e + 33f91d8 commit 10d94cb
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
</div>
<div class="sf-toolbar-info-piece">
<b>Subtotal</b>
<span>{{ money.convertAndFormat(collector.subtotal, collector.currency) }}</span>
<span>{{ money.format(collector.subtotal, collector.currency) }}</span>
</div>
<div class="sf-toolbar-info-piece">
<b>Total</b>
<span>{{ money.convertAndFormat(collector.total, collector.currency) }}</span>
<span>{{ money.format(collector.total, collector.currency) }}</span>
</div>
</div>
<div class="sf-toolbar-info-group">
Expand Down Expand Up @@ -64,8 +64,8 @@
<td>{{ collector.id }}</td>
<td>{{ collector.currency }}</td>
<td>{{ collector.locale }}</td>
<td>{{ money.convertAndFormat(collector.subtotal, collector.currency) }}</td>
<td>{{ money.convertAndFormat(collector.total, collector.currency) }}</td>
<td>{{ money.format(collector.subtotal, collector.currency) }}</td>
<td>{{ money.format(collector.total, collector.currency) }}</td>
</tr>
</table>

Expand Down

0 comments on commit 10d94cb

Please sign in to comment.