Question

My understanding of Order States and Order Statuses are that a given Order State can have one or more allowed Statuses. I've found that I can retrieve a list of all Statuses in the system using:

Mage::getSingleton('sales/order_config')->getStatuses();

However I need the list to be limited to statuses valid for a given State.

Was it helpful?

Solution

It occurred to me that Magento does this when viewing an Order in the backend; specifically the "Comments History" box has a dropdown populated with allowed Statuses for the given state.

Looking into that block turned up this solution:

public function getStatuses()
{
    $state = $this->getOrder()->getState();
    $statuses = $this->getOrder()->getConfig()->getStateStatuses($state);
    return $statuses;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top