I want to add the product image to bundle product page for each option. I chose to extend class \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option\Checkbox
This class has no __construct method, but I have to use it because I want to use \Magento\Catalog\Helper\Image. When I define a construct method, the page crashes and throws an error Call to a member function dispatch() on null
If I call parent::__construct, I receive a type error indicating the __construct methods do not match.
I have read that if the parent class does not have a __construct class, that I do not have to call parent, but in my case I cannot get this simple modification to work.
class Checkbox extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option\Checkbox {
public function __construct(
\Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry,
\Magento\Catalog\Helper\Image $imageHelper
){
$this->_stockRegistry = $stockRegistry;
$this->_imageHelper = $imageHelper;
}