Hi,
My client wants me to program a plugin that applies the guest user to different shopper groups based on language.
Example:
A user visits the site and my code detect from $_SERVER['HTTP_ACCEPT_LANGUAGE'] that the user has language "da" (Danish)
Then I need to update the VM session for the guest user with shopper group "Danish customer"
Another example:
A user visits the site and my code detect from $_SERVER['HTTP_ACCEPT_LANGUAGE'] that the user has language "sv" (Swedish)
Then I need to update the VM session for the guest user with shopper group "Swedish customer"
The question is, how do I programmatically set the Virtuemart shopper group in the session?
Is there a function I can use, and if I need to make a plugin what class must I extend in this case?
I have done some digging in various core files to locate any function that handle session for shopper groups, and it seems that the shopper group is not stored in session at all..
Is this correct?
(using Virtuemart v. 2.6)
No, there is a function
$shoppergroupmodel = VmModel::getModel('ShopperGroup');
$site = JFactory::getApplication ()->isSite ();
$shoppergroupmodel->appendShopperGroups($this->_shopperGroupId,$user,$site,$vendorId);
Any luck on finding a way to pro-grammatically set the shopper group?
how do you add the function