2

I am exporting Magento 2.1.9 Saler Order Grid to CSV and XML formats using the provided buttons. But when I open the file in Excel the currency symbol is missing in Grand Total (Base) and Grand Total (Purchased) columns.

I need the currency symbols in all price colums when exporting.

1

Ok here is what I did to achieve the desired output.

  • Created a new Module and override the Convert Classes (ConvertToCsv / ConvertToXml) from vendor/magento/module-ui/Model/Export/
  • Replaced following code

foreach ($items as $item) {
          $this->metadataProvider->convertDate($item, $component->getName());
          $stream->writeCsv($this->metadataProvider->getRowData($item, $fields, $options));
    }

With

foreach ($items as $item) {
$item['base_grand_total'] = $item['base_currency_code'].$item['base_grand_total'];
            $srItem['grand_total'] = $item['order_currency_code'].$item['grand_total'];
            $item['subtotal'] = $item['base_currency_code'].$item['subtotal'];
            $item['shipping_and_handling'] = $item['base_currency_code'].$item['shipping_and_handling'];
                $this->metadataProvider->convertDate($item, $component->getName());
                $stream->writeCsv($this->metadataProvider->getRowData($item, $fields, $options));
            }

It did the trick for me - hope someone will find it useful or someone will provide a better solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.