In Magento 1.7 and 1.8 there are 2 "eav_attribute" regarding VAT: 'vat_id' and 'taxvat'.
I can display the vat_id on customer address simply from system -> configuration -> customer configuration adding in the address templates:
{{depend vat_id}}VAT ID: {{var vat_id}}{{/depend}}
And it works fine.
if I try the same thing with the 'taxvat' field
{{depend taxvat}}CF: {{var taxvat}}{{/depend}}
it doesn't work…
I think that it depends from the file
/app/code/core/Mage/Customer/etc/config.xml
so I create a custom module and added my config.xml, then I tried to edit the configuration to make the taxvat field like the vat_id field, but still it doesn't work.
What's the best practice to display this builtin field in the address?
Best Answer
The reason that the
taxvat
is not working is because there is not attribute taxvat saved as part of the address. You can see this by looking into the tableeav_attribute
and filter onentity_type_id
where the id is 2 (note that this is in the default data the address id)You can either make a new attribute on the address, but that is a lot of work. What you could do instead is to look at the event
customer_address_format
here you can add items to the address object before rendering so you should be able to add the taxvat from the customer to the address.