0% found this document useful (0 votes)
268 views

Magento Interview Questions and Answers

The document contains a list of 40 questions related to Magento development. Key topics covered include Magento's MVC architecture, how Magento's ORM works including EAV models, differences between singleton and model objects, calling CMS pages in modules, code pools, cache clearing, enabling custom product attributes, and differences between EAV and flat data models.

Uploaded by

Santosh Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
268 views

Magento Interview Questions and Answers

The document contains a list of 40 questions related to Magento development. Key topics covered include Magento's MVC architecture, how Magento's ORM works including EAV models, differences between singleton and model objects, calling CMS pages in modules, code pools, cache clearing, enabling custom product attributes, and differences between EAV and flat data models.

Uploaded by

Santosh Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Magento Interview Questions and Answers

1. Explain Magento’s MVC architecture


2. How Magento’s ORM work?
3. What is EAV in Magento?
4. Difference between Mage::getSingleton() and Mage::getModel()
5. What are the steps to change the theme of Magento
6. If you want to add/modify core functionality, how will you do it?
7. How will you create a new module in Magento?
8. How will you call a CMS page in your module’s PHTML file?
9. What is codePool in Magento?
10. Explain handles in Magento’s layout
11. What is in Magento’s config XML?
12. Explain Magento’s URL structure
13. How will you optimize Magento featured website?
14. Explain in detail cache management in Magento
15. When will you need to clear cache to see the changes in Magento?
16. Explain the flow of placing an order technically
17. How will you enable product’s custom attribute visibility in frontend?
18. How will you upgrade your custom module?
19. Difference between EAV and flat table
20. Is it mandatory to give Namespace while creating custom module in Magento?
21. How will you override Block/Model/controllers in Magento?
22. What is difference between override and rewrite?
23. How will you add/remove content from core’s system.xml file?
24. Can you have more than one Grid in a module?
25. How will you join flat table and EAV table in Magento?
26. How will you enable maintenance mode of your Magento website?
27. What are “magic methods” in Magento?
28. How many database tables will Magento create when you make a new EAV module?
29. Explain Magento’s Collections
30. Explain events and observers in Magento
31. Difference between block’s “name” and “as” attributes in layout XML
32. When to use session and when to use registry to store variables?
33. Where will you write your module’s business logic in Magento?
34. Explain different types of sessions in Magento (e.g. customer/session, checkout/session, core/session) and
the reason why you store data in different session types.
35. What are the commonly used block types? What is the special in core/text_list block type.
36. What are the different design patterns used in Magento?
37. What can you do to optimize Magento performance?
38. Where is the relation between configurable product and it’s simple product stored in database?
39. How will you log current collection’s SQL query?
40. How to get first item or last item from the collection?
1. Explain Magento’s MVC architecture

First of all, what is MVC?

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

How Magento’s MVC works:

1. When you enter the URL (something like


http://loca.lho.st/frontname/controller/method/param1/value1/param2/value2), this URL is intercepted by one
PHP file called index.php which instantiates Magento application
2. Magento application instantiates Front Controller object
3. Further, front controller instantiates Router objects (specified in module’s config.xml, global tag)
4. Now, Router is responsible to “match” the frontname which is in our URL
5. If “match” is found, it sees controller name and method name in the URL, which is finally called.
6. Now depending on what is written in action name (method name), it is executed. If any models are called in
it, the controller method will instantiate that model and call the method in it which is requested.
7. Then the controller action (method) instantiate the Layout object, which calls Block specified for this action
(method) name (Each controller action name have block and template file associated with it, which can be
found at app/design/frontend or adminhtml/namespace/module/layout/module.xml file, name of layout file
(module.xml) can be found in config.xml of that module, in layout updates tag).
8. Template file (.phtml) now calls the corresponding block for any method request. So, if you write $this-
>methodName in .phtml file, it will check “methodName” in the block file which is associated in module.xml
file.
9. Block contains PHP logic. It references Models for any data from DB.
10. If either Block, Template file or Controller need to get/set some data from/to database, they can call
Model directly like Mage::getModel(‘modulename/modelname’).
For diagramatic view: click here (courtsey: Alan Storm)

2. How Magento ORM works?

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:

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

3. What is EAV in Magento?

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.

4. Difference between Mage::getSingleton() and Mage::getModel()

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.

8. How will you call a CMS page in your module’s PHTML file?

$this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘blockidentifier’)->toHtml();

