Bug #22873 Bug Fixed

MySQL error when using Grid with 2 content types on the same page and a modifier conditional

Version: 3.4.4 Reporter: Low

Consider this code:

{exp:low_variables:pair var="lv_grid"}
    {lv_grid:col1} : {lv_grid:col2}


{exp:channel:entries channel="services" limit="10"}
    {if service_grid:total_rows > 0}
        Has rows

This will trigger an error similar to this:

> SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘ee3-4.exp_low_variables_grid_field_40’ doesn’t exist: > SELECT * FROM (exp_low_variables_grid_field_40) WHERE entry_id IN (29598) ORDER BY row_order asc

…where the field_40 is the field ID for the LV grid field and 29598 is the Channel entry for the Services channel. As you can see, the EE parser is getting the two content types mixed up.

Changing the conditional to {if '{service_grid:total_rows}' > 0} solves the issue, but since the other syntax for conditionals is preferred, this should be considered a bug.

  • Thanks, Low. Looks like this should be a fairly simple fix. I’ve put a solution on the Solution tab above if you want to give it a try.

    Kevin Cupp
    11th January, 2017 at 1:56pm
  • Yeah, that fixes it. Thanks!

    11th January, 2017 at 2:16pm

You must be signed in to comment on a bug report.

  • Open system/ee/legacy/libraries/channel_entries_parser/Parser.php and find this code on line 531:

    ee()->api_channel_fields->apply('_init', array(array(
        'row' => $row,
        'content_id' => $row['entry_id']

    And REPLACE it with:

    ee()->api_channel_fields->apply('_init', array(array(
        'row' => $row,
        'content_id' => $row['entry_id'],
        'content_type' => 'channel'

ExpressionEngine News

#eecms, #events, #releases