Jump to content

kesaven

Members
  • Posts

    37
  • Joined

  • Last visited

Community Answers

  1. kesaven's post in Get list of customers by groups was marked as the answer   
    Hello I have eventually found a solution to my problem:
     
    $exsql = '
    SELECT distinct c.id_customer
    FROM vs_customer c
    LEFT OUTER JOIN vs_customer_group g ON g.id_customer = c.id_customer
    INNER JOIN vs_group_lang l on l.id_group = g.id_group
    WHERE l.id_lang = 2
    AND 1 =1 ';

    $idds = explode(",", $_GET['ids']);
    foreach($idds as $idd)
    {
    $exsql = $exsql.' AND EXISTS (

    SELECT *
    FROM vs_customer
    LEFT OUTER JOIN vs_customer_group g ON g.id_customer = vs_customer.id_customer
    INNER JOIN vs_group_lang l on l.id_group = g.id_group
    WHERE 1 =1
    AND g.id_group ='.$idd.'
    AND vs_customer.id_customer = c.id_customer
    )
    ';
    }
    //echo $exsql;
    $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($exsql);
    $num_rows = mysql_num_rows($result);
    }
    else
    {
    $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT distinct * FROM vs_customer c
    INNER JOIN vs_customer_group g ON g.id_customer = c.id_customer
    INNER JOIN vs_group_lang l on l.id_group = g.id_group WHERE id_lang = 2 ');

    $num_rows = mysql_num_rows($result);
    }
×
×
  • Create New...

Important Information

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