Jump to content

Customer addresses: limit and default?


Recommended Posts

Hi

 

About customer's address, I don't see in db any field or relation to say what's is the default customer's address. How can I know what is it? I see even the id can change when the user makes changes.

 

And about limit, is there a number of a limit for addresses can create the user? If so, can be changed?

 

Regards.

Link to comment
Share on other sites

About customer's address, I don't see in db any field or relation to say what's is the default customer's address. How can I know what is it? I see even the id can change when the user makes changes.

No relation. PrestaShop DB was created before the relational model theory was proposed by Codd. :)

 

It is FIFO so the first created address is displayed first.

 

And about limit, is there a number of a limit for addresses can create the user? If so, can be changed?

There is no limit, should there be?

Link to comment
Share on other sites

Hi, thanks for answer.

 

I'm not know why Id from an address changes sometimes. I guess when you change an address that you used in a order before, to mantain the old address info in old orders perphaps?

 

The problem is I need to display only the first address created in a section, I did a mysql query but so I can't get it by Id (because can change), maybe there is a method or function to get them ordered?

 

Limit about numbers ... It's no sense but It's a client's petition ...

 

Regards,

Link to comment
Share on other sites

I'm not know why Id from an address changes sometimes. I guess when you change an address that you used in a order before, to mantain the old address info in old orders perphaps?

Correct

 

The problem is I need to display only the first address created in a section, I did a mysql query but so I can't get it by Id (because can change), maybe there is a method or function to get them ordered?

Customer class, getAddresses method will return all addresses in the order they were added.

Address class, getFirstCustomerAddressId method will return the id for the first address

 

Re limiting number of addresses that can be added, many different ways to implement it. E.g. to limit it to one, one could make the id_customer in Address table a unique field etc. Seek professional advice

Link to comment
Share on other sites

Yes, about force to limit the number of address there would many ways, for now I count that number to display or not the 'Add a new address' button/link.

 

The problem was really 'force' to have a 'default address', many thanks for the info.

 

Regards,

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...