I am trying to populate a dropdown “filter” with a custom table but it does not seem to populate, details appear correct as i can populate the table via a CMP using the same packagename and classname with no issues. Is there something i am missing?
Step to reproduce
I have a custom table that works, as i can add. edit, remove from custom migx cmp as per screenshot below. Table does not have a different prefix, so it follows the structure of modx_ip_contenttypes
I have created a filter with type of combobox and using the getcombo processor and have filled in the classname and the packagename correctly as per screenshots below.
Is there an error message in the MODX error log?
Something like “SELECT list is not in GROUP BY clause and contains nonaggregated column …”?
One possibility why it fails, is that in MySQL the sql-mode ONLY_FULL_GROUP_BY is set. If you can’t change the configuration of your MySQL-server, then you’ll have to create a custom getcombo-processor:
Copy the file core/components/migx/processors/mgr/default/getcombo.php into the folder core/components/industrypro/processors/mgr/default.
Then change this line in the copied file
to this:
$c->select($idfield . ' as combo_id, ' . $textfield . ' as combo_name');
That worked like a charm, i did indeed have that error you mentioned, i can probably change that setting in MySQL right now in development but probably not if it exists in production on the clients server so probably best i have a fall back.
I have one issue that still remains. So now when i change the field, it is passing the name instead of the ID when i try to filter the content of my separate table.
I want it to pass the ID of the element under “contenttype” instead of the name it is currently doing.
I have set up this in the getlist-where, would this be correct.
the grid it is filtering has the column called “type” which will have the id of the content type in it.
I have resolved the issue by setting the SQL mode to Traditional in the core config. Below is some additional config i found on the Modx git that someone else had previously. Seems like a better approach so that even if i don’t have access to the SQL database directly i can edit it at the Modx level.
in core/config.php i added the following to the end of the file
P.S i have also reverted back to the original getcombo.php file without your changes as i was able to resolve it via the driver change in the config in case anyone else comes across the issue
This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.