Skip to content

Commit 6b683d7

Browse files
Added cache to "order status" labels in Mage_Sales_Model_Order_Config (OpenMage#3223)
Co-authored-by: Fabrizio Balliano <[email protected]>
1 parent b3ab6dd commit 6b683d7

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

app/code/core/Mage/Sales/Model/Order/Config.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ class Mage_Sales_Model_Order_Config extends Mage_Core_Model_Config_Base
2828
*/
2929
protected $_stateStatuses;
3030

31+
/**
32+
* Statuses array
33+
*
34+
* @var array
35+
*/
36+
protected $_statuses;
37+
3138
/**
3239
* States array
3340
*
@@ -84,9 +91,12 @@ public function getStateDefaultStatus($state)
8491
*/
8592
public function getStatusLabel($code)
8693
{
87-
$status = Mage::getModel('sales/order_status')
88-
->load($code);
89-
return $status->getStoreLabel();
94+
$key = $code . '/' . Mage::app()->getStore()->getStoreId();
95+
if (!isset($this->_statuses[$key])) {
96+
$status = Mage::getModel('sales/order_status')->load($code);
97+
$this->_statuses[$key] = $status->getStoreLabel();
98+
}
99+
return $this->_statuses[$key];
90100
}
91101

92102
/**

0 commit comments

Comments
 (0)