Magento interview questions and answers 👇
Magento Interview Questions
How do you create a custom module in Magento?↑
How can you improve the performance of Magento?↑
You can do the following to improve performance:
- Disable the Magento log
- Disable all modules that you don’t use on the website
- MySQL Query Caching
- Optimize the image on the website
- Enable Gzip Compression
- Combine the external CSS/JS into a single file
- Use a Content Delivery Network (CDN)
- Enable Magento Caching
What design patterns does Magento support?↑
Magento 2 is equipped with design patterns such as:
- Front Controller
- Object Pool
- Lazy Loading
- Service Locator
- Active Record
- Service Contract
- Object Manager
- Injectable Objects
- Non-injectable Objects
- Dependency Injection
- Factory Pattern or Factory Classes
- Proxy Pattern
What is EAV?↑
Entry, Attribute, Value model (EAV) is also known as object - attribute - value or Open Schema. It is a database or catalog management system that is used in Magento.
EAV is designed for databases where a large number of attributes identify a given entity; however, not all of these attributes are applicable to that entity.
What is the difference between a cache:clean and cache:flush?↑
Cache clean does not delete the items which are stored in the cache without proper tags. flush the cache if the cache clean does not reflect the changes at the frontend. Flush cache rubs out every item from the same cache storage.
What is dependency injection?↑
Dependency injection is a design pattern strategy that relegates the responsibility of injecting the right dependency to the calling module or framework.
The responsibility of calling the right dependency is no longer handled by the function and respects the SOLID principle.
Dependency injection makes code
- Easy to test
- Easy to re-use
- Easy to maintain
How would you make Magento more secure for clients?↑
You can do the following for security enhancement:
- Create a complex password and change them from time to time
- Do not allow remote access to Magento content manager
- Do not provide downloadable media on production sites
- Install security extension for Magento website
What are the top features of Magento?↑
The top features of Magento platform are:
- Analytics and Reporting
- Product Browsing
- Catalog Management
- Customer Accounts
- Order Management
- Payment & Shipping
- Search Engine Optimization
- Marketing and Promotional Tools
- Site Management
- Mobile Commerce
What are the limitations of Magento?↑
These are the limitations of Magento:
- It is slower in performance as compare to other frameworks
- It consumes more space in the memory. It can consume gigabytes of RAM during heavy processes.
- In the absence of Object oriented programming, it can become complex.
Compare EAV and flat model.↑
EAV database model is fully in normalized form. Each column's value is stored in their respective data type table which makes it more complex as they have to join 5-6 tables even if you need only one detail. In EAV, columns are called attributes.
Flat model uses just one table. It is not normalized and uses more database space. It is not good for dynamic requirements where you may have to add more columns in future. The performance is fast as it needs only one query instead of joining 5-6 tables. In flat model, columns are called fields.
What is ORM?↑
ORM stands for Object Relational Mapping. It is a programming technique used to convert different types of data into objects and vice versa.
What are handles in Magento?↑
Handles control the structure of the page to be displayed. They decide which block will be placed where in the page. Handle is called for every page and every page request can have several unique handles.
What is the compilation feature in Magento?↑
Compilation feature allows us to compile all Magento files to create a single include path to increase performance.
How to change Magento core API setting?↑
You can do the following to change Magento core API setting:
- Go to Admin menu, choose System -> Configuration
- Select Magento Core API on the left side of the Configuration Panel, under Services
- Click on to expand the General Settings section
- Type name of the Default Response Charset that you want to use
- Determine the Client Session Timeout in seconds
- Click the Save Config button when completed
What is codePool?↑
codePool is a tag which you have to specify when registering new module in app/etc/modules/Company_Module.xml. codePool helps Magento to locate module inside app/code/ for processing.
There are 3 codePools in Magento: core, community and local, which reside at app/code/ directory.
Core codePool is used by Magento core team, Community is generally used by 3rd party extensions and Local codePool should be used for in-hour module development and overriding of core and community modules for custom requirement.
When catalog_product_flat_data is running, what are the consequences for the store?↑
When flat catalog indexing is running, the data is retrieved through EAV. Therefore performance is slowed down by both the indexing process and overhead due to EAV retrieval. The information from the products is still correct.
What is a factory class?↑
Factory classes are generated when code generation happens. They are created automatically for models that represent database entities.
Factory classes are used to create, get, or change entity records without using the ObjectManager directly, as direct usage is discouraged by Magento (it goes against the principles of dependency injection)
These classes do not need to be manually defined, but they can be, in case you need to define a specific behavior.