Skip to content

Commit

Permalink
Merge pull request #788 from dpfaffenbauer/price_formatter_currency_a…
Browse files Browse the repository at this point in the history
…ware

[OrderBundle] check in price-formatter also for currency-aware types
  • Loading branch information
dpfaffenbauer authored Jan 22, 2019
2 parents 8b36841 + 0730005 commit a967ddd
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace CoreShop\Bundle\OrderBundle\Pimcore\GridColumnConfig\Operator;

use CoreShop\Component\Currency\Formatter\MoneyFormatterInterface;
use CoreShop\Component\Currency\Model\CurrencyAwareInterface;
use CoreShop\Component\Locale\Context\LocaleContextInterface;
use CoreShop\Component\Order\Model\SaleInterface;
use Pimcore\DataObject\GridColumnConfig\Operator\AbstractOperator;
Expand Down Expand Up @@ -64,7 +65,11 @@ public function getLabeledValue($element)
$c = $children[0];
$result = $c->getLabeledValue($element);

if ($element instanceof SaleInterface) {
if ($element instanceof CurrencyAwareInterface) {
$currency = $element->getCurrency();
$result->value = $this->moneyFormatter->format($result->value, $currency->getIsoCode(), $this->localeService->getLocaleCode());
}
elseif ($element instanceof SaleInterface) {
$store = $element->getStore();
$result->value = $this->moneyFormatter->format($result->value, $store->getCurrency()->getIsoCode(), $this->localeService->getLocaleCode());
}
Expand Down

0 comments on commit a967ddd

Please sign in to comment.