Friday, 15 April 2022

Magento 2 Interview Questions & Answers

 Magento2 Upgradation and Migration?

First we need to keep backup the whole db and code file by running this command 

php <magento_root>/bin/magento setup:backup --code --db

We have to download the data migration tool - composer require magento/data-migration-tool:2.1.2


Magento2 Optimisation?

- Steps to Optimize Performance

Enable Flat Categories and Products

Merge CSS and JS Files

Content Delivery Network

Caching

Image Optimization

Enable Compression

Reduce Server Response Time

Magento Updates

Update to the latest version of Magento.

Change Hosting Provider.

Audit Third-Party Extensions.

Use Lightweight Magento Themes.

Delete Unnecessary Fonts.

Optimize Images.

Use Next-Gen File Format.

Disable Flat Catalogs.


UI Components

- Magento Ui Components are used the represent the distinct UI, such as tables, buttons, dialogs, and others.

In Magento, there are 2 primary UI components

Listing Components

Form components 

Rest are secondary components 

All components can be configured in both Admin and Frontend.

XML declaration

JavaScript

Related template(s)



What are Proxies?

- In Magento is used to replace resource hungry classes. It will work on behalf of others. A proxy implements the same interface as the original class and so can be used as a dependency anywhere the original class can.


What is the source model, backend model?

-Source model - It is a Model class that serves the existing values. Which are already exist and store in a File, database.

- Backend Model - A class which is allow to operate with configuration data. _afterLoad(), _beforeSave() and _afterSave().


Steps to create API? Authentication Methods in API. resource types in Magento 2.

- In Magento, developers are allowed to define web API resources and their permissions in a configuration file called webapi.xml.

Administrator or Integration - admin 

Customer - anonymous or self

Guest user - anonymous

Magento 2 API Authentication

Token authentication

OAuth authentication

Session authentication


What is Extension Attributes?

They are used to extend functionality and often use more complex data types than custom attributes. These attributes do not appear in the Admin.

File name is extension_attributes.xml


Magento upgrade command?

php bin/magento setup:upgrade


Cache working mechanism?

Magento collects configuration from all modules, merges it, and saves the merged result to the cache. This cache also contains store-specific settings stored in the file system and database. Clean or flush this cache type after modifying configuration files


What is redis, working of redis?

Redis can also be used for PHP session storage, making it possible to completely replace memcached with Redis. The Redis backend works by indexing tags in files so that tag operations do not require a full scan of every cache file. Magento provides command line options to configure the Redis page and default caching. Although you can configure caching by editing the <Magento install dir>app/etc/env. php file


What is Indexer?

Indexing is the way Magento 2 converts refreshable data (products, categories, prices, etc.) to enhance the storefront performance. When you refresh the converted data it needs an update or Magento 2 to be reindex programmatically or manually.


 Virtual Type?

- Virtual Types are the classes that are instantiated by the ObjectManager but have no physical / concrete class located in /app/code or in /generated. Type adjusts existing classes, whereas Virtual Types creates a new class.


Magento 2 ways to Override core classes

- You have to put the path of the class override the target class in the "type" attribute and set sortOrder for you plugin. Magento 2 will run your plugin based on sortOrder. You can also use the preference.


How To Set and Configure Custom Cron Jobs In Magento 2?

Step 1: Create a sample module.

Step 2: Create a class to run cron.

Step 3: Create crontab. xml.

Step 4: Run the cron job.

Step 5: Create custom cron group.

Step 6 : Run the custom cron group.

bin/magento cron:run



No comments:

Post a Comment

Thanks for your comments.