Jump to content

The problem with adding the group name in the admin panel is customers - >Customers


BATIATARI
 Share

Recommended Posts

 
 
Hello everybody!
I'm trying to bring a group name from gproup_lang for each client

but I can not(((

HELP ME PLEASE!

I add this code to AdminCustonerController.php
 
 
        /*START*/
        /*This code for show group name*/
        
        $this->context = Context::getContext();

        $this->default_form_language = $this->context->language->id;
$groups = Group::getGroups($this->context->language->id);
    foreach ($groups as $group)
        $this->groups_array[$group['id_group']] = $group['name'];
        $titles_array = array();
        
        $genders = array();
    $genders_icon = array();

        
    $this->_select = '
    a.date_add,
    IF (YEAR(birthday) = 0, "-", (YEAR(CURRENT_DATE)-YEAR(birthday)) - (RIGHT(CURRENT_DATE, 5) < RIGHT(birthday, 5))) AS age, (
        SELECT c.date_add FROM '._DB_PREFIX_.'guest g
        LEFT JOIN '._DB_PREFIX_.'connections c ON c.id_guest = g.id_guest
        WHERE g.id_customer = a.id_customer
        ORDER BY c.date_add DESC
        LIMIT 1
    ) as connect,
    gl.name as customer_group';
    $this->_join = 'LEFT JOIN '._DB_PREFIX_.'group_lang gl ON (gl.id_group = a.id_default_group AND gl.id_lang = '.(int)$this->context->language->id.')';

                
        /*FINISH*/
 
 
    $this->fields_list = array_merge($this->fields_list, array(
            
/*  START */
'customer_group' => array(
        'title' => $this->l('Group'),
        'width' => 80,
        'align' => 'left',
        'type' => 'select',
        'list' => $this->groups_array,
        'filter_key' => 'gl!id_group'
    ),
    'active' => array(
        'title' => $this->l('Enabled'),
        'width' => 70,
        'align' => 'center',
        'active' => 'status',
        'type' => 'bool',
        'orderby' => true,
        'filter_key' => 'a!active',
    ),
            
    /*  FINISH */       

................

and this error in the admin pannel Unknown column 'gl.id_group' in 'field list'

 

but this work

........

$this->_join = 'LEFT JOIN '._DB_PREFIX_.'gender_lang gl ON (a.id_gender = gl.id_gender AND gl.id_lang = '.(int)$this->context->language->id.')';

.........
 

Share this post


Link to post
Share on other sites

  • 4 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More