VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: Agaton on October 03, 2019, 18:53:50 PM

Title: Displaying usergroup name
Post by: Agaton on October 03, 2019, 18:53:50 PM
Hi,

I am currently displaying quantity dependant pricing for various logged in user groups. I know how to display user name using $user->name. I am also able to obtain user group id for both vm and joomla.

How do I display usergroup/shopper group name without writing the query direct to the template override? Is this possible?

Thanks
Title: Re: Displaying usergroup name
Post by: Milbo on October 08, 2019, 21:14:17 PM
When you know the id it is quite simple



shoppergroup = VmModel::getModel('shoppergroup')->getShopperGroup(YourId)->shopper_group_name



It makes sense to store the model in a temp var.
Title: Re: Displaying usergroup name
Post by: Agaton on October 09, 2019, 11:07:55 AM
Thanks, that's the missing bit...
Title: Re: Displaying usergroup name
Post by: Agaton on October 09, 2019, 12:18:22 PM
Quote from: Milbo on October 08, 2019, 21:14:17 PM
When you know the id it is quite simple



shoppergroup = VmModel::getModel('shoppergroup')->getShopperGroup(YourId)->shopper_group_name



It makes sense to store the model in a temp var.

That worked perfectly thank you.... One more thing

What would I use to display the users company name in product details override... $user->name is obviously the users name, but what would I use for the company.