我正在尝试提取第一季度的销售总额。我似乎无法让它发挥作用。有什么建议么?
$total = 0;
$orders = Mage::getModel('sales_order/collection')
->addAttributeToSelect('*')
->addAttributeToFilter('created_at', array(
'from' => '2012-01-01',
'to' => '2012-03-31'));
foreach ($orders as $order) {
$total += $order->getGrandTotal();
}
echo $total;