From 99f0359cfdad975e7f28799268dbef7e619b258e Mon Sep 17 00:00:00 2001 From: Manuele Menozzi Date: Wed, 4 Aug 2021 10:10:36 +0200 Subject: [PATCH] Fix cancel pending orders loading If order is not fully loaded could result in unexpected behavior during cancel (especially involving third party observers on `order_cancel_after` event). Therefore, there is no reason to limit fields of collection because orders are on a flat table so the performance gain is negligible. --- src/app/code/community/Allopass/Hipay/Model/Observer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/code/community/Allopass/Hipay/Model/Observer.php b/src/app/code/community/Allopass/Hipay/Model/Observer.php index eae69554..181cf350 100755 --- a/src/app/code/community/Allopass/Hipay/Model/Observer.php +++ b/src/app/code/community/Allopass/Hipay/Model/Observer.php @@ -49,7 +49,7 @@ public function cancelOrdersInPending() } $collection = Mage::getResourceModel('sales/order_collection'); - $collection->addFieldToSelect(array('entity_id', 'increment_id', 'store_id', 'state')) + $collection ->addFieldToFilter('main_table.state', Mage_Sales_Model_Order::STATE_NEW) ->addFieldToFilter('op.method', array('eq' => $key)) ->addAttributeToFilter(