From 5495a679cad9a99169a4cf9414474bd25ab09fd9 Mon Sep 17 00:00:00 2001 From: Mohamed ELIDRISSI <67818913+elidrissidev@users.noreply.github.com> Date: Fri, 27 Jan 2023 21:00:12 +0100 Subject: [PATCH 1/2] Clear hasDataChanges flag after loading collection items --- lib/Varien/Data/Collection/Db.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Varien/Data/Collection/Db.php b/lib/Varien/Data/Collection/Db.php index 147f25ca3d0..ff85dcaadab 100644 --- a/lib/Varien/Data/Collection/Db.php +++ b/lib/Varien/Data/Collection/Db.php @@ -587,6 +587,7 @@ public function load($printQuery = false, $logQuery = false) $item->setIdFieldName($this->getIdFieldName()); } $item->addData($row); + $item->setDataChanges(false); $this->addItem($item); } } From 0b3f0d6d66304aded7b7f20d5c82c2e3fb96a8a1 Mon Sep 17 00:00:00 2001 From: Mohamed ELIDRISSI <67818913+elidrissidev@users.noreply.github.com> Date: Fri, 27 Jan 2023 21:24:35 +0100 Subject: [PATCH 2/2] Prevent unnecessary save of order history collection items --- .../core/Mage/Sales/Model/Order/Status/History.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/code/core/Mage/Sales/Model/Order/Status/History.php b/app/code/core/Mage/Sales/Model/Order/Status/History.php index b257de30d86..8171e0aea6f 100644 --- a/app/code/core/Mage/Sales/Model/Order/Status/History.php +++ b/app/code/core/Mage/Sales/Model/Order/Status/History.php @@ -38,7 +38,6 @@ * @method $this setParentId(int $value) * @method string getStatus() * @method $this setStatus(string $value) - * @method $this setStoreId(int $value) * @method int getIsVisibleOnFront() * @method $this setIsVisibleOnFront(int $value) */ @@ -69,7 +68,7 @@ protected function _construct() } /** - * Set order object and grab some metadata from it + * Set order object * * @param Mage_Sales_Model_Order $order * @return $this @@ -77,10 +76,19 @@ protected function _construct() public function setOrder(Mage_Sales_Model_Order $order) { $this->_order = $order; - $this->setStoreId($order->getStoreId()); return $this; } + /** + * Get store id + * + * @throws Mage_Core_Model_Store_Exception + */ + public function getStoreId(): int + { + return $this->getStore()->getStoreId(); + } + /** * Notification flag *