10 Essential Magento Interview Questions *

Toptal sourced essential questions that the best Magento developers and engineers can answer. Driven from our community, we encourage experts to submit questions and offer feedback.

Hire a Top Magento Developer Now
Toptal logois an exclusive network of the top freelance software developers, designers, finance experts, product managers, and project managers in the world. Top companies hire Toptal freelancers for their most important projects.

Interview Questions


In Magento 1, how can you change the behavior and extend Magento core functionality? If there are multiple ways, explain their differences and advantages/disadvantages.

View answer

There are three ways to override core functionalities:

  1. Monkey patches: Because Magento loads modules in a specific order, you can override the modules located in the core and community code pools by copying them into the local code pool. In that case, you will rewrite the whole class. This is the least preferred method.
  2. Rewrites: You can rewrite a function by specifying a class in your config file to rewrite an existing class. In this case, you can extend the parent class and rewrite only one function.
  3. Observers: Magento throws events when specific actions are done. If there is an event that is thrown before or after the action you want to interact with, you can intercept it and modify it. This is the preferred method.

What are the problems with the following code in a .phtml file:

$products = Mage::getModel('catalog_products')
->addFieldToFilter('price' ['>' => 100]);
<h1>Our products less than $100:</h1>
foreach ($products as $product) {
		echo '<li>' . $product->getName() . '</li>';
View answer

Loading a model in a template file is bad practice. The template should be for representational logic only. Respect the MVC architecture.

The title should be translated:

<h1><?php echo $this->__('Our products less than $100') ?> :</h1>

The attribute “name” is not selected:


The correct model name is catalog/product and not catalog_products.

The correct expression for addFieldToFilter is :

->addFieldToFilter('price', ['lt' => 100]);

Here is a corrected version:

Block class:

Class Toptal_Test_Block_Demo extends Mage_Catalog_Block_Product_Abstract {
    public function getProductsLessThan($price){
        return Mage::getModel('catalog/product')
                ->addFieldToFilter('price', ['lt' => $price]);

Template file:

<?php $price = 100 ?>
<h1><?php echo $this->__('Our products less than %s', Mage::helper('core')->currency($price , true, false)) ?> :</h1>
/** @var Mage_Catalog_Model_Product $product */
foreach ($this->getProductsLessThan($price) as $product) {
    echo '<li>' . $product->getName() . '</li>';

There are other issues related to visibility, output formatting, base currency, etc. that you should also be careful about.


When catalog_product_flat_data is running, what are the consequences for the store?

View answer

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.

Apply to Join Toptal's Development Network

and enjoy reliable, steady, remote Freelance Magento Developer Jobs

Apply as a Freelancer

In Magento 1, what should you do in order to change the CSS of your current theme?

View answer

The most important rule in Magento is “Do not edit the core.” Therefore, you should not edit the template core files either.

In order to change the current theme CSS, the fastest way is to add your custom CSS to the <head> of the generated HTML by using the layout update. Edit the local.xml file located in the layout folder of your theme.

If you want to change the template files and be able to easily reuse the theme, you can create your own theme.


In Magento 2, what are the different deploy modes and what are their differences?

View answer


In this mode, all the files in pub/static/ are symlinks to the original file. Exceptions are thrown and errors are displayed in the front end. This mode makes pages load very slowly, but makes it easier to debug, as it compiles and loads static files every time. Cache can still be enabled.


This default is enabled out-of-the-box. It is a state in between production and developer, as the files are generated when they are needed. I.e. CSS files are generated using several LESS files in several locations. These files will be generated only when they are needed by the front end, and will not be generated again the next time they are needed.


This mode should be enabled for all Magento 2 websites in production, as all the required files are generated and placed in the pub/static folder.


In Magento 2, what is dependency injection and what are its advantages?

View answer

Dependency injection is a design pattern strategy that relegates the responsibility of injecting the right dependency to the calling module or framework. This is the Hollywood Principle: “Don’t call us, we’ll call you.”

The responsibility of calling the right dependency is no longer handled by the function and respects the SOLID principle.

Its main advantages are that it makes code:

  1. Easier to test
  2. Easier to re-use
  3. Easier to maintain

What is the best way to count the items in a collection? Explain the differences with other method(s).

View answer

The best way is to use the method getSize(). This function will not load the collection each time to count the items but store it. So every time you need this value you will not have to recalculate it. Moreover, it uses the SQL COUNT() function in order to speed up the counting process. However, if the collection has been modified, this value can become inconsistent.

In contrast, the count() method will load the collection and count its items every time it is called. This can become very resource demanding.


What does EAV mean? What are the advantages and disadvantages of it, and how does Magento addresses the issues associated with it?

View answer

EAV stands for entity-attribute-value. It is the way customers, products, and address data are stored in Magento’s database. In order to retrieve information about a customer (entity), you will need to query three tables. For example, if you need to get the date of birth (attribute) of a customer (entity), you will need to retrieve the customer ID using its email address by querying the customer_entity table, the dob attribute ID in the eav_attribute table, and finally use both the entity ID and attribute ID in order to retrieve the date (value) in the customer_entity_datetime table.

While this makes it complicated to retrieve a value and requires multiple calls, it makes the system very flexible and allows the user to change the attributes, adding and removing them easily without having to modify the database schema.

In order to make data retrieval faster, Magento uses flat tables that are regenerated using indexes; it allows you to retrieve some values querying only this table.

The efficiency and usability of this model is debatable and is still a subject of great discussion between pro- and anti-EAV camps.


In Magento 2, what is a factory class and how does it work?

View answer

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 its direct usage is discouraged by Magento. (This is because 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.


What is the difference between a store and a website?

View answer

Some parameters are defined by a store and some are defined by a website:

Product settingsDefault, Store View
Product pricesDefault, Website
Product tax classDefault, Website
Base currencyDefault, Website
Display currencyDefault, Store view
System configuration settingsDefault, Website, and Store view
Root category configurationStore group
OrdersStore view
CustomersDefault, Website
Category settingsDefault, Store view

For example, if you need to define different base currencies, you will need two different websites.

There is more to interviewing than tricky technical questions, so these are intended merely as a guide. Not every “A” candidate worth hiring will be able to answer them all, nor does answering them all guarantee an “A” candidate. At the end of the day, hiring remains an art, a science — and a lot of work.

Why Toptal

Tired of interviewing candidates? Not sure what to ask to get you a top hire?

Let Toptal find the best people for you.

Hire a Top Magento Developer Now

Our Exclusive Network of Magento Developers

Looking to land a job as a Magento Developer?

Let Toptal find the right job for you.

Apply as a Magento Developer

Job Opportunities From Our Network

Submit an interview question

Submitted questions and answers are subject to review and editing, and may or may not be selected for posting, at the sole discretion of Toptal, LLC.

* All fields are required

Looking for Magento Developers?

Looking for Magento Developers? Check out Toptal’s Magento developers.

Adrian Bruce

Freelance Magento Developer
United KingdomToptal Member Since April 8, 2021

Adrian is a lead and senior developer with over 15 years of experience in all phases of the software development lifecycle (SDLC) and specializing in Magento eCommerce back-end development; he's an Adobe Certified Expert
 Magento Commerce Developer

. Adrian also excels at developing PHP applications and various services (including for the web), systems integration, agile project delivery, performance optimization, CI/CD, and the DevOps processes surrounding these technologies.

Show More

Laura Robson

Freelance Magento Developer
United KingdomToptal Member Since July 7, 2021

Laura is a web designer and developer with over a decade of experience designing, building, and maintaining websites. Having worked in multiple London digital agencies and software houses, Laura specializes in WordPress and Shopify but also works with bespoke systems. Hardworking and committed, Laura pays robust attention to detail focusing on mobile-first, responsive web design and a love for achieving UX and CRO results for clients.

Show More

François-Xavier Degroot

Freelance Magento Developer
FranceToptal Member Since June 10, 2020

François-Xavier has ten years of experience as a software developer in the eCommerce industry. He started his career in the Netherlands, working for a successful agency on several projects. Then after spending a few years in Switzerland, François-Xavier landed in Canada and held technical leadership positions in agencies and a leading video game company while working on international-scale eCommerce projects.

Show More

Toptal Connects the Top 3% of Freelance Talent All Over The World.

Join the Toptal community.

Learn more