Author Topic: Is customer id field unique?  (Read 341 times)

myplace2100

  • Jr. Member
  • **
  • Posts: 50
    • Tech and extensions
  • Skype Name: mridulcs
Is customer id field unique?
« 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
joomla & wordpress extension developer

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2538
  • VirtueMart Version: 3.2.1
Re: Is customer id field unique?
« Reply #1 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
regards
A

Joomla 3.6.5
php 7

myplace2100

  • Jr. Member
  • **
  • Posts: 50
    • Tech and extensions
  • Skype Name: mridulcs
Re: Is customer id field unique?
« Reply #2 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?
joomla & wordpress extension developer

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2538
  • VirtueMart Version: 3.2.1
Re: Is customer id field unique?
« Reply #3 on: April 18, 2017, 18:59:40 pm »
"
Quote
Can 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.6.5
php 7

myplace2100

  • Jr. Member
  • **
  • Posts: 50
    • Tech and extensions
  • Skype Name: mridulcs
Re: Is customer id field unique?
« Reply #4 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.
joomla & wordpress extension developer

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2538
  • VirtueMart Version: 3.2.1
Re: Is customer id field unique?
« Reply #5 on: April 19, 2017, 12:34:49 pm »
Yes use it

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

Joomla 3.6.5
php 7