How to fix the «Undefined index: amasty_ogrid_base_subtotal» error in the Amasty's «Extended Order Grid» module?

bug
bug-fix
third-party-extension
amasty
amasty-order-grid

(Dmitry Fedyuk) #1

Notice: Undefined index: amasty_ogrid_base_subtotal in vendor/magento/module-sales/Ui/Component/Listing/Column/Price.php on line 55

01


(Dmitry Fedyuk) #2

How to fix

Locate the method \Amasty\Ogrid\Plugin\OrderDataProvider::afterGetSearchResult().
Replace its last line from

return $collection;

to:

return $collection->clear();

Explanation

The method tries to modify an SQL (particularly, to add the amasty_ogrid_base_subtotal column to the SQL) for an already loaded collection, but Magento ignores it because the collection is already loaded and cached.
To apply a collection’s SQL modifications we need to call the clear() method on it.