我是magento的新手。这是我的代码:
<?php
$_orders = $this->getOrders();
foreach ($_orders as $_order){
var_dump($_order->getStatus());
}
?>
这让我觉得这样:
string(7) "pending" string(10) "processing" string(7) "pending" string(7) "pending" string(7) "pending" string(10) "processing" string(10) "processing" string(7) "pending" string(7) "pending" string(8) "complete"
但我希望得到所有&#34;完成&#34;物品。我怎么能这样做?
答案 0 :(得分:1)
尝试$order->getState()
$_orders = Mage::getModel('sales/order')->getCollection();
// to get all the completed order you could do
//$_orders->addFieldToFilter('state', Mage_Sales_Model_Order::STATE_COMPLETE);
foreach ($_orders as $_order){
var_dump($order->getState());
var_dump($_order->getData()); // return all field in sale_flat_order table
//$_order->getStatus() = $_order->getData('status') - return only the status field
}