9. What is codePool in Magento?

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.

15. When will you need to clear cache to see the changes in Magento?

When you have added/modified XML, JS, CSS file(s).

17. How will you enable product’s custom attribute visibility in frontend?

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.

19. Difference between EAV and flat model

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.

20. Is it mandatory to give Namespace while creating custom module in Magento?

No

21. How will you override Block/Model/controllers in Magento?

http://ka.lpe.sh/2011/06/08/overriderewrite-magento-core-blocks-and-controllers/
23. How will you add/remove content from core’s system.xml file?

You can do that by overriding system.xml configuration. Examples:

1
2 <config>
3 <sections>
4 <catalog>
5 <groups>
6 <frontend>
7 <label>Overriding Catalog Frontend in system config</label>
8 </frontend>
9 </groups>
10 </catalog>
11 </sections>
</config>

1
2 <config>
3 <sections>
4 <payment>
5 <groups>
6 <cashondelivery>
7 <fields>
8 <!--changing cashondelivery payment method settings-->
9 </fields>
10 </cashondelivery>
11 </groups>
12 </payment>
13 </sections>
</config>

24. Can you have more than one Grid in a module?

Yes

25. How will you join flat table and EAV table in Magento?

http://ka.lpe.sh/2013/04/28/magento-join-eav-collection-with-flat-table/

26. How will you enable maintenance mode of your Magento website?

http://ka.lpe.sh/2011/12/31/magento-show-maintenance-mode-page-website-under-construction/

27. What are “magic methods” in Magento?

Magento uses __call(), __get(), __set(), __uns(), __has(), __isset(), __toString(), __construct(), etc. magic
methods. You can find more details inside class Varien_Object
For more information about magic methods: http://php.net/manual/en/language.oop5.magic.php

28. How many database tables will Magento create when you make a new EAV module?

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.

33. Where will you write your module’s business logic in Magento?

inside Model

34. Explain different types of sessions in Magento (e.g. customer/session, checkout/session, core/session)
and the reason why you store data in different session types?

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.

35. What are the commonly used block types? What is the special in core/text_list block type.

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.

36. What are the different design patterns used in Magento?

http://ka.lpe.sh/2013/02/25/magento-design-patterns/

37. What can you do to optimize Magento performance?

http://ka.lpe.sh/category/performance/

38. Where is the relation between configurable product and it’s simple product stored in database?

In the 2 tables:
catalog_product_relation
catalog_product_superlink_table

39. How will you log current collection’s SQL query?

$collection->printLogQuery(true); OR $collection->getSelect()->__toString();

40. How to get first item or last item from the collection?

$collection->getFirstItem() and $collection->getLastItem();

For more Magento interview questions for freshers and experienced developers, check this:
Magento Interview Questions for Experienced and Freshers
--------------------------

Q 1. What is Magento?
Ans. Magento is a feature-rich eCommerce platform built on open-source technology that provides online
merchants with unprecedented flexibility and control over the look, content and functionality of their
eCommerce store. Magentos intuitive administration interface features powerful marketing, search engine
optimization and catalog-management tools to give merchants the power to create sites that are tailored to
their unique business needs. Designed to be completely scalable and backed by Variens support network,
Magento offers companies the ultimate eCommerce solution.

A: Magento is an open-source content management system for e-commerce web sites. The software was originally
developed by Varien Inc., a US private company headquartered in Culver City, California, with assistance from
volunteers. Magento provides online merchants with an exceptional flexibility and control over the content, look and
functionality of their e-commerce store.

Q 2. What is the difference between Mage::getSingletone() andMage::getModel() in Magento


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

Q 3. Why Magento use EAV database model ?


Ans. In EAV database model, data are stored in different smaller tables rather than storing in a single table.
product name is stored in catalog_product_entity_varchar table product id is stored in
catalog_product_entity_int table product price is stored in catalog_product_entity_decimal table Magento
Use EAV database model for easy upgrade and development as this model gives more flexibility to play with
data and attributes.

Q 4. How to upgrade to the latest version using Magento Connect?


