Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Menu for vm shopper with 2 shopper groups attached

Menu for vm shopper with 2 shopper groups attached

Hi,
Using Joomla 2.5.14 - Template real copy of Beez20 , Virtuemart 2.0.26d - MetaMod 3.13b
We have 2 different shopper groups - shopper group 1(id 1) and shopper group 2 (id 2) - with different prices. We have 1 product that we only wants to be available to some of our shoppers from each shopper group so this product is only made availble to shopper group 3 (id 3) and then we have attached shopper group 3 to these shoppers so now some of our shopper have 2 shopper groups attached.  This is working fine in VM.
For showing this 1 product to our shoppers we have VM Product Builder from Break Design attached to a menu and it's this menu we want only to show if shopper has attached shopper group 1+3 or 2+3 - but I can't get it to work.
Have created a menu + modul - menu assignment and  module position is specified in MetaMod,  and I used this php code
$vm = JomGenius("virtuemart"); // need this at the start of every rule
/* for VM shopper group 6, use module XXX */
if ( $vm->check( "shopper_group = 3" ) ) return 118;
Is it possible ?

stensbo
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: Menu for vm shopper with 2 shopper groups attached

Do you think it will work if I buy MetaMod Pro version ?

stensbo
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: Menu for vm shopper with 2 shopper groups attached

If you find a solution for above problem with shopper assigned to more than one shopper groups I would appreciate to hear from you but I managed to solve my problem at the moment with
if ($user->id == xxx) return 118;
added for every user that we wants to show this menu to.

stensbo
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: Menu for vm shopper with 2 shopper groups attached

Hi stensbo,

just following up on this old post:

The code in JomGenius only detects 1 shopper group per person, as you have found out. However, if more than 1 is stored in the database for a given user, you can detect them this way:

$query = "SEL" . "ECT virtuemart_shoppergroup_id FROM #_" . "_virtuemart_vmuser_shoppergroups " .
   " WHERE virtuemart_user_id = '$id' order by virtuemart_shoppergroup_id";
$db->setQuery( $query );
$vals = $db->loadColumn();
if (count($vals) == 2 and $vals[0] == 1 and $vals[1] == 3) return 118;

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3313 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5910
Total Posts Today:
1
User Info:
 
Total Users:
10152
Newest User:
kasautiizindagiikay
Members Online:
0
Guests Online:
207

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked