Magento is one of the best e-commerce solution. Here we have mentioned most frequently asked Magento Interview Questions and Answers specially for freshers and experienced.
Ans:
Magento is an e-commerce platform created on open source technology, which provides online merchants with an exceptional flexibility and control over the content, look and functionality of their e-commerce store.
Ans:
Magento architecture is a typical PHP MVC (Model-View-Controller)application, where all the Controllers will be in one folder and all theModels in another, etc. Based on their functionality files are grouped together, which are referred as modules in Magento.
Different version of Magento includes
Ans:
Magento use PHP as a web server scripting language and MySQL for database.
Ans:
Mage::getModel(): It always creates a new object
Mage: :getSingleton(): It always look for an existing object and if not then creates a new object
Ans:
Basic features of Magento includes
Ans:
Ans:
To enhance the Magento performance
Ans:
In the toolbar block you will see
app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php
there is a method:
Public function setCollection($collection);
Inside there is a piece of code:
$limit= (int)$this->get Limit();
If ($limit) {
$this ->_collection->setPageSize($limit);
}
You have to change variable $limit; you should override that block in the local pool, not change directly in the core. In order to see whether the customer is a guest, you can use this code
Mage:: getSingleton(‘customer/session’) -> isLoggedIn()
Ans:
From the client Magento account, you can do following things
Ans:
To change Magento Core API settings, you have to
Ans:
Best practices for Magento includes
Ans:
In Magento, applying connect patch
Ans:
To move Magento to other Directory you have to follow the following steps.
http://www.example.com/store/
http://www.example.com
/home/username/public_html/
Which means Magento would be installed here
/home/username/public_html/store/
System -> Configuration -> Web
cd public_html/
mv store/* store/.htaccess
Delete the cache data
rm –vf var/cache/
Now Magento is moved to another directory.
Ans:
You can reset Magento file & Directory to their default and secure permissions, by following commands from the directory where Magento is installed
find . –type f –exec chmod 644 {} \;
find . –type d –exec chmod 755 {} \;
chmod +x mage
Ans:
To do that, in the admin area, you have to change the Magento Base URL option. To do this, visit to your Magento admin area> System > Configuration and click Web on the left menu. Select the Unsecure option after that edit the base URL field to change the URL that will be used for normal (HTTP) connections.
Ans:
Magento is an ecommerce platform that enables companies to run and manage their ecommerce sites in an optimized way. Magento functions as an open source ecommerce management system. It was first published by a Varien Inc in 2008, before being sold to eBay and ultimately spun off into its own entity. The 2.0 version of Magento arrived in November of 2015 and has improved the platform across the board.
Ans:
Magento is valuable for businesses because it gives them a high level of control and flexibility when they are managing the look, functionality, and content of their ecommerce store. The Magento software is both extremely convenient, and extremely effective for running an ecommerce operation.
Further, it has a number of features that make operating an ecommerce site easier compared to other options. Many of these features revolve around how financial transactions are made, and how content can be uploaded and optimized for search engine rankings.
Ans:
Magento categorizes their product across multiple offerings:
Ans:
Ans:
MVC, or Model, View, Controller, is a type of architecture in which business logic, data access, and user interface are separated for applications. MVC has two different types: configuration-based and convention-based. However, Magento uses the configuration-based version. This means that to get a module’s config file to work, everything must be specified to it.
Ans:
Magento uses MySQL for database and PHP as a web server scripting language. Specifically, it uses MySQL 5.6 (Percona or Oracle), and PHP 5.4 and 5.5. This technology makes up the core of Magento and is what gives the software its functionality.
Ans:
The Magento software is extremely useful and is one of the top ecommerce platforms available on the market. However, it does require a lot of space and memory. Furthermore, it requires object oriented programming in order to prevent turning into a very complex system. Finally, Magento can be slow in terms of performance, at times. However, these limitations are usually not a significant concern in most cases, and the benefits provided by the Magento Software usually far outweigh any potential issues.
Ans:
In order to create a custom module in Magento, you must first – create a module directory, second – create controller, block, and module files for your module, third – create a module configuration file, and finally, fourth – create an XML file. The purpose of creating an XML file is so that you can enable or disable the module and also instruct the system which code pool that the module will be taken from.
Ans:
There are a number of things that you can do to enhance and improve Magento performance.
All of these things can speed up Magento and make it work better. This can be very helpful for both the ecommerce company, and for the customers of the company.
Ans:
All of the following things can be managed from the client account.
Considering the fact that Magento is an ecommerce platform it is absolutely critical that all of this billing information can be managed through the platform. This is why all of these things are able to be managed through Magento.
Ans:
Blogs are very important for helping to increase the search engine rankings for an ecommerce site. To add a blog to Magento, you have two options, you can use a prebuilt Magento blog extension, or you can create a custom blog module. If you are going to set up a free pre-built blog extension, then you will need to first download the extension. You can get them from Aheadworks. Next, you need to install the blog extension. After that, you need to configure it. If you are going to build a custom blog, then you will have to create a module for it.
Ans:
Magento has a total of 12 design patterns. These patterns include:
Ans:
If you make a new EAV module, then six tables will be created. These tables include:
module_datetime, module, module_decimal, module_int, module_text, and module_varchar.
Ans:
MVC stands for Model-View-Controller. Any application that separates it’s data access, business logic and user interface is called MVC. There can be two types of MVC: convention-based and configuration-based. Example, cakePHP is convention-based, i.e. you just need to follow the instructions of the core system to get your module ready in just few lines. Magento is configuration-based, i.e. you need to specify each and every thing to your module’s config file in order to get it work. Magento has controllers (for request/response routing), Block (for rendering content), Model (for business logic), Resource/Mysql4 (for database operations), etc (for module-specific configuration files), Helper (for common functions), sql (for setup scripts), layout (for connecting block with templates for each controller action) and template/.PHTML file (for Presentation i.e. View).
Ans:
Ans:
ORM stands for Object Relational Mapping. It’s a programming technique used to convert different types of data to Objects and vice versa.
In Magento, ORM is shown as Model (based on Zend Framework’s Zend_Db_Adapter), which further breaks down to two types of Models.
First is the “simple” i.e. Regular Models which is nothing but flat table or our regular table structure.
Second Model is EAV (Entity Attribute Value), which is quite complicated and expensive to query.
All Magento Models interacting with database are inherited from Mage_Core_Model_Abstract class, which is further inherited from Varien_Object.
Difference between two Models is, Simple Model is inherited from Mage_Core_Model_Resource_Db_Abstract class,
while EAV is inherited from Mage_Eav_Model_Entity_Abstract.
For those who don’t know what EAV is, please read my 3rd answer below.
So, to end up this question,
when you want to get some data in Magento, you call it like this:
Mage::getModel('module/model')->load(1);
where 1 is the primary key id for some Regular/Simple table, while in EAV so many tables are joined to fetch just single row of data.
Ans:
EAV, stands for Entity Attribute Value, is a technique which allows you to add unlimited columns to your table virtually. Means, the fields which is represented in “column” way in a regular table, is represented in a “row” (records) way in EAV. In EAV, you have one table which holds all the “attribute” (table field names) data, and other tables which hold the “entity” (id or primary id) and value (value for that id) against each attribute.
In Magento, there is one table to hold attribute values called eav_attribute and 5-6 tables which holds entity and data in fully normalized form,
– eav_entity, eav_entity_int (for holding Integer values),
– eav_entity_varchar (for holding Varchar values),
– eav_entity_datetime (for holding Datetime values),
– eav_entity_decimal (for holding Decimal/float values),
– eav_entity_text (for holding text (mysql Text type) values).
EAV is expensive and should only be used when you are not sure about number of fields in a table which can vary in future. To just get one single record, Magento joins 4-5 tables to get data in EAV. But this doesn’t mean that EAV only has drawbacks. The main advantage of EAV is when you may want to add table field in future, when there are thousands or millions of records already present in your table. In regular table, if you add table field with these amount of data, it will screw up your table, as for each empty row also some bytes will be allocated as per data type you select. While in EAV, adding the table column will not affect the previously saved records (also the extra space will not get allocated!) and all the new records will seamlessly have data in these columns without any problem.
Ans:
The difference between Mage:getSingleton() and Mage::getModel() is that the former one does not create an object if the object for same class is already created, while the later creates new objects every time for the class when it’s called.
Mage::getSingleton() uses the “singleton design pattern” of PHP. If the object is not created, it will create it.
Mage::getSingleton() is mostly used when you want to create an object once, modify it and later fetch from it. Popular example is session, you first create a session object, and then add/remove values from session across different pages, so that it retains your values (e.g. cart values, logged in customer details, etc.) and doesn’t create new session object losing your last changes.
Mage::getModel() is used when you want to have the fresh data from the database. Example is when you want to show records from database.
Ans:
$this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘blockidentifier’)->toHtml();
Ans:
codePool is a tag which you have to specify when registering new module in app/etc/modules/Company_Module.xml
There are 3 codePools in Magento: core, community and local, which are resided 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.
So in short, codePool helps Magento to locate module inside app/code/ for processing.
Ans:
When you have added/modified XML, JS, CSS file(s).
Ans:
In the Manage Attributes section of the custom attribute, select Visible on Product View Page on Front-end and Used in Product Listing to Yes.
Ans:
EAV is entity attribute value database model, where data is fully in normalized form. Each column data value is stored in their respective data type table. Example, for a product, product ID is stored in catalog_product_entity_int table, product name in catalog_product_entity_varchar, product price in catalog_product_entity_decimal, product created date in catalog_product_entity_datetime and product description in catalog_product_entity_text table. EAV is complex as it joins 5-6 tables even if you want to get just one product’s details. Columns are called attributes in EAV.
Flat model uses just one table, so it’s not normalized and uses more database space. It clears the EAV overhead, but not good for dynamic requirements where you may have to add more columns in database table in future. It’s good when comes to performance, as it will only require one query to load whole product instead of joining 5-6 tables to get just one product’s details. Columns are called fields in flat model.
Ans:
No
Ans:
After spending many hours in rewriting block and controller of Magento core module, I finally came up with a solution.
Here I am going to rewrite block: Mage/Adminhtml/Block/Sales/Shipment/Grid.php
and controller: Mage/Adminhtml/controllers/Sales/ShipmentController.php
First you will need to make a xml file for your new module at app/etc/modules directory
CompanyName_Adminhtml.xml
true
local
Then, make folders in your app/code/local directory as follows:
– CompanyName
-> Block
—> Sales
—-> Shipment
——> Grid.php
-> controllers
—> Sales
—-> ShipmentController.php
-> etc
—> config.xml
In ShipmentController.php, you should start like this:
require_once("Mage/Adminhtml/controllers/Sales/ShipmentController.php");
class CompanyName_Adminhtml_Sales_ShipmentController extends Mage_Adminhtml_Sales_ShipmentController
{
//controller methods goes here..
}
require_once is necessary as magento is not going to load controllers as it does for blocks and models
In block Grid.php, start the file like below:
class CompanyName_Adminhtml_Block_Sales_Shipment_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
// block methods goes here..
}
Ans:
Yes
Ans:
Joining tables in Magento when it comes to EAV with Flat table is quite complicated. Consider you want to join sales_flat_order table with customer EAV tables to get Customer’s firstname and lastname, it becomes difficult as customer’s name comes from customer_entity_varchar table.
Below code will join sales order flat table with customer EAV to get customer’s full name in the collection along with all the order details.
$coll = Mage::getModel('sales/order')->getCollection();
$fn = Mage::getModel(‘eav/entity_attribute’)->loadByCode(‘1’, ‘firstname’);
$ln = Mage::getModel(‘eav/entity_attribute’)->loadByCode(‘1’, ‘lastname’);
$coll->getSelect()
->join(array(‘ce1’ => ‘customer_entity_varchar’), ‘ce1.entity_id=main_table.customer_id’, array(‘firstname’ => ‘value’))
->where(‘ce1.attribute_id=’.$fn->getAttributeId())
->join(array(‘ce2’ => ‘customer_entity_varchar’), ‘ce2.entity_id=main_table.customer_id’, array(‘lastname’ => ‘value’))
->where(‘ce2.attribute_id=’.$ln->getAttributeId())
->columns(new Zend_Db_Expr(“CONCAT(`ce1`.`value`, ‘ ‘,`ce2`.`value`) AS fullname”));
print_r($coll->getData());
Ans:
If you want your Magento website to show in maintenance mode, you will have to do two things.
1. Create a file name maintenance.flag in your magento root directory. Contents under this file doesn’t matter, you can keep it empty.
2. Change the maintenance file (located in magento root -> errors -> default directory) to show proper message when user visits your website.
Ans:
Magento uses __call(), __get(), __set(), __uns(), __has(), __isset(), __toString(), __construct(), etc. magic methods. You can find more details inside class Varien_Object
Ans:
Magento creates 6 tables when you create new EAV module. Tables: module, module_datetime, module_decimal, module_int, module_text and module_varchar. one is the main entity table, and rest 5 tables which holds attribute’s data in different data types. So that integer values will go to module_int table, price values to module_decimal, etc.
Ans:
inside Model
Ans:
Customer sessions stores data related to customer, checkout session stores data related to quote and order. They are actuall under one session in an array. So firstname in customer/session will be $_SESSION[‘customer’][‘firstname’] and cart items count in checkout/session will be $_SESSION[‘checkout’][‘items_count’]. The reason Magento uses session types separately is because once the order gets placed, the checkout session data information should get flushed which can be easily done by just unsetting $_SESSION[‘checkout’] session variable. So that the session is not cleared, just session data containing checkout information is cleared and rest all the session types are still intact.
Ans:
Commonly used block types: core/template, page/html, page/html_head, page/html_header, page/template_links, core/text_list, page/html_wrapper, page/html_breadcrumbs, page/html_footer, core/messages, page/switch.
Some blocks like content, left, right etc. are of type core/text_list. When these blocks are rendered, all their child blocks are rendered automatically without the need to call getChildHtml() method.
Ans:
MAGENTO
Feb 25, 2013kalpesh2 Comments
Magento: Design Patterns
inShare
Factory:
It implement the concept of factories and deals with the problem of creating objects without specifying the exact class of object that will be created.
$product = Mage::getModel('catalog/product');
Singleton:
It restricts the instantiation of a class to one object. It will refer to same object each time called.
$category = Mage::getSingleton('catalog/session');
Registry:
It is a way to store information throughout your application.
Mage::register('key',$value); //stores
$currentCategory = Mage::registry('key'); //retrives
Prototype:
It determines the type of object to create. In Magento it can be Simple, Configurable, Grouped, Bundle, Downloadable or Virtual types.
Mage:getModel('catalog/product')->getTypeInstance();
Observer:
It is mainly used to implement distributed event handling systems. Here the subject maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods.
Mage::dispatchEvent('event_name', array('key'=>$value));
Class_Name
methodName
Object Pool:
It is used to reuse and share objects that are expensive to create.
$id = Mage::objects()->save($object);
$object = Mage::objects($id);
Iterator:
It is used to traverse a collection and access the collection’s items.
Mage::getModel('catalog/product')->getCollection();
Lazy Loading:
It is used to defer initialization of an object until the point at which it is needed.
$collection_of_products = Mage::getModel('catalog/product')
->getCollection();
Decorator:
It is used to extend or modify the behaviour of an object at runtime.
Helper:
Multiple methods are available for use by other objects. Here you can use core’s helper methods from anywhere in the application.
Mage::helper('core');
Service Locator:
Allows overrides or renamed physical resources (e.g. Classes, DB tables, etc)
Mage::getModel('catalog/product') and $installer->getTable('customer/address_entity');
Ans:
Tweak .htaccess for performance optimization in Magento. It will not sky rocket your website, but will show notable improvement. The default Magento .htaccess comes with performance optimization, but commented by default. I will show you here which lines to uncomment and improve the performance.
Compressing web pages with mod_deflate
The mod_deflate module allows the Apache2 web service to compress files and deliver them to browser that can handle them. With mod_deflate you can compress HTML, text or XML files by upto 70% of their original sizes! Thus, saving you server traffic and speeding up page loads.
Check your .htaccess file for below code, I have removed hashes before few lines to uncomment them for performance.
############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip
# Insert filter on all content
SetOutputFilter DEFLATE
# Insert filter on selected content types only
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
# Netscape 4.x has some problems…
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don’t compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don’t deliver the wrong content
Header append Vary User-Agent env=!dont-vary
Ans:
In the 2 tables:
catalog_product_relation
catalog_product_superlink_table
Ans:
$collection->printLogQuery(true); OR $collection->getSelect()->__toString();
Ans:
$collection->getFirstItem() and $collection->getLastItem();
Ans:
Magento is an open source E-commerce software, created by Varien which is useful for online business and it has the flexible modular architecture. It is scalable and it has many control options that helps the user. Magento uses E-commerce platform which offers companies ultimate E-commerce solutions and extensive support network.
Ans:
The uses of Magento are –
Ans:
The Web-Hosting sites of Magento are –
Ans:
The disadvantages of Magento are –
Ans:
The Web-server that supports Magento are –
Ans:
Products are the items or things that are sold in Magento. Product can be anything that is capable of satisfying customer needs. This includes both physical products and services.
Ans:
The product types available in Magento are –
Ans:
Inventory allows setting a product’s stock quantity. For instance, you have a product with 100 units in stock. If you set the stock availability to “Out of Stock” then it will force the item to be out of stock.
Ans:
The categories of E-Commerce are:
Ans:
Rate Percent specify the percent of the tax rate.
Ans:
Priority field specifies when the tax should be applied to other tax rules.
Ans:
The Zero Subtotal Checkout panel is a payment option that displays when order total is zero and not required to enter payment details for the customer.
Ans:
It is additional security functionality where customer needs to provide credit card password to complete the purchase order.
Ans:
The two methods of PayPal Payment Gateways are
Ans:
The Payflow Pro option is customizable payment gateway which can be used with merchant account to process credit card transactions.
Ans:
Payflow Link option often called as hosted payment gateway that keeps customer on your site by providing fast and easy way to add transaction processing to your site.
Ans:
My Cart Link panel specifies whether the number of quantities in the cart should be shown or whether the number of different products should be shown using the Display Cart Summaryfield.
Ans:
Google Checkout is online payment processing service provided by Google. Magento allows integration of online stores with Google checkout. It is like PayPal that simplifies the process of paying for online purchases.
Ans:
Order management is important thing which allows business to run smoothly and keeps customers happy, making them more likely to visit your site in the future.
Ans:
Google Analytics is a finest Google service for those who are actively managing websites and adds analytics to Magento store including Ecommerce tracking and conversions of their websites.
Ans:
Layout files are useful in rendering front pages of Magento.
Ans:
Magento CMS (Content Management System) section is used to manage all web site pages. It is a way of promoting the products by providing valuable information to the customers and increases visibility to search engines.
Ans:
Static block is a piece of content can be used anywhere in the pages. Magento allows creating blocks of content that can be used through the store and can be added to any page or another block.
Ans:
Polls are used to get customer’s opinions and preferences. The poll results appear immediately after response is submitted.
Ans:
Following points describe how to optimize the Magento environment
Ans:
The following points specify how to optimize the magento configuration
Ans:
The process of Code Optimization are
Ans:
The following points describe how to improve the performance of database
Ans:
PHP 5.4 +
Ans:
It stands for Web Services Description Language. It is used for describing web services and how to access them.
Ans:
It is used to set threshold number. When the units of that product are drop to that number, it will display Only X left message on the product details page.
Ans:
Payment gateway processes the credit card data securely between customer and merchant and also between merchant and the payment processor. It is like checkpoint that protects customers against attempting to gather personal and financial information from customers and also act as mediator between the merchant and sponsoring bank.
Ans:
Orders follow a standard life cycle process. When customer place product orders, it arrive in the administration interface with a pending status. When order is processed, the status of order changes according to current state in the processing workflow. Once the invoice is created for the order, the status changes from pending to processing status. Next it creates shipment for an order which changes the status from pending to complete status.
Ans:
The two sections present in Design section are
Ans:
The Page Layout section contains a Layout option which allows selecting layout as per your choice and Layout Update XML option inserts the XML code.
Ans:
The Meta Data section contains Keywords and description of the page.
Ans:
Customer can subscribe to Newsletters using Magento. Customer can sign up for the Newsletter when he creates a new customer account which contains checkbox for signing up. For creating Newsletters you need to enable Newsletter option in your magento to make sure that customer has confirmed to receive Newsletter.
Ans:
The following points show how to optimize the Magento front-end performance –
Ans:
This is a group of simple products. In this type, you cannot specify a specific price for product; you can just specify the discount.
Ans:
In this type, customer can select products according to their color and size before purchasing.
Example – Cell phones obtained in different colors and sizes.
Ans:
Bundled products are those products which cannot be sold separately and doesn’t give any choice for end user.
Ans:
If it is enabled, customer can buy products even if they are out of stock.
Ans:
Tax rules are entities that combine product tax classes, customer tax classes and tax rates.
Ans:
Manage Stores section, you will see website names, store names and Store View Name columns.
Ans:
E-commerce (Electronic Commerce) is a type of business that involves the commercial transaction or purchasing or selling of goods and services through electronic channels known as internet.
Ans:
The features of Magento are
Ans:
The advantages of magento are
Ans:
MySql Database
Ans:
MySQL 5.1
Ans:
This transaction is between consumer or customer and business or companies where consumer makes a product that the company uses to complete business.
Ans:
You can do that by overriding system.xml configuration.
In this software era doesn't matter you are working on php,java or .net, everywhere there…
Here we have mentioned most frequently asked IT Fresher Interview Questions and Answers specially for…
Here we have mentioned most frequently asked Github Interview Questions and Answers specially for freshers…
In this software era doesn't matter you are working on php,java or .net, everywhere there is demand frontend software (such…
Here we have mentioned most frequently asked IT Fresher Interview Questions and Answers specially for freshers and experienced. 1. What…
Here we have mentioned most frequently asked Github Interview Questions and Answers specially for freshers and experienced. 1. What is…
Here we have mentioned most frequently asked HTML5 Interview Questions and Answers specially for freshers and experienced. 1. What is…
Here we have mentioned most frequently asked Geography Interview Questions and Answers specially for freshers and experienced. 1. What is…
Here we have mentioned most frequently asked JSP Interview Questions and Answers specially for freshers and experienced. 1. Explain JSP…
This website uses cookies.