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'
);
}
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'
);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With