Customise exported CSV content of Sonata Admin bundle

GaryZ

I'm new to sonata admin bundle. Now, I am try to export a csv file with something like: 'customer.phone', 'order.total'... but when I opened the csv file, in the field 'order.total' is only '99.99', I would like it to export as 'AUD $99.99', anyone know how I can achieve it? Thank a lot! The code is here:

public function getExportFields() {
    return array('id','customer.First_name','customer.Last_name',
        'customer.contact','total_amount'
        );
}
tiriana

You need to define method getTotalAmountFormated in your Order class, and make it return string that you need. Then add totalAmountFormated (or total_amount_formated, I think both should work) in array returned from getExportFields

public function getExportFields() {
    return array('id','customer.First_name','customer.Last_name',
        'customer.contact','totalAmountFormated'
        );
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

sonata admin bundle symfony

From Dev

CKEditor not showing with Sonata Formatter (Sonata Admin Bundle)

From Dev

Use tags in Sonata Admin Bundle

From Dev

Configure Menu in Sonata Admin Bundle

From Dev

Conflicts with sonata admin bundle and LiipFunctionalTestBundle

From Dev

Sonata Admin Bundle - String Validation

From Dev

List Images in sonata admin bundle

From Dev

Use tags in Sonata Admin Bundle

From Dev

Sonata Admin Bundle configureRoutes getPersistentParameters

From Dev

Conflicts with sonata admin bundle and LiipFunctionalTestBundle

From Dev

Sonata Media Bundle with Sonata Admin Bundle 3.0 (or 2.4)

From Dev

Sonata admin bundle : unable to remove relation with sonata_type_admin

From Dev

Sonata User Bundle + Admin Bundle admin redirect after login

From Dev

JSON array to table Sonata admin bundle

From Dev

Show sidebar in show view - Sonata admin bundle

From Dev

Error in file upload with sonata-admin bundle

From Dev

Sonata Admin Bundle custom routes using annotations

From Dev

Remove delete checkbox Sonata Admin Bundle

From Dev

Store Logged in user data in sonata admin bundle

From Dev

Is it possible to add a translatable association in Sonata Admin Bundle?

From Dev

Adding entity not managed by Sonata Admin Bundle

From Dev

disable action in sonata admin bundle CRUD

From Dev

Show sidebar in show view - Sonata admin bundle

From Dev

Sonata Admin Bundle custom routes using annotations

From Dev

Create new field type in sonata admin bundle

From Dev

How to display a photo in Sonata Admin Bundle

From Dev

Set a field like choose in sonata Admin bundle

From Dev

Gedmo translatable / default locale and sonata admin bundle

From Dev

Batch actions with Sonata Admin Bundle on Symfony

Related Related

  1. 1

    sonata admin bundle symfony

  2. 2

    CKEditor not showing with Sonata Formatter (Sonata Admin Bundle)

  3. 3

    Use tags in Sonata Admin Bundle

  4. 4

    Configure Menu in Sonata Admin Bundle

  5. 5

    Conflicts with sonata admin bundle and LiipFunctionalTestBundle

  6. 6

    Sonata Admin Bundle - String Validation

  7. 7

    List Images in sonata admin bundle

  8. 8

    Use tags in Sonata Admin Bundle

  9. 9

    Sonata Admin Bundle configureRoutes getPersistentParameters

  10. 10

    Conflicts with sonata admin bundle and LiipFunctionalTestBundle

  11. 11

    Sonata Media Bundle with Sonata Admin Bundle 3.0 (or 2.4)

  12. 12

    Sonata admin bundle : unable to remove relation with sonata_type_admin

  13. 13

    Sonata User Bundle + Admin Bundle admin redirect after login

  14. 14

    JSON array to table Sonata admin bundle

  15. 15

    Show sidebar in show view - Sonata admin bundle

  16. 16

    Error in file upload with sonata-admin bundle

  17. 17

    Sonata Admin Bundle custom routes using annotations

  18. 18

    Remove delete checkbox Sonata Admin Bundle

  19. 19

    Store Logged in user data in sonata admin bundle

  20. 20

    Is it possible to add a translatable association in Sonata Admin Bundle?

  21. 21

    Adding entity not managed by Sonata Admin Bundle

  22. 22

    disable action in sonata admin bundle CRUD

  23. 23

    Show sidebar in show view - Sonata admin bundle

  24. 24

    Sonata Admin Bundle custom routes using annotations

  25. 25

    Create new field type in sonata admin bundle

  26. 26

    How to display a photo in Sonata Admin Bundle

  27. 27

    Set a field like choose in sonata Admin bundle

  28. 28

    Gedmo translatable / default locale and sonata admin bundle

  29. 29

    Batch actions with Sonata Admin Bundle on Symfony

HotTag

Archive