Twelve important questions and answers in Magneto .
Q 1) What is the difference between
1 | Mage::getSingletone(); |
1 | Mage::getModel(); |
Ans)
1 | Mage::getSingletone(); |
1 | Mage::getModel(); |
Q 2) 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 tableproduct id is stored in catalog_product_entity_int tableproduct price is stored in catalog_product_entity_decimal tableMagento Use EAV database model for easy upgrade and development as this model gives more flexibility to play with data and attributes.
Q 3) 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 4) 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 5) How to include CMS block in template file(.phtml)?
Ans) Access block’s content from .phtml template file by :
1 | echo $this ->getLayout()->createBlock( 'cms/block' )->setBlockId( 'static_block_id' )->toHTML(); |
Q 6) How to get the Total Price of items currently in the Cart?
Ans)
1 | helper( 'checkout' )->formatPrice(Mage::getSingleton( 'checkout/cart' )->getQuote()->getGrandTotal()); |
Q 7) How to set different themes for logged in users?
Ans)
1 2 3 | if (Mage::getSingleton( 'customer/session' )->isLoggedIn()): Mage::getDesign()->setPackageName( 'package_name' )->setTheme(‘themename’); endif ; |
Q 8) 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/Zag2. 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 9) How to set different themes for each store?
Ans) Go to :
1 | System>Designs |
Then, add new design change or edit existing. You can select Store and Custom Design.
Q 10) How to make product’s custom attribute searchable in advance search?
Ans) Go to :
1 | Catalog > Attributes > Manage Attributes |
Edit the attribute and select “Yes” for Use in Advanced Search.
Q 11) How to run custom MySql query in Magento ?
Ans) Below is the simple code. We can easily understand this.
1 2 | $db = Mage::getSingleton( 'core/resource' )->getConnection( 'core_write' ); $result = $db ->query( "SELECT * FROM PCDSTable" ); |
Q 12) What is the difference between
1 | Mage::getSingletone(); |
1 | Mage::getModel(); |
Ans)
1 | Mage::getSingletone(); |
1 | Mage::getModel(); |
No comments:
Post a Comment