Question

i have 2 collections

1

Orders  
0   
date    "2019-07-05"
count   "2"
1   
date    "2019-06-20"
count   "2"
2   
date    "2019-06-18"
count   "2"
3   
date    "2019-06-17"
count   "2"
4   
date    "2019-06-14"
count   "1"  

2

Amount  
0   
date    "2019-07-05"
sum "6370.00000000"
1   
date    "2019-06-20"
sum "6491.00000000"
2   
date    "2019-06-18"
sum "4838.00000000"
3   
date    "2019-06-17"
sum "4838.00000000"
4   
date    "2019-06-14"
sum "1653.00000000"

In both collections looking date is Same . i want to sum index of second collection add in first collection and it make only one collection

how can do this . i tried $collection->addItem($collection2) it not work

No correct solution

OTHER TIPS

Collection it's just a flexible select query to some table in your DB. If you want to fetch some data or filter it - you may use methods like addFieldTofilter() You may also use custom sql SELECT with conditions like ( ... WHERE table1.data = table2.data) but it will be very controversial decision.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top