Skip to content

Bug: BUNDLE-3357_4.6.1.patch breaks sales orders purchase date filters by doing a double SQL alias #155

@Kirill-Katz

Description

@Kirill-Katz

Problem

After applying BUNDLE-3357_4.6.1.patch, the sales order grid date filter stops working.

The patch introduces the following logic:
$wherePart[$key] = str_replace("`created_at`", "`main_table`.`created_at`", $condition);

Magento already prefixes grid columns with main_table, so this replacement produces:
main_table.main_table.created_at which results in invalid SQL.

Error

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'main_table.main_table.created_at' in 'where clause'

Impact

Order grid purchase date filter is broken Admin UI fails to load results

Root cause

The patch blindly rewrites SQL strings instead of using addFilterToMap() or proper collection APIs.

Fix

In my case I disabled the Paypal module. Also, commenting this line:
$wherePart[$key] = str_replace("`created_at`", "`main_table`.`created_at`", $condition);
worked too, but it might have impacted other places, so this issue should be investigated properly.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions