How to load Model function in block in Magento 2 when overriding or extending a core block

In Magento 2, you should add a constructor with order factory: Continue Reading

In Magento 2, you should add a constructor with order factory: Continue Reading

In Magento 2, to check if customer is logged in, use the following code: Continue Reading

To create beautiful image upload in configuration of Magento 2, add the following code in system.xml: Continue Reading

To get most viewed products and bestsellers on homepage in Magento 2, create a block in __construct get instance of
\Magento\Sales\Model\ResourceModel\Report\Bestsellers\CollectionFactory $collectionFactory, Continue Reading

In Magento 2, they are situated in the vendor directory, while custom code is still in app/code/. All modules require composer.json, registration.php, as well as etc/modules.xml: Continue Reading

To use the new repo.mangento.com, enhance your auth.json file with the following code: Continue Reading

To set up a form popup-modal in Magento 2, use Magento_Ui/js/modal/modal widget as follows: Continue Reading

To load custom mini-libraries with short popular global functions in Magento 2, run the following code: Continue Reading

If you get the «There are no commands defined» failure while trying to execute a console command in Magento 2, you can easily fix it. The reason of this problem is probably an absence of an extension’s etc/module.xml file or an error in the same file. Continue Reading

To create an extension’s dropdown config option in Magento 2 check the core example: «Catalog» → «Storefront» → «List Mode». Continue Reading