VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: myplace2100 on April 17, 2017, 17:27:11 PM

Title: Is customer id field unique?
Post by: myplace2100 on April 17, 2017, 17:27:11 PM
In virtuemart order table i see there is a field "customer_number", is that field same and unique for all orders of the same buyer/customer??
For some reasons i need to query the order table for a specific user's orders by this customer id instead user id.

Thanks in advance
Title: Re: Is customer id field unique?
Post by: AH on April 18, 2017, 11:26:01 AM
The customer_number is not unique to a customer

I would tend to go with -
virtuemart_orders -> virtuemart_user_id

If the customer has a VM account then this number will be the same for all orders they made when logged in
Title: Re: Is customer id field unique?
Post by: myplace2100 on April 18, 2017, 18:02:07 PM
Sorry i am not getting u.
Can there be different customer_number values of a user who made different orders for different products?? In vm orders table i checked couple of orders of a user and in every order row that customer_number value is same. So isn't it unique per user?
Title: Re: Is customer id field unique?
Post by: AH on April 18, 2017, 18:59:40 PM
"
QuoteCan there be different customer_number values of a user"

By this I think you mean a registered customer

If a customer is registered and is logged in when they complete an order then they will have the same customer number

However - virtuemart_user_id  will also be the same for every order and is a lot easier read :-)

Title: Re: Is customer id field unique?
Post by: myplace2100 on April 18, 2017, 19:23:43 PM
Hi yes of course m talkin abt the user who is registered and completes order by logging in. So is as that id is unique id, i need to use it for some purposes.
Title: Re: Is customer id field unique?
Post by: AH on April 19, 2017, 12:34:49 PM
Yes use it

But I dont know why you could not use virtuemart_user_id