How to fix Magento 2 CSP Warnings

What is CSP full form and what does it do ? CSP full form is Content Security Policies (CSP) and here in this article, we will learn how to fix Magento 2 CSP warnings using a custom module. It is a powerful tool to mitigate against Cross Site Scripting (XSS) and related attacks, including card …

RequireJS configuration with mixins, map, paths, etc in Magento2

RequireJS is a JavaScript file and module loader. It enables asynchronous JavaScript loading(JavaScript to load in the background). In Magento 2, we have requirejs-config.js file with a single root object config which contains the configuration options. These configuration settings are optional and are used only when required. Here is an example of requirejs-config.js with all the options : We …

Different Modes in Magento 2

One major change that differentiate Magento 2 from Magento 1 is the introduction of development Modes.  What are Magento modes? In Magento there are three modes of operation for deployment in a development or production environment:  Default, Developer and Production modes. The fastest one is production and recommed to run a live magento website in this mode . Default and Developer modes …

How to pass PHP variables from phtml files to RequireJs in Magento 2?

In Magento 2, we can use Declarative notation to pass dynamic PHP values to RequireJs from template files. Magento templates support <script type=”text/x-magento-init”> … </script> tag to fulfill this requirement. First, create a module e.g. Webiins_ExitPopup and add a file exitpopup.phtml at location app/code/Webiins/ExitPopup/view/frontend/templates to add declarative notation: We can access these parameters in app/code/Webiins/ExitPopup/view/frontend/web/js/exitpopup.js …

Architectural layers in Magento 2

Magento is layered software. Layered application design offers many advantages such as separation of business logic from presentation logic to simplify the customization process. Magento 2 Architecture is divided into the following layers: Presentation layer Service layer Domain layer Persistence layer Presentation Layer The presentation layer is the top layer of the four layers. It …