The code below does not seem to filter the site names by customer_id. It still shows all sites names, i am not sure what i am doing wrong here.
// CUSTOMER SITE
$col = array();
$col[“title”] = “Site Name”;
$col[“name”] = “site_name”;
$col[“dbname”] = “store.customer_site_id”;
$str = $g->get_dropdown_values(“SELECT *, site_name as v, customer_site_id as k FROM tbl_customer_sites”);
$col[“width”] = “55”;
$col[“hidden”] = true;
$col[“editable”] = true;
$col[“stype”] = “select”;
$col[“edittype”] = “select”;
$col[“show”] = array(“list”=>true, “add”=>true, “edit”=>true, “view”=>false, “bulkedit”=>false);
$col[“editoptions”] = array(“value” => “:;” . $str);
$col[“editoptions”][“dataInit”][“sql”] = “SELECT customer_site_id AS k, site_name AS v FROM tbl_customer_sites WHERE sites_fk_customer_id IN ({customer_id})”;
$col[“export”] = false;
$col[“editrules”] = array(“required”=>true);
$cols[] = $col;
Thanks in advanced.
Tim
Please share complete code for review including select command query.
If you are using OR condition in query, make sure you enclose it in ( ) so it may not combine with other AND conditions.
https://gist.github.com/tmoore88/a5268f5e3429334d177a19af371b2574
The code above is the complete code
Thanks,
Tim