Virtuemart Rewards exception


  • Default avatar
    sandro7    
     9 years ago
    0

    Hi,
    is there any way to configure awo rewards for NOT give points if user is on a special group? I have a shopper group with special prices and I dont wanna give points in this case.

    Thank you in advance.
  • Your avatar
    seyi    
     9 years ago
    0

    Hello,

    Currently no, there isn't. But that is a good idea, will add it to a list of items to look at. But if could update the code to get this to work. Assuming you are using virtumart,

    in www/administrator/components/com_aworewards/helpers/estore/estorerewardshandler.php, around line 934 is this
    <?php
        
    private function credit($_type,$sponsor,$recipient,$rule,$order=null) {
            
            
    $db JFactory::getDBO();
            
    $credit_user $_type=='everyone' $recipient : ${$_type};
            
    $referral_id = !empty($sponsor->rid) ? $sponsor->rid 'NULL';
            
    //if(empty($credit_user->id)) return;
            
    if(empty($credit_user->email)) return; // cannot use id because of guest checkouts
    ?>


    Right after that add this:
    <?php
            
    if(! $credit_user->is_guest) {
                
    $special_shopper_group_id 3;
                
    $sql 'SELECT virtuemart_shoppergroup_id FROM #__virtuemart_vmuser_shoppergroups WHERE virtuemart_user_id='.(int)$credit_user->id;
                
    $db->setQuery($sql);
                
    $shopper_group_ids $db->loadResultArray();
                if(empty(
    $shopper_group_ids)) {
                    
    $db->setQuery('SELECT virtuemart_shoppergroup_id FROM #__virtuemart_shoppergroups WHERE published=1 AND `default`=1');
                    
    $shopper_group_ids = array($db->loadResult());
                }
                if(
    in_array($special_shopper_group_id$shopper_group_ids)) return; // do not credit special shopper group
            
    }
    ?>


    You will have to set $special_shopper_group_id to the actual id of th eshopper group you want to exclude.

    And this would exclude user of shopper group id 3 from receiving any reward from any rules you have setup.