VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: Philippe MARTY on May 27, 2020, 15:45:00 PM

Title: Change Shopper Group for a population of users
Post by: Philippe MARTY on May 27, 2020, 15:45:00 PM
Hello,
I have about 200 customers in a shop.
About 50 are in shopper group A and 75 others in group B
I need to move users from group B to group A
How can I do the job?
There is no batch tools in VM3 :(

I tried through phpmyadmin to do the move but I receive a 1062 error...

Here's the move I tried (group A is id=2 and group B id=5)
UPDATE XXXX_virtuemart_vmuser_shoppergroups
SET virtuemart_shoppergroup_id = 2
WHERE virtuemart_shoppergroup_id = 5


Here' the answer from server:
#1062 - Duplicate entry '769-2' for key 'virtuemart_user_id'

(some users belong to several groups)
Thanks for your help
Title: Re: Change Shopper Group for a population of users
Post by: GJC Web Design on May 27, 2020, 23:41:10 PM
so some u tried to change must already be in SG 5

export all the users ids of  SG 2 and add a where NOT IN (## the ids ##)