I want to join the sales order collection and sales order item collection
How to join the two collection
I have collections like
order collection
> $ordercollection=$this->orderCollection->create();
Item collection
> $orderDatamodel = $this->itemFactory->create()->getCollection()
> ->addAttributeToFilter('created_at', array('from'=>$fromDate, 'to'=>$toDate));
I want to join these two collections.
How could i join these two?
Best Answer
You can join order collection and item collection as follows
use following namespaces like
write __construct function
Then get order collection
get Order table
Item collection
Write Join Query
I had left join on entity_id and order_id and added two columns from the order table you can add your own conditions and add columns you want.
thanks