All Questions
Tagged with extend dependency-injection
4 questions
0
votes
2
answers
154
views
Magento 2 - Incompatible argument type, even though constructor parent call matches extended class
I try to extend this class from my own module, because I need to inject another dependency to the constructor and add a few new methods:
vendor\aheadworks\module-wbtab\Block\Wbtab\ProductList.php
...
1
vote
2
answers
3k
views
Adding custom method to product collection
What is the best way to add some method to for example product collection?
I would like to add method which can be called on loaded collection (in fact it will be a filtering one for products that ...
1
vote
1
answer
1k
views
Extending a block in Magento 2
I'm trying to extend Magento\Catalog\Block\Product\View to add some functionalities. I have let PHPStorm generate the constructor method for me and that worked fine.
public function __construct(
...
16
votes
1
answer
11k
views
DI & Extending a Block on Magento 2
I seem to be struggling to grasp Magento 2 dependency injection with blocks, every time I try to extend a block that isn't \Magento\Framework\View\Element\Template I end up with errors.
I want to ...