Skip to content

Commit

Permalink
Added cache to "order status" labels in Mage_Sales_Model_Order_Config (
Browse files Browse the repository at this point in the history
…OpenMage#3223)

Co-authored-by: Fabrizio Balliano <fabrizio.balliano@gmail.com>
  • Loading branch information
elidrissidev and fballiano authored May 4, 2023
1 parent b3ab6dd commit 6b683d7
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions app/code/core/Mage/Sales/Model/Order/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ class Mage_Sales_Model_Order_Config extends Mage_Core_Model_Config_Base
*/
protected $_stateStatuses;

/**
* Statuses array
*
* @var array
*/
protected $_statuses;

/**
* States array
*
Expand Down Expand Up @@ -84,9 +91,12 @@ public function getStateDefaultStatus($state)
*/
public function getStatusLabel($code)
{
$status = Mage::getModel('sales/order_status')
->load($code);
return $status->getStoreLabel();
$key = $code . '/' . Mage::app()->getStore()->getStoreId();
if (!isset($this->_statuses[$key])) {
$status = Mage::getModel('sales/order_status')->load($code);
$this->_statuses[$key] = $status->getStoreLabel();
}
return $this->_statuses[$key];
}

/**
Expand Down

0 comments on commit 6b683d7

Please sign in to comment.