Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

how to list orders incl. invoices no. in grid.php? 
 
magwian
Jr. Member
 
Total Posts:  1
Joined:  2008-09-22
 

Hi,

I want to list all orders inclusive the corresponding invoice no. in my own module grid in the admin section.
When I load in app/local/mylocation/Module/Block/Adminhtml/Module/Grid.php

protected function _prepareCollection()
  
{
$collection 
Mage::getResourceModel('sales/order_invoice_collection')
 ->
addAttributeToSelect('order_id')
 
// order no
 
->addAttributeToSelect('increment_id')
 
// invoice no
 
->joinAttribute('order_increment_id''order/increment_id''order_id'null'left');
$this->setCollection($collection);
I get a list of correct order no. -> invoice no. correlations, but only if an order HAS already a invoice no.
But I need EVERY order no. even if there is no invoice no.

When I try this:

protected function _prepareCollection()
  
{
$collection 
Mage::getResourceModel('sales/order_collection')
 ->
addAttributeToSelect('entity_id')
 
// order no
 
->addAttributeToSelect('increment_id')
 
// invoice no
 
->joinAttribute('order_increment_id''invoice/increment_id''entity_id'null'left');
$this->setCollection($collection);
I get nothing really functional…
I’m confused…

What joinAttribute do I have to use to get EVERY order with the correlating invoice no.?
Or what different getResourceModel(’sales/order_invoice_collection’) / getResourceModel(’sales/order_collection’) do I have to use to get access to all orders?

Thanks for help!
magwian

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top