Ans. Upgrading Magento to the latest version is a fairly simple task. Copy and Paste this key magento-
core/Mage_All_Latest VIA Magento Connect where it states Paste extension key to install:. This will
upgrade Magento to the newest version.

Q 5. Explain about the Modules of Magento?


Ans. Magento supports installation of modules through a web-based interface accessible through the
administration area of a Magento installation. Modules are hosted on the Magento eCommerce website as a
PEAR server. Any community member can upload a module through the website and is made available once
confirmed by a member of the Magento team. Modules are installed by entering a module key, available on
the module page, into the web based interface.

There are three categories of modules hosted on Magento Connect:

 Core Modules
 Community Modules
 Commercial Modules

Core and Community modules can be installed via the administration area. Commercial module pages provide
price information and a link to an external website.

Q 6. What technology used by Magento?


Ans. Magento uses PHP as a web server scripting language and the MySQL Database. The data model is
based on the Entity-attribute-value model that stores data objects in tree structures, thus allowing a change to
a data structure without changing the database definition.

Q 7. What is MVC structure in Magento?


Ans. The Model-View-Controller (MVC) architecture traces its origins back to the Smalltalk Programming
language and Xerox Parc. Since then, there have been many systems that describe their architecture as MVC.
Each system is slightly different, but all have the goal of separating data access, business logic, and user-
interface code from one another.

Q 8. What is benefit of namespace (package) in magento?

Ans. We can have more than one module with same name but they should be placed in different namespaces.
All magento core modules are contained in mage namespace.

core/Mage/Catalog

and all custom modules are placed in

local/CustomModule

Q 9. How to include CMS block in template file(.phtml)?

Ans. Access block’s content from .phtml template file by :

echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘static_block_id’)->toHTML();

Q 10. How to add an external javascript/css file to Magento?

Ans.

css/yourstyle.css

or

skin_jsjs/ yourfile.js

skin_csscss/yourstyle. css

Q 11. What are handles in magento (layout)?

Ans. Handles are basically used for controlling the structure of the page like which block will be displayed
and where. First level child elements of the node are called layout handles. Every page request can have
several unique Handles. The handle is called for every page. handle for products belongs to virtual product
type, PRODUCT_TYPE_simple is called for product details page of simple product type and
PRODUCT_TYPE_virtual is called for the virtual product detail page and customer_logged_in handle is
called only if customer is logged in. The muster_index_index handle is created by combining the frontName
(muster), Action Controller (index), and Action Controller Action Method (index) into a single string and this
handle will be called only when /zag/index/index url is accessed.
Q 12. What is in magento?

Ans. The routers tag allow us to decide frontname for each module. The tag is defined in config.xml file of
module. For Namespace_MyModule frontname is moduleurl so the url will be like :

websiteurl.com/moduleurl/controllername/actionname

standard

Namespace_MyModule

moduleurl

Q 13. Which factors affect performance of magento?

Ans.

1. EAV structure of magento database, even for retrieving single entity the query becomes very complex .

2. Magento’s template system involves a lot of recursive rendering

3. Huge XML trees built up for layout configuration, application configuration settings

Q 14. How to improve magento performance?

Ans.

Enabled magento caching

MySQL Query caching

Enable Gzip Compression

Disable any unused modules

Disable the Magento log

Optimise your images

Combine external CSS/JS into one file

Enable Apache KeepAlives: Make sure your Apache configuration has KeepAlives enabled.

Q 15. How to get the Total Price of items currently in the Cart?

helper(‘checkout’)->formatPrice(Mage::getSingleton(‘checkout/cart’)->getQuote()->getGrandTotal()); ?>

Q 16. How to set different themes for logged in users?

if(Mage::getSingleton(‘customer/session’)->isLoggedIn()):
Mage::getDesign()->setPackageName(‘package_name’)->setTheme(‘themename’);

endif;

Q 17. How to create magento custom module?

Ans. Steps to create custom magento module:

Namespace : Zag

Module Name : Mymodule

1. Create directory Mymodule in app/code/local/Zag

2. Create Block, controllers, etc, Module directories. Create controller, block and module file as required.

3. Create module configuration file (app/code/local/Zag/Mymodule/etc/config.xml).

4. Create xml file (app/etc/modules/Zag_ Mymodule.xml)to enable/disable module and tell magento system
from which code pool that module will be taken.

