Welcome, Guest. Please login or register.
Login with username, password and session length


VirtueMart 1.1.8 - [SECURITY RELEASE] is available! Read more....

  Advanced search

247038 Posts in 67506 Topics- by 258314 Members - Latest Member: aniketana
VirtueMart ForumVirtueMart 1.1.xCustomer / User ManagementAssigning users to a specific shopper group on sign-up?
Pages: [1] 2   Go Down
Print
Author Topic: Assigning users to a specific shopper group on sign-up?  (Read 6550 times)
boogaloodude
Newbie
*
Posts: 7


« on: March 21, 2010, 08:59:27 AM »

Using Joomla 1.5.15 & Virtuemart 1.1.4 stable

I want to show one set of prices to users just browsing the site but a discounted set of prices to users who have registered. I've set up multiple normal prices and discounted prices for each product and created a shopper group for the discounted prices but when people register it's automatically assigning them to the 'default' shopper group, so even when they log in they still see the normal prices and I have to manually change that to 'Discounted prices' shopper group in the User Manager to allow them to see the disscounted prices.

How can I make it so they automatically get assigned to the 'Discounted prices' shopper group when they register?

Thanks in advance for any help.
Logged
boogaloodude
Newbie
*
Posts: 7


« Reply #1 on: March 22, 2010, 09:04:32 AM »

This must be a common issue, does anyone know if it can be done?   Surely you  can't only manually assign users to shopping groups?
Logged
Oebel
Newbie
*
Posts: 15


WWW
« Reply #2 on: March 22, 2010, 09:45:03 AM »

Hi,

maybe one way to do it is by creating a required user field and based on this field they will be moved to a default shopper group.

This is how I did it for splitting up companies from consumers.

best regards,

Oebel
Logged
Oebel
Newbie
*
Posts: 15


WWW
« Reply #3 on: March 22, 2010, 09:50:19 AM »

Maybe this site will help you a bit

http://www.packtpub.com/article/customer-management-in-joomla-virtuemart?utm_source=rk_joomla_comm_abr3_0409&utm_medium=content&utm_campaign=ramsai

best regards,

Oebel
Logged
Morcorp
Newbie
*
Posts: 14


« Reply #4 on: March 22, 2010, 17:48:15 PM »

maybe one way to do it is by creating a required user field and based on this field they will be moved to a default shopper group.
This is how I did it for splitting up companies from consumers.

How is this done? I created a new field called "member group" selected "yes" required. It does show up in the registration and must be selected, but it does not move that new user out of the default shopper group and into the shopper (member) group selected. Still have to make the change or assignment on the back end.

How did you differentiate between consumers and companies? Shopper groups.?
« Last Edit: March 22, 2010, 18:01:53 PM by Morcorp » Logged
Oebel
Newbie
*
Posts: 15


WWW
« Reply #5 on: March 23, 2010, 01:55:46 AM »

Hi,

when editing / adding a user field, there is the option "Move the customer into the following shopper group upon successful validation of the <FIELDNAME>".

When the shopper succesfully fills out the required field (in my case the EU Tax ID), he's automatically moved to another group.

See attachment.

Regards,

Oebel



* userfield edit.JPG (49.56 KB, 943x602 - viewed 667 times.)
Logged
boogaloodude
Newbie
*
Posts: 7


« Reply #6 on: March 23, 2010, 07:55:32 AM »

Thanks for the replies, unfortunately I already found a solution and had just come back to post it up for everyone when I saw these replies.

This worked for me, but may not be suitable for other people's requirements, I don't know, but here it is anyway in case it's useful:


I'm using Joomla 1.5.15 and Virtuemart 1.1.4 (stable) in 'Catalogue' mode but with prices enabled.

The problem was one of overiding the assignment of a new user to the default shopper group in virtuemart and instead assign them to one I'd created myself. Virtuemart seems to assign a shopper group ID of '7' to the first custom shopper group created so you need to tell the registration process to assign new users to group 7.

The file that needs to be changed is ps_shopper.php and it can be found in admin/components/com_virtuemart/classes

On line 419, change:

$d['shopper_group_id'] = $db->f("shopper_group_id") ;

to

$d['shopper_group_id'] = '7' ;


Logged
jlowell
Newbie
*
Posts: 2


« Reply #7 on: May 18, 2010, 16:00:42 PM »

hello Oebel

I did like you show in your picture but still when i registered with a valid EU vat no the user is save in default shopper and not move to the one i assign Sad

PLease help Sad

Thank
« Last Edit: May 18, 2010, 16:17:58 PM by jlowell » Logged
titchagui
Newbie
*
Posts: 12


« Reply #8 on: June 24, 2010, 10:42:13 AM »

For people that encountered problems on moving automatically valid VAT users to a "VAT registered" group, it is due to VAT validation that is not correct!

How to correct this problem?
Open administrator/components/com_virtuemart/classes/euvatcheck.class.php file.
Replace (at line 17)
Code:
var $viesurl = 'http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl';
by
Code:
var $viesurl = 'http://ec.europa.eu/taxation_customs/vies/services/checkVatService?wsdl';

and (at line 122)
Code:
case "VALID" : $this->output = true;
by
Code:
case "URN:VALID" : $this->output = true;

Actually server to check VAT changed this year so VAT was not correctly checked. It seems that there is a JavaScript that controls VAT ID consistency so no error was appearing on user registration.

I had exactly the same problem! Last year, this feature was working perfectly then it bugged this year Tongue

Another comment, it works only for user registration! In account maintenance, shopper group is not updated when adding a valid VAT ID or removing it. (I'm working on a solution)
Logged
miroki
Newbie
*
Posts: 10


« Reply #9 on: June 29, 2010, 07:25:38 AM »

joomla 1.5, virtue mart 1.1.4
This solution does not work for me.
Wrong VAT number. And also not added to the group.
Logged
Darkheart
Newbie
*
Posts: 2


« Reply #10 on: August 27, 2010, 06:09:43 AM »


Another comment, it works only for user registration! In account maintenance, shopper group is not updated when adding a valid VAT ID or removing it. (I'm working on a solution)

titchagui,
Have you made the solution?
Logged
vitovito
Newbie
*
Posts: 26


« Reply #11 on: September 30, 2010, 06:50:51 AM »

I have applyed the change for EU VAT validation and I do not get any error but shoppers are not moving to the required shopper group.
has anybody made work?
Thanks
Logged
Tim ceko
Newbie
*
Posts: 17


« Reply #12 on: December 20, 2010, 08:37:12 AM »

I know this post was a little old so i'm not sure if this will help anyone...  I DO NOT certify that this will not break any other part of your Joomla/VM install, but it worked for me on Joomla 1.5.21 with Virtuemart 1.1.5.

Basically, my problem was that I needed a field to assign users to a shopper group during registration.  I was not using the euvat, b/c that field did not fit the bill for what i needed.

SO... I modified 2 files found in /administrator/components/com_virtuemart/classes/ and then created a select box for selecting shopper group.  Here is a step by step of what i did.  PLEASE NOTE: I know this is not the best code or probably the best way to do this, but, for my requirements, it just has to work and this did.

First, I made the following changes/additions to the ps_shopper.php file:

NOTE: Your line numbers may be different than mine.

1) added lines 80 to 82 (directly above case 'age_verification') the following code:
Code:
case 'select':
     $d['vm_selectshoppergroup'] = vmRequest::getInt('vm_selectshoppergroup');
     break;


2) added lines 192 to 194 (again, directly above case 'age_verification') the following code:
Code:
case 'select':
     $d['vm_selectshoppergroup'] = vmRequest::getInt('vm_selectshoppergroup');
     break;


3) added lines 420 to 422 (directly under the if($d['isValidVATID'] statement) the following if statement:
Code:
if (!empty($d['vm_selectshoppergroup'])) {
     $d['shopper_group_id'] = $d['vm_selectshoppergroup'];
     }

4) added lines 759 to 766 (added an else to the if(empty)$d'customer_number'])) statement) the following code:
Code:
// else was added for shopper group select
else {
$q  = "UPDATE #__{vm}_shopper_vendor_xref SET ";
$q .= "shopper_group_id='". $d['vm_selectshoppergroup'] ."'";
$q .= "WHERE ";
$q .= "user_id='". $user_id ."'";
$db->query($q) or die(mysql_error());
}

5) Save the file.


Next I modified the ps_userfield.php file:

6) open ps_userfield.php

find the following line, for me it was 494.
Code:
$rowFieldValues['lst_'.$field->name] = vmCommonHTML::selectList( $Values, $field->name."[]",

and change it to
Code:
$rowFieldValues['lst_'.$field->name] = vmCommonHTML::selectList( $Values, $field->name."",


7) open your ftp program and make a backup of your current ps_shopper.php AND ps_userfield.php files

8 ) upload the ps_shopper.php and ps_userfield.php files that you just modified.


Finally, I created a shopper group select userfield:

9) login to your joomla admin backend and go to virtuemart.

10) on the left under 'administration' click on manager user fields

11) add a new user field:
  • !IMPORTANT - Type: Drop Down (single select)
  • !IMPORTANT - Name: vm_selectshoppergroup
  • all other variables can be set how you need.
  • at the bottom your values should be set up as the title is whatever you want the user to see and the value is the shopper_group_id.  If you don't know the shopper group id, then on the left click on 'shopper' and 'list shopper groups'  click on a shopper group and look in the url, you will see shopper_group_id=.  Take that number and that's your shopper group id
  • add however many titles and values (shopper group id's) that you need

example setup:
  • Type: Drop Down (Single Select)
  • Name: vm_selectshoppergroup
  • Title: Are you a wholesaler of us?
  • Required: Yes
  • All other variables are defaults
  • Values
    • Title: No     Value: 5
    • Title: Yes    Value: 6

12) Save the new field and test it out.

Again, I make no warranty that this is perfect, but it is what worked for me. This forum has helped me an absolute ton, so I hope this helps someone else.

Edit:
Also, your users can modify this setting in their account if you have "show in account maintenance?" set to yes. If they change this in their account it WILL update their shopper group.
« Last Edit: December 20, 2010, 08:43:14 AM by Tim ceko » Logged
cakotr
Newbie
*
Posts: 4


« Reply #13 on: January 17, 2011, 16:47:29 PM »

I know this post was a little old so i'm not sure if this will help anyone...  I DO NOT certify that this will not break any other part of your Joomla/VM install, but it worked for me on Joomla 1.5.21 with Virtuemart 1.1.5.

Basically, my problem was that I needed a field to assign users to a shopper group during registration.  I was not using the euvat, b/c that field did not fit the bill for what i needed.

SO... I modified 2 files found in /administrator/components/com_virtuemart/classes/ and then created a select box for selecting shopper group.  Here is a step by step of what i did.  PLEASE NOTE: I know this is not the best code or probably the best way to do this, but, for my requirements, it just has to work and this did.

First, I made the following changes/additions to the ps_shopper.php file:

NOTE: Your line numbers may be different than mine.

1) added lines 80 to 82 (directly above case 'age_verification') the following code:
Code:
case 'select':
     $d['vm_selectshoppergroup'] = vmRequest::getInt('vm_selectshoppergroup');
     break;


2) added lines 192 to 194 (again, directly above case 'age_verification') the following code:
Code:
case 'select':
     $d['vm_selectshoppergroup'] = vmRequest::getInt('vm_selectshoppergroup');
     break;


3) added lines 420 to 422 (directly under the if($d['isValidVATID'] statement) the following if statement:
Code:
if (!empty($d['vm_selectshoppergroup'])) {
     $d['shopper_group_id'] = $d['vm_selectshoppergroup'];
     }

4) added lines 759 to 766 (added an else to the if(empty)$d'customer_number'])) statement) the following code:
Code:
// else was added for shopper group select
else {
$q  = "UPDATE #__{vm}_shopper_vendor_xref SET ";
$q .= "shopper_group_id='". $d['vm_selectshoppergroup'] ."'";
$q .= "WHERE ";
$q .= "user_id='". $user_id ."'";
$db->query($q) or die(mysql_error());
}

5) Save the file.


Next I modified the ps_userfield.php file:

6) open ps_userfield.php

find the following line, for me it was 494.
Code:
$rowFieldValues['lst_'.$field->name] = vmCommonHTML::selectList( $Values, $field->name."[]",

and change it to
Code:
$rowFieldValues['lst_'.$field->name] = vmCommonHTML::selectList( $Values, $field->name."",


7) open your ftp program and make a backup of your current ps_shopper.php AND ps_userfield.php files

8 ) upload the ps_shopper.php and ps_userfield.php files that you just modified.


Finally, I created a shopper group select userfield:

9) login to your joomla admin backend and go to virtuemart.

10) on the left under 'administration' click on manager user fields

11) add a new user field:
  • !IMPORTANT - Type: Drop Down (single select)
  • !IMPORTANT - Name: vm_selectshoppergroup
  • all other variables can be set how you need.
  • at the bottom your values should be set up as the title is whatever you want the user to see and the value is the shopper_group_id.  If you don't know the shopper group id, then on the left click on 'shopper' and 'list shopper groups'  click on a shopper group and look in the url, you will see shopper_group_id=.  Take that number and that's your shopper group id
  • add however many titles and values (shopper group id's) that you need

example setup:
  • Type: Drop Down (Single Select)
  • Name: vm_selectshoppergroup
  • Title: Are you a wholesaler of us?
  • Required: Yes
  • All other variables are defaults
  • Values
    • Title: No     Value: 5
    • Title: Yes    Value: 6

12) Save the new field and test it out.

Again, I make no warranty that this is perfect, but it is what worked for me. This forum has helped me an absolute ton, so I hope this helps someone else.

Edit:
Also, your users can modify this setting in their account if you have "show in account maintenance?" set to yes. If they change this in their account it WILL update their shopper group.

I have searched for 2 days for this problem.
Thanks your reply, but even if I did everything step by step I didnt work on me..
Anybody became success with this codes?

Please figure out this..
Logged
Tim ceko
Newbie
*
Posts: 17


« Reply #14 on: January 17, 2011, 18:02:10 PM »

If you're using the same joomla version and virtuemart version that i posted, then you should have no problem using this setup.  I literally typed it as I went through the steps.
Logged
Pages: [1] 2   Go Up
Print
Jump to: