Magento 2 – Constructor DI

Dependency Injections

Magento 2 framework heavily uses dependency injection pattern. Almost for each class you will see classes, interfaces passed as an argument in class constructor. It’s simple principle is if a class having dependencies then these should be available at the time class object is created. Below is example of constructor dependency injection in magento frontend …

Magento 2 – Constructor DI Read More »

Magento 2 – Javascript mixins

Javascript Mixins

Magento 2 comes with lots of out of the box functionality. Whet it comes to overriding a javascript component or extending a javascript component in magento 2, you need to use mixins. Below is the example of extend and override of magento 2 frontend validation javascript. Create a requirejs-config.js file in below directory structure. app/code/VendorName/ModuleName/view/frontend …

Magento 2 – Javascript mixins Read More »

Magento 2 – Core Registry Object

Core Registry Object

This is quick and useful standard object that’s used in magento 2 by constructor dependency injection method. It holds temporary information of objects, It’s not good practice using it storing collection. But small amount of data can be stored. Example: Featured product, current product for detail page, etc. Generally it’s used  in controllers , blocks …

Magento 2 – Core Registry Object Read More »