Page 1 of 2

address_format_id

Posted: Mon Aug 24, 2026 5:43 pm
by mirabeo
I want to migrate to phoenix in the near future and I am trying to adapt some addons that are important for me. One of these is to add a new field in the customers table, the VAT number for Spain, that will appear in orders.php, packingslip.php and invoice.php, it is possible to be seen in the account_history.php. I can modify those files and the problem would be solved, but as in the orders table exist three fields for the address_format_id, is it possible to define different values for: customers_address_format_id, delivery_address_format_id and billing_address_format_id ?
Thank you

Re: address_format_id

Posted: Tue Aug 25, 2026 8:35 am
by burt
I may be misremembering but I think address_format is set per country, not per address.

Re: address_format_id

Posted: Tue Aug 25, 2026 2:05 pm
by mhsuffolk
I think the OP requires a field in the customers and or orders table for the VAT/Tax ID number of the customer. It appears to be a Spanish requirement.

Re: address_format_id

Posted: Tue Aug 25, 2026 3:51 pm
by mirabeo
burt wrote: ↑Tue Aug 25, 2026 8:35 am I may be misremembering but I think address_format is set per country, not per address.
Thank you, yes, that is, this is the reason of asking because it is established by the country you select and you can select at the same time the address_format_id, but just one, however when the orders are created in the orders table there are three fields for address_format_id: customers_address_format_id, delivery_address_format_id and billing_address_format_id. I will continue looking for. Thank you

Re: address_format_id

Posted: Tue Aug 25, 2026 3:56 pm
by burt
OK. It is per country, but...these addresses might be different countries, right ?

EG:
Someone who works in Gibraltar, but wants delivery to where they live in Spain
Someone who live in Northern Ireland but works in Eire
etc

I think that's the historical reason for this.

It's a little confusing what you're asking for...is it something about addresses or something about customers VAT number?

Re: address_format_id

Posted: Tue Aug 25, 2026 4:14 pm
by mirabeo
Ok, it is not a big problem, but just yo explain it a little better, in each order that is created three address_format_id are created in the orders table, for the same country for the same order, so I was thinking if the structure of those three address_format_id could be different, for example for delivery_address_format_id= 3 and for billing_address_format_id = 5.
But, don't worry, I have a solution, just have to change a few files.
Thank you

Re: address_format_id

Posted: Tue Aug 25, 2026 4:18 pm
by mirabeo
mhsuffolk wrote: ↑Tue Aug 25, 2026 2:05 pm I think the OP requires a field in the customers and or orders table for the VAT/Tax ID number of the customer. It appears to be a Spanish requirement.
Yes, it is a Spanish requirement to show the TAX ID/ Fiscal Identity in the invoices that are issued. We have to collect that id at the moment the account is created and carry it to the order created in the orders table.
Thank you

Re: address_format_id

Posted: Wed Aug 26, 2026 8:14 am
by burt
A Customer Data module on create_account.php that stores the customers Tax ID in the customers table?

Then on each order, store this in the Order Table and show where needed? <--- you need to do this to make that Tax ID immutable (unable to be changed by the customer after Order is made).

That might work?

We have Spain based users, one of them must have done something like this?
Hopefully one of them might see this and advise you.

Re: address_format_id

Posted: Wed Aug 26, 2026 1:36 pm
by ecartz
It would probably be better to show the tax ID by hook directly rather than in the address. Because it sounds like your problem is that you're trying to show different address formats to hack the tax ID into them. That's a clever idea, but I think it will keep having consequences that you don't want. Meanwhile, adding fields to the invoice is something that others need. So it would be easier to get help with that if it isn't working quite how you need it.

Re: address_format_id

Posted: Wed Aug 26, 2026 2:00 pm
by raiwa
My Tax exempt validator includes the tax field:
app.php/addons/paid_addon/tax_exempt_validator