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. Magento 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.
Here below display basic question and answer in Magento that mostly asked by Interviewer.
Question 1. Which technology does Magento use?
Zend Framework (PHP), MySQL/MySQLI, CSS, javaScript and HTML
Basic features of Magento includesQuestion 2. Mention what are the basic features of Magento?
1. Reporting and Analytic
2. Product and Catalog Browsing
3. Customer Accounts
4. Order Management
5. Payment
6. Site Management
7. Shipping
8. Search engine optimization
9. Marketing promotions and tools
10.Checkout
11.International Support
Question 3. Mention what is the limitation of Magento?
1. Magento is supported by PHP, comparatively to other e-commerce solutions, Magento might be slow in performance2. It becomes a complex system if it is not using object-oriented programming.
3. Magento requires much space and memory.
4. Magento is not recommended for small projects/website.
5. Deep customization requires a better understanding of Magento & it's database table structure etc.
Question 4. How to upgrade to the latest version using Magento connect?
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.
Question 5. 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.
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 6. Explain Magento's MVC architecture.
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 & 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 Controller (for Routing), Block (for Business Logic), Model (for DB access, sql) and Template file (for Presentation i.e. View).
Question 7. 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.
1. Simple
2. EAV Model
Question 8. Explain about the modules of Magento.
There are three categories of modules hosted on Magento Connect:
1. Core Modules
2. Community Modules
3. 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.
Question 9. How many types of products Magento provide?
1. Simple Products
A Magento simple product is the most used product type for Magento web shops. 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 select variations. Think about a coffee cup, a chandelier, a table or whatever.
2. 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.
3. Configurable Products
A Magento configurable product should be used for a single item with specific select variations. Think about a coffee cup obtainable in different colors and sizes, a woman’s bag obtainable in different materials, a light boll obtainable in different watts or whatever. Each selected variation can have its own additional costs.
4. 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.
5. 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.
6. 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.
Question 10. Explain how you can change Magento Core API settings?
To change Magento Core API settings, you have to
Go to Admin menu, choose System -> Configuration
Select Magento Core API on the left side of the Configuration Panel, under Services
Tap on to expand the General Settings section and you can
Type the name of the Default Response Charset that you want to use
Determine the Client Session Timeout in seconds
Click the Save Config button when complete.
Question 11. Mention what is the benefit of applying Connect Patches in Magento?
In Magento, applying connect patch
It enables easy installation of packages with installation; it overwrites any existing translations for the same time
For enhancing security, by default Magento Connect uses HTTP to download extensions instead of FTP
With a dash character in the name, extension developers can now create extensions
Magento administrators will be informed now who tries to install an extension with insufficient file system privileges.
Question 12. How will you enable maintenance mode of your Magento website?
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.
Question 13. How will you enable maintenance mode of your Magento website?
Steps to create custom Magento module:
Namespace : Newsinfo
Module Name : Mymodule
1. Create directory Mymodule in app/code/local/Newsinfo
2. Create Block, controllers, etc, Module directories. Create controller, block and module file as required.
3. Create module configuration file (app/code/local/Newsinfo/Mymodule/etc/config.xml).
4. Create xml file (app/etc/modules/Newsinfo_ Mymodule.xml)to enable/disable module and tell Magento system from which code pool that module will be taken.
Question 14. How to improve Magento performance?
1. Enabled Magento caching
2. MySQL Query caching
3. Enable Gzip Compression
4. Disable any unused modules
5. Disable the Magento log
6. Optimize your images
7. Combine external CSS/JS into one file
8. Enable Apache KeepAlives: Make sure your Apache configuration has KeepAlives enabled.
9. Optimize your Server
10.Use a Content Delivery Network (CDN)
Question 15. Which factors affect performance of Magento?
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.
Question 16. 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.
Note: 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.
Question 17. How indexing works in Magento and why it require?
There are different kind of indexes in Magento. All of the indexers are there to make things run faster.
Flat Index
There are 2 such indexes. One for categories and one for products.
By default the category and product entities (and customers and customer addresses but they are not important in this situation) are EAV entities. This is very nice for extensibility. But it's a performance killer because in order to get all values for all the attributes you need a lot of joins or multiple queries.
Here is where the flat indexer comes into play.
It transforms the EAV structure into a flat structure. I mean it creates a table (one for each store view in Magento) that has one column corresponding to an attribute. This makes selects faster. For categories all attributes are converted to table columns. For products only the ones you mark as 'Used in product listing' because you can sell all types of products with different attributes and creating one table with a gazillion columns may not be possible.
Also, some products may be disabled or may not belong to a certain website and there is no need to include them in the entries to search. They are excluded by the indexer.
The generated flat tables are used for reading data in the fronend. The backend still uses the EAV structure.
Catalog Search Index
You can search for products by many attribute values. Some of them may not be included in the flat tables generated by the flat indexer. This index fills in a table with the searchable attribute values for products so it's easier to look for them based on keywords. Having all the info in one table (or one field) makes it possible to use Full text search and get relevant results.
Product Prices
The price of a product can be affected by many variables. For example, customer group, website, catalog discount rules.
Same as above, getting the products with their prices will mean a lot of joins or multiple selects. IN addition bundle products have a strange pricing system. This indexer aggregates the data in some tables (catalog_product_index_price_*) and makes the selects (sorting and filtering) much easier.
Catalog URL Rewrites
This cleans up the url rewrite rules by setting which url corresponds to which product or category. It's easier this way for the url management internal system to decide which page should you view when calling a non-standard url. Instead of searching through all the product and categories URL keys it just searches in one table.
Category Products
In Magento you can set a category attribute named 'Is Anchor' to true or false. If it's true it means that the category in question will list all the products from it's child categories. Again, determining this realtime it will take more resources than just reading one table. This indexer creates the association between products and categories based on the associations you set in the backend and the 'Is Anchor' flag on the categories.
Stock Status
For simple products it's easy. They can be in stock or out of stock, but for configurable, grouped and bundle is not that easy. They can be in stock or out of stock depending on the child products associated to the main product. Again (I'm just repeating my self here) getting their status real time would mean a lot of queries.
Product Attributes
This one collects all attributes that can be used in the layered navigation for same reason. Having all of them in one place for faster reading.
Tag Aggregation
I have no idea what this does. I've never used tags in a real live project.
Question 18. How to change admin URL of Magento?
There are 2 ways to change admin URL of Magento:
1: Go to app/etc/local.xml file, search for <frontName>tag, replace adminpanel with your new admin url
e.g we have changed the adminpanel URL to adminmagento in below example
<admin>
<routers>
<adminhtml>
<args>
<frontName><![CDATA[adminmagento]]></frontName>
</args>
</adminhtml>
</routers>
</admin>
2: You can also change Admin URL of Magento in Admin panel of Magento
In your admin panel, go to System -> Configuration->Advanced ->Admin->Admin Base URL->Use Custom Admin URL, select to ‘yes’ to use custom admin URL, now enter new admin path in `Custom admin path` field and save it.
Question 19. 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 new object but Mage::getModel() always creates a new object.
Question 20. How find Magento version?
Mage::getVersion(); which is stored in app/Mage.php file.
Question 21. Difference between 'controller' and 'controllers'
The difference is in the auto loading, as you have mentioned. In general files that are in /Controller are Abstract (or parent) classes from which classes in /controllers inherit.
Question 22. How to add an external javascript/css file in Magento?
Add CSS File
<action method="addCss"><stylesheet>css/yourstyle.css</stylesheet></action>
Add JS File
<action method="addJs"><script>js/yourfile.js</script></action>
Question 23. Get Base Url , Skin Url , Media Url , Js Url , Store Url and Current Url.
1. Get Base Url :
Mage::getBaseUrl();
2. Get Skin Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
(a) Unsecure Skin Url :
$this->getSkinUrl('images/imagename.jpg');
(b) Secure Skin Url :
$this->getSkinUrl('images/imagename.gif', array('_secure'=>true));
3. Get Media Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
4. Get Js Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
5. Get Store Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
6. Get Current Url
Mage::helper('core/url')->getCurrentUrl();
Get Url in cms pages or static blocks
1. Get Base Url : {{store url=""}}
2. Get Skin Url : {{skin url='images/imagename.jpg'}}
3. Get Media Url : {{media url='/imagename.jpg'}}
4. Get Store Url : {{store url='mypage.html'}}
Question 24. Type of session in Magento.
customer/session, checkout/session, core/session
Question 25. How to run custom query in Magento?
$db = Mage::getSingleton('core/resource')->getConnection('core_write');
$result=$db->query('SELECT * FROM TABLE WHERE id=1');
Question 26. How to include CMS block in template file(.phtml)?
Access block's content from .phtml template file by :
echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘static_block_id’)->toHTML();
Question 27. How to get the total price of items currently in the cart?
Mage::getSingleton('checkout/cart')->getQuote()->getGrandTotal();
Question 28. How to set different themes for logged in users?
if(Mage::getSingleton(‘customer/session’)->isLoggedIn()):
Mage::getDesign()->setPackageName(‘package_name’)->setTheme(‘themename’);
endif;
Question 29. How to fetch 5 bestsellers products pro-grammatically?
Mage::getResourceModel(‘reports/product_collection’)
->addOrderedQty()
->addAttributeToSelect(‘*’)
->setPage(1, 5)
->load();
Question 30. Get all products by category in Magento.
$products = Mage::getModel('catalog/category')->load($category_id)
->getProductCollection()
->addAttributeToSelect('*') // add all attributes - optional
->addAttributeToFilter('status', 1) // enabled
->addAttributeToFilter('visibility', 4) //visibility in catalog,search
Question 31. What are the addAttributeToFilter Conditionals in Magento?
In Magento we can use addAttributeToFilter Conditions same as where in SQL.
Below are the all condtions:
Equals: eq
$_products->addAttributeToFilter('status', array('eq' => 1));
Not Equals - neq
$_products->addAttributeToFilter('sku', array('neq' => 'test-product'));
Like - like
$_products->addAttributeToFilter('sku', array('like' => 'UX%'));
One thing to note about like is that you can include SQL wildcard characters such as the percent sign.
Not Like - nlike
$_products->addAttributeToFilter('sku', array('nlike' => 'err-prod%'));
In - in
$_products->addAttributeToFilter('id', array('in' => array(1,4,98)));
When using in, the value parameter accepts an array of values.
Not In - nin
$_products->addAttributeToFilter('id', array('nin' => array(1,4,98)));
NULL - null
$_products->addAttributeToFilter('description', 'null');
Not NULL - notnull
$_products->addAttributeToFilter('description', 'notnull');
Greater Than - gt
$_products->addAttributeToFilter('id', array('gt' => 5));
Less Than - lt
$_products->addAttributeToFilter('id', array('lt' => 5));
Greater Than or Equals To- gteq
$_products->addAttributeToFilter('id', array('gteq' => 5));
Less Than or Equals To - lteq
$_products->addAttributeToFilter('id', array('lteq' => 5));
Below are the all condtions:
Equals: eq
$_products->addAttributeToFilter('status', array('eq' => 1));
Not Equals - neq
$_products->addAttributeToFilter('sku', array('neq' => 'test-product'));
Like - like
$_products->addAttributeToFilter('sku', array('like' => 'UX%'));
One thing to note about like is that you can include SQL wildcard characters such as the percent sign.
Not Like - nlike
$_products->addAttributeToFilter('sku', array('nlike' => 'err-prod%'));
In - in
$_products->addAttributeToFilter('id', array('in' => array(1,4,98)));
When using in, the value parameter accepts an array of values.
Not In - nin
$_products->addAttributeToFilter('id', array('nin' => array(1,4,98)));
NULL - null
$_products->addAttributeToFilter('description', 'null');
Not NULL - notnull
$_products->addAttributeToFilter('description', 'notnull');
Greater Than - gt
$_products->addAttributeToFilter('id', array('gt' => 5));
Less Than - lt
$_products->addAttributeToFilter('id', array('lt' => 5));
Greater Than or Equals To- gteq
$_products->addAttributeToFilter('id', array('gteq' => 5));
Less Than or Equals To - lteq
$_products->addAttributeToFilter('id', array('lteq' => 5));
Question 32. How to get first item or last item from the collection?
$collection->getFirstItem() and $collection->getLastItem();
Question 33. How to convert default currency to others in Magento?
Mage::helper('directory')->currencyConvert($price, USD, GBP);
Question 34. 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
Question 35. Explain the difference between Final class and Abstract class?
Final Class:
A Class which Can't be inherited by other class, that class is called final class.
You all knows that final class is inbuilt in java. But in C++ you have to create final class.Two types of Final class, you can create. One who want to create object of final class on Heap and other who wants to create object of Final class on stack.
1. It makes use of private constructor, virtual inheritance and friend class.
2. In place of private constructor, use private Destructor.
Because Constructor can be overloaded and Destructor can't be overloaded.
A Class which Can't be inherited by other class, that class is called final class.
You all knows that final class is inbuilt in java. But in C++ you have to create final class.Two types of Final class, you can create. One who want to create object of final class on Heap and other who wants to create object of Final class on stack.
1. It makes use of private constructor, virtual inheritance and friend class.
2. In place of private constructor, use private Destructor.
Because Constructor can be overloaded and Destructor can't be overloaded.
No comments :
Post a Comment