I'm trying to find the best way to modify products collection for products grid in admin. In particular, to add additional filter to the collection. I don't want to override the grid's block to achieve that. Looks like I'm stuck and cant find a point to start using DI in this case. Also, I can't find any event for loading grid collection as it was in Magento 1.x If someone has experience in this I would be very appreciate for any info.
-
I'm not sure we're really there in terms of separation of concerns, but Magento2 is so different from Magento1 that I feel a need to separate the two entirely. Questions, inquiries... whatever - it all belongs somewhere else as this is an entirely different beast– Reid BlomquistCommented Mar 15, 2015 at 10:18
-
P.s. I raised the concern here: meta.magento.stackexchange.com/questions/541/… feel free to chime in if you want!– Reid BlomquistCommented Mar 15, 2015 at 10:21
-
2@ReidBlomquist it clearly says Magento 2 questions are allowed.– mbalpardaCommented Mar 15, 2015 at 16:15
-
My fault; didn't realize this was the case!– Reid BlomquistCommented Mar 16, 2015 at 15:29
Add a comment
|
1 Answer
The easiest way is to create "before" plugin for Magento\Catalog\Block\Adminhtml\Product\Grid::setCollection
and make with collection all that you want.
-
Yeah, found the same solution. Anyway, thanks for the advice. Commented Mar 24, 2015 at 7:51