Skip to content

Commit 98736d8

Browse files
elidrissidevfballiano
authored andcommitted
Clear hasDataChanges flag after loading collection items (#3000)
* Clear hasDataChanges flag after loading collection items * Prevent unnecessary save of order history collection items
1 parent 6b99024 commit 98736d8

File tree

2 files changed

+12
-3
lines changed
  • app/code/core/Mage/Sales/Model/Order/Status
  • lib/Varien/Data/Collection

2 files changed

+12
-3
lines changed

app/code/core/Mage/Sales/Model/Order/Status/History.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
* @method $this setParentId(int $value)
3939
* @method string getStatus()
4040
* @method $this setStatus(string $value)
41-
* @method $this setStoreId(int $value)
4241
* @method int getIsVisibleOnFront()
4342
* @method $this setIsVisibleOnFront(int $value)
4443
*/
@@ -69,18 +68,27 @@ protected function _construct()
6968
}
7069

7170
/**
72-
* Set order object and grab some metadata from it
71+
* Set order object
7372
*
7473
* @param Mage_Sales_Model_Order $order
7574
* @return $this
7675
*/
7776
public function setOrder(Mage_Sales_Model_Order $order)
7877
{
7978
$this->_order = $order;
80-
$this->setStoreId($order->getStoreId());
8179
return $this;
8280
}
8381

82+
/**
83+
* Get store id
84+
*
85+
* @throws Mage_Core_Model_Store_Exception
86+
*/
87+
public function getStoreId(): int
88+
{
89+
return $this->getStore()->getStoreId();
90+
}
91+
8492
/**
8593
* Notification flag
8694
*

lib/Varien/Data/Collection/Db.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,7 @@ public function load($printQuery = false, $logQuery = false)
587587
$item->setIdFieldName($this->getIdFieldName());
588588
}
589589
$item->addData($row);
590+
$item->setDataChanges(false);
590591
$this->addItem($item);
591592
}
592593
}

0 commit comments

Comments
 (0)