I have a custom block for my customer/dashboard page, and while everything works, I cannot use the following:
public function getOrders(){
$collection = Mage::getResourceModel('sales/order_collection')
->addFieldToSelect('*')
->addFieldToFilter('customer_id', Mage::getSingleton('customer/session')->getCustomer()->getId())
->setOrder('created_at', 'desc')
;
return $collection;
}
I get a blank page if I access this method. I want to load orders and display them on my dashboard. I took this query from the sales order Mage module.
Am I able to access resources from different modules?
Edit:
I limited it to return one order, but no dice.
$collection = Mage::getResourceModel('sales/order_collection')
->addFieldToSelect('*')
->addFieldToFilter('customer_id', Mage::getSingleton('customer/session')->getCustomer()->getId())
->setOrder('created_at', 'desc')
->setPageSize(1)
->setCurPage(1);
Above code is working there is no problem in code,
Now you need to check is you are getting customer id from
If you are getting customer id then error is in other code of you file or another file. It may have syntax error.