Magento interview questions and answers for experienced

1) what is EAV in Magento?

=> Entity Attribute Value this allows us to add unlimited columns or attributes

=> In EAV, we have one table which holds all the “attribute”

=> “column” way in a regular table, “row” (records) way in EAV. In EAV

– eav_entity_varchar

– eav_entity_datetime

– eav_entity_decimal

– eav_entity_text

=> EAV, adding the table column will not affect the previously saved records

2) How Magento’s MVC architecture works:

– Model, View and Controller

– MVC it two type convention-based and configuration-based

– Magento has Controller (for Routing),

Block (for Business Logic),

Model (for DB access, sql) and

Template file (for Presentation i.e. View).

– URL like http://www.pcds.co.in/frontname/controller/method/param1/value1/param2/value2),

this URL is intercepted by one PHP file called index.php

– Front Controller object, controller instantiates Router objects, Router is responsible to “match” the frontname which is in our URL

3) How Magento ORM works?

– Object Relational Mapping. It’s a programming technique used to convert different types of data to Objects and vice versa.

– ORM is shown as Model, two types of Models, 1-simple(regular table structure) 2-eav(4-5 tables)

– 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.

– Magento, you call it like this: Mage::getModel(‘module/model’)->load(1);

4) What are handles in magento (layout)?

– Handles are basically used for controlling the structure of the page like which block will be displayed and where.

– customer_logged_in handle is called only if customer is logged in

5) How to run custom MySql query in Magento ?

– $db = Mage::getSingleton(‘core/resource’)->getConnection(‘core_write’);

– $result=$db->query(“SELECT * FROM PCDSTable”);

6) What is the difference between Mage::getSingletone() andMage::getModel() in Magento

– Mage::getSingletone() always finds for an existing object if not then create that a newobject but Mage::getModel() always creates a new object.

7) The $this exposed to us is the block instance, as if we were inside a method of the object (We actually are! See Mage_Core_Block_Template::fetchView).

8) print vs echo

print has a return value of 1 so it can be used in expressions

whereas

echo has a void return type;

echo can take multiple parameters,

although such usage is rare; echo is slightly faster than print.

9) var_dump vs print_r

var_dump prints out a detailed dump of a variable,

including its type and the type of any sub-items (if it is an array or an object).

whereas

print_r prints a variable in a more human-readable form:

strings are not quoted, type information is omitted, array sizes aren’t given, etc.

var_dump is usually more useful than print_r when debugging.

It’s particularly useful when you don’t know exactly what values/types you have in your variables.

10) diff abstract-final class

We can create an instance of final class.

Final class can not contain abstract methods.

Final class can not be extended.

We can not create instance of abstract class.

We can not create direct object to Abstract class.

Abstract class may contains final methods.

Abstract class must be extended.

* What is Magento’s Compilation feature?

The Compilation feature of Magento will allow you to compile all files of a Magento installation in order to create a single include path to increase performance. The performance increase is between 25%-50% on page loads. In order to use this tool, the directory ‘includes’ and the file ‘includes/config.php’ must both be writable.

Important: Before you make any changes to your Magento installation you should always disable compilation. Once the changes are made, run the compilation process, and then enable it.

11) Magento product Type

Magento simple products

A Magento simple product is the most used product type for Magento webshops. This is because it’s the most general product type of them all. A Magento simple product should be used for a single item without any specific selectable variations. Think about a coffee cup, a chandelier, a table or whatever.

Magento grouped products

A Magento grouped product should be used for a combination of Magento simple products. Think about a coffee cup that is sold together with a saucer, a silver spoon, a breakfast plate or whatever. You can’t define a specific price for a Magento grouped product but you can define a discount amount.

Magento configurable products

A Magento configurable product should be used for a single item with specific selectable variations. Think about a coffee cup obtainable in different colours and sizes, a woman’s bag obtainable in different materials, a light boll obtainable in different watts or whatever. Each selectable variation can have its own additional costs.

Magento virtual products

A Magento virtual product should be used for a virtual (not touchable) item. Think about an insurance, a reservation, an extra product guarantee or whatever. A virtual product does not allow selecting a shipping method at checkout simply because there’s nothing to ship.

Magento bundle products

A Magento bundle product should be used for a bundle of simple (or virtual) products which are not to be sold separately. Think about a laptop where the customer can choose various items such as hard disk, processor, internal memory or whatever. Each of these items are simple (or virtual) products but can only be sold within the bundle product.

Magento downloadable products

A Magento downloadable product should be used for online software items. Think about an MP3 file, a PowerPoint presentation, a Magento extension or whatever. A downloadable product does not allow selecting a shipping method at checkout simply because there’s nothing to ship.

* Magento module structure

app/ 1) code 2) etc

code => local => Namespache => modulename =>

Block

controllers

etc

Helper

Model

sql

* Difference between /Controller and /controllers

The difference is in the autoloading, as you have mentioned. In general files that are in /Controller areAbstract (or parent) classes from which classes in /controllers inherit.

================================================

12) http://phppot.com/php/php-access-modifiers/

13) how to work get and set method in magento ??

http://codegento.com/2011/02/where-are-my-getters-and-setters/

14) recursion function

http://www.lornajane.net/posts/2012/php-recursive-function-example-factorial-numbers

16) variable swaping

<?php

$a = 5;
$b = 6;
list($a, $b) = array($b, $a);
print $a;
print $b;
?>

17) type of session in magento

customer/session, checkout/session, core/session

18) diff bit function and procedure

19) diff getmodel/getsingleton with syntax

20)autoloader in magento

21)what is father class in magneto

22)inheritance

23)contructor

24)what is layout in magento

25)what is the purpose of controller,model,block in magnento

26)different way to override model , block , controller class in magento

27)current versions of magento

29) use of eav in magento with example

30) different optimization techniques in magento (what is merging, compilation, flat table concepts)

31) different code pools in magento and its priority

32) where polymorphism used in magento

33) customize email template

34) use of $this__-> method in magento

35) what is $this in magento

36) what is difference between getcollection and get model

37) explain cart proccess start to end

38) custom my sql query in magento

39) indexing proccess

40)Difference between website, stores and store views (http://magento.stackexchange.com/questions/7393/difference-between-website-stores-and-store-views)

41) Difference between Primary Key and Foreign Key and unik

http://www.dotnet-tricks.com/Tutorial/sqlserver/TENc260912-Difference-between-Primary-Key-and-Foreign-Key.html

42) Magento methods to resolve the module conflicts in magento

// Gets the current store’s details

$store = Mage::app()->getStore();

// Gets the current store’s id

$storeId = Mage::app()->getStore()->getStoreId();

// Gets the current store’s code

$storeCode = Mage::app()->getStore()->getCode();

// Gets the current website’s id

$websiteId = Mage::app()->getStore()->getWebsiteId();

// Gets the current store’s group id

$storeGroupId = Mage::app()->getStore()->getGroupId();

// Gets the current store’s name

$storeName = Mage::app()->getStore()->getName();

// Gets the current store’s sort order

$storeSortOrder = Mage::app()->getStore()->getSortOrder();

// Gets the current store’s status

$storeIsActive = Mage::app()->getStore()->getIsActive();

// Gets the current store’s locale

$storeLocaleCode = Mage::app()->getStore()->getLocaleCode();

// Gets the current store’s home url

$storeHomeUrl = Mage::app()->getStore()->getHomeUrl();

Advertisements

One thought on “Magento interview questions and answers for experienced

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s