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.

 

[BUG] checking shopper group in virtuemart does not work

[BUG] checking shopper group in virtuemart does not work

Hello,

I bought chameleon and configuring it (it is awesome!) but I have one issue. It seems like rule does not check shopping group in virtuemart - it always success (even if shopper group rule is not true).

The code for checking vm_shopper_group rule is missing in virtuemartrules.php.

Could you check it and fix it asap or suggest workaround? Thank you.

Best Regards
Artur

rvl
Beginner Modder
ranks
useravatar
Offline
6 Posts
Administrator has disabled public posting

Re: [BUG] checking shopper group in virtuemart does not work

I added at line 372

Code:


        // Shopper Group
        if (! plgChameleonVirtuemartrules::checkShopperGroup( $vm, $params, $debug )) {
            return plgChameleonVirtuemartrules::bail($params);
        }

and  checkShopperGroup function definition and the end:

Code:


static function checkShopperGroup( $vm, $params, $debug ) {
    if ( !$vm ) return false; // fail if no genius for vm. Shouldn't happen.

    $shopper_group_id = $params->get( 'vm_shopper_group' );
    if ( !is_array($shopper_group_id) or !count($shopper_group_id) ) return true; // nothing to check
   
    require_once(JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php');
    VmConfig::loadConfig();
    $usermodel = VmModel::getModel('user');
    $currentVMuser = $usermodel->getUser();
    $real_id = (array)$currentVMuser->shopper_groups;

    //$r = in_array( $real_id, $shopper_group_id ); // does not work
    $r = false;
    if ($real_id[0] == $shopper_group_id[0]) $r = true;

    if ( $debug ) {
        if ( $r ) cham_debug_prefix( JText::sprintf( 'VM shopper group id: shopper group id (%s) is in the include list - succeeding', $real_id[0] ) );
        else cham_debug_prefix( JText::sprintf( 'VM shopper group id: shopper group id (%s) is not in the include list - failing', $real_id[0] ) );
    }
    return $r;

}   

I compare only single shopper group (index 0 in array) -  it is now working for me but please fix this bug in next release.

rvl
Beginner Modder
ranks
useravatar
Offline
6 Posts
Administrator has disabled public posting

Re: [BUG] checking shopper group in virtuemart does not work

Hi Artur,

thanks so much for the bug report. This is now fixed (in a slightly different way to what you suggested, but that was useful thanks). It's now published as Chameleon 2.64 which you can download from your account.

Thanks,
Stephen

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
3312 Posts
User info in posts
Administrator has disabled public posting

Re: [BUG] checking shopper group in virtuemart does not work

I'm not php programmer and I spent some time to figure it out while you implemented checking shoppegroup in single line.. nice :-)
Thank you for fixing it.

rvl
Beginner Modder
ranks
useravatar
Offline
6 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5909
Posts this week:
1
User Info:
 
Total Users:
10112
Newest User:
chris28464
Members Online:
0
Guests Online:
161

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