I have this piece of code:
public function getAllOpenOrders() {
$collection = Mage::getResourceModel('sales/order_item_collection');
$collection->getSelect()->join( array('orders'=> sales_flat_order), 'orders.entity_id = main_table.order_id', array('orders.status'));
$collection->addAttributeToFilter('orders.status',
array(
array('eq' => 'pending'),
array('eq' => 'processing'),
)
);
}
When I var_dump
the first object in a foreach
loop is see the object has the following data.
["status"]=> string(7) "pending"
But when I do echo $object->getStatus();
it returns a different value. It returns Ordered
when I echo and string(7) "Ordered"
when I var_dump
it.
What am I missing, or what am I doing wrong?
EDIT:
The foreach loop in my template file
<?php $orders = $this->getAllOpenOrders(); ?>
<?php foreach($orders as $order): ?>
<?php var_dump($order->getStatus()); ?>
<?php endforeach; ?>