address_format_id

Open to all! Ask other shopowners for help.
mirabeo
Member
Posts: 10
Joined: Mon Mar 29, 2021 5:22 am
Phoenix Version:
Has thanked: 8 times
Been thanked: 1 time

address_format_id

Post 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



Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4739
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 279 times
Been thanked: 467 times

Re: address_format_id

Post by burt »

I may be misremembering but I think address_format is set per country, not per address.
I am not here to build for you.
I am here to build with you. Let's help each other.

User avatar
mhsuffolk
Contributor
Posts: 209
Joined: Sat Oct 26, 2019 9:13 am
Phoenix Version: v1.1.0.7
Has thanked: 13 times
Been thanked: 12 times

Re: address_format_id

Post 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.

mirabeo
Member
Posts: 10
Joined: Mon Mar 29, 2021 5:22 am
Phoenix Version:
Has thanked: 8 times
Been thanked: 1 time

Re: address_format_id

Post 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

User avatar
burt
Core Team
Posts: 4739
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 279 times
Been thanked: 467 times

Re: address_format_id

Post 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?
I am not here to build for you.
I am here to build with you. Let's help each other.

mirabeo
Member
Posts: 10
Joined: Mon Mar 29, 2021 5:22 am
Phoenix Version:
Has thanked: 8 times
Been thanked: 1 time

Re: address_format_id

Post 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

mirabeo
Member
Posts: 10
Joined: Mon Mar 29, 2021 5:22 am
Phoenix Version:
Has thanked: 8 times
Been thanked: 1 time

Re: address_format_id

Post 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

User avatar
burt
Core Team
Posts: 4739
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 279 times
Been thanked: 467 times

Re: address_format_id

Post 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.
I am not here to build for you.
I am here to build with you. Let's help each other.

ecartz
Core Team
Posts: 3087
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: address_format_id

Post 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.

raiwa
Certified Developer
Posts: 1666
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 72 times
Been thanked: 156 times

Re: address_format_id

Post by raiwa »

My Tax exempt validator includes the tax field:
app.php/addons/paid_addon/tax_exempt_validator
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing



Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply