I need to set the shoppergroup for guest users based on a region parameter (that they choose).
I thought that using the following inside a system plugin (onAfterDispatch) would work:
// Getting a registered user and piggy-backing on that. $user = JFactory::getUser(801); /** @var TableVmusers $vm_user */ $vm_user_model = new VirtueMartModelUser(); $vm_user = $vm_user_model->getUser(); $vm_user->JUser = $user; $region = JFactory::$application->input->get('region'); $vm_user->shopper_groups = [0 => $region];
But it doesn't seem to work.