News:

Support the VirtueMart project and become a member

Main Menu

Is customer id field unique?

Started by myplace2100, April 17, 2017, 17:27:11 PM

Previous topic - Next topic

myplace2100

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
joomla & wordpress extension developer

AH

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
Regards
A

Joomla 3.10.11
php 8.0

myplace2100

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?
joomla & wordpress extension developer

AH

"
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 :-)

Regards
A

Joomla 3.10.11
php 8.0

myplace2100

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.
joomla & wordpress extension developer

AH

Yes use it

But I dont know why you could not use virtuemart_user_id
Regards
A

Joomla 3.10.11
php 8.0