1

I tested all methods that I found that were reported here all about Magento 2.0, but seems like Magento 2.1 is different, how can I do that?

4

Here is an example of using the Magento\Catalog\Helper\Product helper class by using dependency injection,

private $productHelper;

public function __construct(
    \Magento\Catalog\Helper\Product $productHelper
){
    $this->productHelper = $productHelper;
}

public function myFunction()
{
    $this->productHelper->doSomething();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.