Q 18. How to set different themes for each store?

Ans. Go to : System>Designs

Then, add new design change or edit existing. You can select Store and Custom Design.

Q 19. How to make product’s custom attribute searchable in adavance search?

Ans. Go to : Catalog > Attribues > Manage Attribues

Edit the attribute and select “Yes” for Use in Advanced Search.

Q 20. How to fetch 5 bestsellers products programmatically?

Ans.

Mage::getResourceModel(‘reports/product_collection’)

->addOrderedQty()

->addAttributeToSelect(‘*’)

->setPage(1, 5)

->load();

 21-Explain Magento’s MVC architecture


First of all, what is MVC?

MVC stands for Model-View-Controller. Any application that separates it’s data access, business
logicand user interface is called MVC. There can be two types of MVC: convention-
based andconfiguration-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 Controller (for Routing), Block (for Business Logic), Model (for DB
access, sql) and Template file (for Presentation i.e. View).

How Magento’s MVC works:

1. When you enter the URL (something like


http://mysite.com/frontname/controller/method/param1/value1/param2/value2), this URL is
intercepted by one PHP file called index.php which instantiates Magento application

2. Magento application instantiates Front Controller object

3. Further, front controller instantiates Router objects (specified in module’s config.xml, global tag)

4. Now, Router is responsible to “match” the frontname which is in our URL

5. If “match” is found, it sees controller name and method name in the URL, which is finally called.

6. Now depending on what is written in action name (method name), it is executed. If any models
are called in it, the controller method will instantiate that model and call the method in it which is
requested.

7. Then the controller action (method) instantiate the Layout object, which calls Block specified for
this action (method) name (Each controller action name have block and template file associated
with it, which can be found at app/design/frontend or
adminhtml/namespace/module/layout/module.xml file, name of layout file (module.xml) can be
found in config.xml of that module, in layout updates tag).

8. Template file (.phtml) now calls the corresponding block for any method request. So, if you write
$this->methodName in .phtml file, it will check “methodName” in the block file which is associated in
module.xml file.

9. Block contains PHP logic. It references Models for any data from DB.

10. If either Block, Template file or Controller need to get/set some data from/to database, they can
call Model directly like Mage::getModel(‘modulename/modelname’).

For diagramatic view: click here (courtsey: Alan Storm)

22 =How Magento ORM works?


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.

23. What is EAV in Magento?

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.

24. Difference between Mage::getSingleton() and Mage::getModel()

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.

Question: How we can enhance the Magento performance?

1. Disable the Magento log


2. Disable any un-used modules
3. Magento Caching
4. Enable Gzip compression
5. Optimize your image
6. Optimize your Server
7. Use a Content Delivery Network (CDN)
8. USE Gzip Components
9. Put Stylesheets at the Top (CSS Files in head tag)
10. Put Scripts at the Bottom (Js files in footer)
11. Avoid CSS Expressions (e.g 100/2)

Look: http://www.web-technology-experts-notes.in/2013/10/14-steps-to-reduce-the-loading-time-of-
website.html

Question: Which technology does mangento use?


Zend Framework (PHP), MySQL/MySQLI, CSS, javaScript and HTML

Question: What is EAV in Magento?


Full form of EAV is Entity–attribute–value model.
EAV is a data model to data model to describe entities.
In EAV data are stored in different smaller tables rather than storing in a single table.
For Example
Product name is stored in catalog_product_entity_varchar table.
Product id is stored in catalog_product_entity_int table.
Product price is stored in catalog_product_entity_decimal table.

Question: How does Magento ORM works?


ORM full form is Object Relational Mapping.
ORM is a programming technique which is used to convert different types of data to Objects and vice versa
. ORM is shown as Model (based on Zend Framework’s Zend_Db_Adapter), which further breaks down to two types of
Models.
a. simple
b. EAV Model

Question: How to change the theme for login user?

if(Mage::getSingleton('customer/session')-&gt;isLoggedIn()):
Mage::getDesign()-&gt;setPackageName('package_name')-&gt;setTheme('themename');
endif;

Question: How to run Custom Query in Magento ?

$db = Mage::getSingleton('core/resource')-&gt;getConnection('core_write');
$result=$db-&gt;query('SELECT * FROM users where id=4');

You might also like