Group Problems


  • Default avatar
    marilene    
     8 years ago
    0

    Hi to all.

    we have a little problems with promotions in Awo Rewards in virtuemart customer groups, I explain you

    we have all promotions facebook x 2 (like and post) and twitter (follow and twit us)

    we have this promotion assigned in diferent groups, in rules and in awo coupons customer groups. 2 ways.

    see: http://awesomescreenshot.com/0a65llei80 only for 2 groups, no customer 1 and register.

    like facebook and follow us in customer group 1 (+ 5 products bought), every action wins 2 €

    post facebook and twit us in customer group 2 (+ 10 products bought), every action wins 4 €

    but in front end, the customer for example group 1 see the promotions of group 2, it´s posible that the customer from group 1 make a promotions of group 2, but not get the points - coupons but it is possible to make the actions of the group 2 that is not theirs groups and everything is published on facebook and twitter as if the couldn´t get points or coupons.

    how is posible to the customer groups only see their promotions assigned by groups?

    we have VM Shopper Group Changer from Daycounts, every time that the customer bought some more quantity producst the system change their gropus.

    We need only promotions to be visible to the Group of clients that we have assigned to it in the Rules and awo coupons, but here all the promotions it´s posible to see for all the groups, it´s posible to make for all the groups but they don't earn points because they belong to another group.

    please infor me

    we need asap response our customer is waiting

    THANKS SOO MUCH IN ADVANCED

    Jose Navarro



  • Your avatar
    seyi    
     8 years ago
    0

    Hello,

    In
    www/administrator/components/com_aworewards/helpers/helper.php, around line 570 is this:
    <?php
            $rows 
    $db->loadObjectList();
    ?>


    Change it to this:
    <?php
            $rows 
    $db->loadObjectList('id');
    ?>


    Then around line 583 is this:
    <?php
            
    return $rows;
    ?>


    Right before that add this
    <?php
            
    # limit based on shopper group
                
    if(!empty($rows)) {
                    
    $db->setQuery('SELECT rule_id,asset_id FROM #__aworewards_rule_asset WHERE asset_type="usergroup" AND rule_id IN ('.implode(',',array_keys($rows)).')');
                    
    $tmps $db->loadObjectList();
                    
    $social_groups = array();
                    foreach(
    $tmps as $tmp) {
                        if(!isset(
    $social_groups[$tmp->rule_id])) $social_groups[$tmp->rule_id] = array();
                        
    $social_groups[$tmp->rule_id][] = $tmp->asset_id;
                    }
                    
                    
    $user JFactory::getUser();
                    if(empty(
    $user->id)) $user_groups = array(1);
                    else {
                        
    $db->setQuery('SELECT virtuemart_shoppergroup_id FROM #__virtuemart_vmuser_shoppergroups WHERE virtuemart_user_id='.(int)$user->id);
                        
    $user_groups version_compareJVERSION'2.5.0''ge' ) ? $db->loadColumn() : $db->loadResultArray();
                        if(empty(
    $user_groups)) {
                            
    $db->setQuery('SELECT virtuemart_shoppergroup_id FROM #__virtuemart_shoppergroups WHERE published=1 AND `default`=1');
                            
    $user_groups = array($db->loadResult());
                        }
                    }
            
                    foreach(
    $social_groups as $social_id=>$social_group) {
                        
    $check array_intersect($user_groups,$social_group);
                        if(empty(
    $check)) unset($rows[$social_id]);
                    }
                }
            }
    ?>


    That should fix the problem.