News:

Support the VirtueMart project and become a member

Main Menu

How to get the shopper group of a user?

Started by newsomjk, June 20, 2013, 23:06:25 PM

Previous topic - Next topic

newsomjk

I can't figure out how to access the shopper group of a user. I tried print_r($user) and it has no reference to shopper group.

I've searched google for hours and the forum for hours, and the documentation, but none of it seems to answer this. At least as far as I found.

Any help would be much appreciated.

jenkinhill

The Shopper Group is displayed in domain/administrator/index.php?option=com_virtuemart&view=user
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

newsomjk

I meant in code, we have certain functions we want to run when a user of a specific shopper group buys specific items etc.
In virtuemart 1.5 we used
$_SESSION['auth']['shopper_group_id']

A print out of $_SESSION now shows this blurb " [_authGroups:protected] => Array (
  • => 1 [1] => 2 ) [_authLevels:protected] => Array (
  • => 1 [1] => 1 [2] => 2 )"
    In the Virtuemart -> Orders & Shoppers -> Shoppers tab, the account I was using for testing is listed as

    Group: shopper
    Shopper Group: Wholesale (which has an ID of 5)

    So I'm not sure how I can pull the user's shopper group? Unless I'm just supposed to do a sql query ?


newsomjk

Of course I would search shopper group with a space and not find it...

In that case something went wrong with my migration because I started working on some sql of my own but only the admin shows up in the #__virtuemart_vmuser_shoppergroups

Awesome.