Below questions are the Odesk questions which is the Recent odesk magento testpapers was for jan/2015.If you have any answer of these Recent odesk magento testpapers you can please post in th answer in this post so that other can get benefit on this.All multiple question with answer of recent oDesk as well for elance test.
Q:l)The browser is ignoring the file refering in the code below:
assume that this is a php file that is used as stylesheet in magento extension.
which of the following choices will make browser to apply the stylesheet.
a)there is no solution php file cann't be used as stylesheet. b)use href attribute instead of src c)call static css file instead of using php file as stylesheet. d)send a valid content type http header ,as in headr('content-type: text/css')
Ans : b
Q:2)which of following will add static block on site’s home page in magento ?
a)b) < ?php $ref = new Mage_Page_Block_Html_Header(); if($ref->getIsHomePage()){ ?> < ?php $this->getLayout->createBlock('cms/block')->setBlockId('your_static_block_id')->toHtml();?> < ?php } ?> c) home-page-block d) home-page-block home-page-block
Ans : b
Reference:
home-page-block
or
< ?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-page-block')->toHtml() ?>
or
{{block type="cms/block" block_id="home-page-block"}}
Q:3)which of the following attributes are the data member of lnagento Mage_News1etter’_Mode1_Subscriber Class?
a)STATUS_SUBSCRIBED b)STATUS_NOT_ACTIVE c)STATUS_UNSUBSCRIBED d)All the above
Ans : d
Reference:
below attributes are available in Mage_Newsletter_Model_Subscriber Class Public Attributes const STATUS_SUBSCRIBED = l const STATUS_NOT_ACTIVE = 2 const STATUS_UNSUBSCRIBED = 3 const XML_PATH_CONFIRM_EMAIL_TEMPLATE = 'newsletter/subscription/confirm_email_template' const XML_PATH_CONFIRM_EMAIL_IDENTITY = 'newsletter/subscription/confirm_email_identity' const XML_PATH_SUCCESS_EMAIL_TEMPLATE = 'newsletter/subscription/success_email_template' const XML_PATH_SUCCESS_EMAIL_IDENTITY = 'newsletter/subscription/success_email_identity' const XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE = 'newsletter/subscription/un_email_template' const XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY = 'newsletter/subscription/un_email_identity' const XML_PATH_CONFIRMATION_FLAG = 'newsletter/subscription/confirm' const XML_PATH_SENDING_SET_RETURN_PATH = 'newsletter/sending/set_return_path' Protected Attributes $_isStatusChanged = false
Q:4)what is the reconlnended way to override/extend Magento core functionality?
a)Directly edit the core files of Magento with proper commenting. b)Mage::register0verride( ‘CoreClassName’ , ’CoreFunctionName’ , ’MyClassName’ , ’MyFunctionna|ne’ )3 c)Copy the original Magento core file to the app/code/local folder and customize that file. d)Create extended versions of core files in their own folder with extension information. app/code/core/Mage/Cms/Model/Page.php app/code/core/Mage/Cms/Model/Page.1.php App/code/core/Mage/Cms/Model/Page.2.php
Ans : c
Reference:
overriding magento blocks models helpers and controllers
when should you override magento core files in app_code_local_mage
magento_config
Q:5)The “Suspected Fraud” Order status is grouped under which state?
a)Processing state b)Payment Processing state c)Pending shipment state d)Payment Review state
Ans : d
Reference:
mysql> SELECT * FROM sales_order_status; +--------------------------+--------------------------+ | status | label | +--------------------------+--------------------------+ | canceled | Canceled | | closed | Closed | | complete | Complete | | fraud | Suspected Fraud | | holded | On Hold | | payment_review | Payment Review | | paypal_canceled_reversal | PayPal Canceled Reversal | | paypal_reversed | PayPal Reversed | | pending | Pending | | pending_payment | Pending Payment | | pending_paypal | Pending PayPal | | processing | Processing | +--------------------------+--------------------------+ mysql> SELECT * FROM sales_order_status_state; +-----------------+-----------------+------------+ | status | state | is_default | +-----------------+-----------------+------------+ | canceled | canceled | 1 | | closed | closed | 1 | | complete | complete | 1 | | fraud | payment_review | 0 | | holded | holded | 1 | | payment_review | payment_review | 1 | | pending | new | 1 | | pending_payment | pending_payment | 1 | | processing | processing | 1 | +-----------------+-----------------+------------+
Q:6)which of the following will sort products in the catalog by the date they were added?
a) Under "app/code/core/Mage/Catalog/Model/Config.php", add this value to the $options array: 'created_at'=>Mage::he1per('catalog')->_('Date') b) Under "app/code/core/mage/catalog/modeUresource/eav/mysq14/product/collection.php", add this value to the $options array: $this->getSelect()->order(“e.entity_id desc"); c) Under "app/code/core/Mage/Catalog/Model/Config.php", add this value to the $options array: 'sort_by'=>Mage::helper('cata1og')->_('Date') d)It's not possible to sort products in the catalog by date.
Ans : a
Reference:
magento sort by date added
Q:7)what is the correct method for calling a single product inside a static block?
a){{b1ock type="media/product_single" product_id="1" temp1ate="catalog/product/singleproduct.phtml“}} b){{b1ock type="catalog/product_single" product_id="1" temp1ate="catalog/product/singleproduct.phtml“}} c){{b1ock type="all/product_single" product_id="1" temp1ate="catalog/product/singleproduct.phtml“}} d){{b1ock type="categories/product_single" product_id="1" temp1ate="catalog/product/singleproduct.phtml“}}
Ans :
Reference:
{{block type="catalog/product_view" product_id="5678" template="page/html/featured/product.phtml"}}
cms block widgets for individual products
Q:8)which of the following will check if the current request is for a backend page or a frontend page?
a)Mage::app()->getStore()->isAdmin() b)Mage::code()->getStore()->isAd|ninArea() c)Mage::app()->getStore()->Admin() d)Mage::app()->getStore()->AdminHtml()
Ans : a
Reference:
More Info
Q:9)which XML file(s) should be checked when the following Magento error occurs during installation?
“Pl-IP Extensions “0′ must be loaded”
a)config.xml in app/code/core/Mage/Install/etc b)install.x|nl in app/code/core/Mage/Install/etc c)extensions.xml in app/code/core/Mage/Install/etc d)None of these
Ans : a
Reference:
More Info
Q:10)which file needs to change to update database when transfer a local Magento install onto live
server?
a)app/etc/config.xml b)app/db/config.xml c)app/etc/local.xml d)app/code/core/db/local.x1nl
Ans : c
Reference:
More Info
More Info
Q:11)Why does the error, “front controller reached 100 router match iterations”, occur?
a)There is an error in the code. b)Some modules failed to load. c)Router references were set incorrectly. d).htacces is blocking URLs.
Ans : c
Reference:
More Info
Q:12)Which of the following Events are triggered when the payment has been confirmed?
a)checkout_onepage_controller_success_action b)checkout_payment_confirmed c)sales_order_payment_pay d)payment_confirmed_action
Ans : c
Reference:
More Info
Q:13)Which of the following is the minimum memory requirement for running a Magento site?
a)at least 128MB b)at least 256MS c)at least 512MS d)over 512M8
Ans : b
Reference:
More Info
Q:14)Which of the following will not increase the performance of a Magento site?
a)Reducing the time spent on creation of the blocks b)Disabling the cache in the admin panel c)Switching on compiler mode d)Using auto-optimization extensions
Ans : b
Reference:
More Info
Q:15)How magento contact form can be shown on a CMS page?
a)By using block syntax {{block type="core/template" name="contactForm" template="contacts/form.phtm1"11 b)By Using Layout Updatec)By Creating an Widget of Contact form and adding that widget to CMS page d)All of above is correct
Ans : a
Reference:
{{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml"}}
Q:16)Which of the following code samples will display a list of both active and inactive sub-categories of the current category?
a) < ?php $_category = $this->getCurrentrategory(); $collection = Mage::getModel('catalog/category')->getCategories(Lcategory->entity_id); $helper = Mage::helper('catalog/category'); foreach ($collection as $cat): if($_category->getIsActive()): $cur_category = Mage::getModel('catalog/category')->load($cat->getId()); < ?php echo $cat->getName();?> ?> < ?php endif; endforeach; ?> b) < ?php $_category = $this->getCurrentrategory(); $collection = Mage::getModel('catalog/categorys')->getCategories(Lcategory->entity_id); $helper = Mage::helper('catalog/category'); foreach ($collection as $cat): $cur_category = Mage::getModel('catalog/category')->load($cat->getId()); ?> < ?php echo $cat->getName();?> < ?php endforeach; ?> c) < ?php $helper = Mage::helper('catalog/category'); $_categories = $helper->getStoreCategories(); if(count($_categories) > 0){ foreach($_categories as $_category){?> < ?php echo $_category->getName();?> < ?php } } ?> d)None of the above.
Ans : a
Reference:
< ?php /* Get the categories that are active for the store */ $_main_categories=$this->getStoreCategories(); /* Get the current category the user is in */ $_current_category=$this->getCurrentCategory(); /* Get the current category path */ $_categorypath = $this->getCurrentCategoryPath(); $id=10; $collection = Mage::getResourceModel('catalog/category_collection') ->addAttributeToSelect('*') ->addAttributeToFilter('is_active', array('in' => array(0,1))) ->addAttributeToFilter('parent_id', $id); echo count($collection); ?>
display-all-children-categories-and-their-children-in-magento
Q:17)Which of the following will get the tax amount on a page in Magento?
a)Mage::helper('checkout1)->getQuote()->getShippingAddress()->getData('tax_amount.); b) $totalItemsInCart = Mage::helper((checkout/carts)->getItemsCount(); $totals = Mage::getSingleton(`checkout/session')->getQuote()->getTotals(); $subtotal = round($totals["subtotal")->getValue()); $grandtotal = round($totals["grand_total"]->getValue()); if(isset($totalsUdiscount'll && $totalsrdiscountl->getValue()) { $discount = round($totalsUdiscountl->getValue()); ) }else { $discount = "; } if(isset($totalsUtaxl) && $totalsrtaxl->getValue()) { $tax = round($totals[itaxl->getValue()); ) }else { $tax = "; } c) $order = Mage::getModel('sales/order1)->load($order_id); $items = $order->getAllItems(); $subtotals = array(); foreach ($items as $_item) if (array_key_exists($subtotals[Litem->getTaxClassId()])) { $subtotals[Litem->getTaxClassId()] += Litem->getRowTotal(); } else { $subtotals[Litem->getTaxClassId()] = $_item->getRowTotal(); } } d) < ?php $order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId()); $data = $order->getData(); ?>
Ans : a
Reference:
Mage::helper('checkout')->getQuote()->getShippingAddress()->getData('tax_amount')
Q:18)Which of the following methods can be used add a new attribute to all products ?
a)Using XML layout files b)By creating a new field in the database table named ccatalog_attributes. c)Via the Magento Admin panel (Manage Attributes) d)By creating a new module
Ans : c
Reference:
magento-add-new-attribute-to-all-products
Q:19)Which of the following will return the current page title in Magento?
a)$this->getLayout()->get('head')->getTitle(); b)$this->getLayout()->getBlock('head')->getPageTitle(); c)$this->getLayout()->get('Title')->getHead(); d)$this->getLayout()->getBlock('head')->getTitle();
Ans : d
Reference:
$this->getLayout()->getBlock('head')->getTitle();
Q:20)Which of the following will get active store information (such as the store’s name) in Magento?
a)Mage::app()->getStore(); b)Mage::app()->getStoreId(); c)Mage::app()->getName(); d)None of the above
Ans : d
Reference:
More Info
Q:21)An observer in Magento is defined as a:
a)Method b)Class c)Event d)None of these.
Ans : c
Q:22)Select which conditions can be checked to track down a product that is not showing in a category page.
Note: There may be more than one right answer.
a)Product visibility must be "Listed"; b)Product must be enabled; c)Stock and quantity must be greater than 0; d)If using multiple websites, check which website the product points to;
Ans : All of above
Reference:
The checklist for whether items are in stock follows. Some will seem stupid until the first time you spend an hour trying to figure this problem out: The products must be Visible in Catalog. The products must be Enabled. Product must have a stock Quantity. The product must be set to In Stock. If the product is set not to track stock, it still has to have a stock Quantity and be set to In Stock. The product must be assigned to the target Category. If using multi-website mode (or if you imported the products through Data Flow), the products must be assigned to the target Website. You must refresh your Cache / Indices, just to make sure.
magento-products-will-not-show-in-category
Q:23)Which of the following will get all active CMS pages in Magento?
a)$collection = Mage::getModel('cms/page.)->getCollection()->getSelect()->where('is_active = 1'); b)$collection = Mage::getModel('cms/page.)->getCollection()->addFilter('active,true); c)Mage::getModel(`cms/page)->getActivePages(); d)Mage::getModel(`cms/page)->getPageCollection()->setFilter(`active,true);
Ans : d
Reference:
$cmsPage = Mage::getModel('cms/page')->setStore(Mage::app()->getStore()->getId())->getCollection()->addFieldToFilter('is_active',1);
Q:24)which of the following Magento classes should be used for adding custom duties/taxes to a quote
during the checkout process?
a)Mage_Sales_Model_Quote_Item_Option b)Mage_Sales_Mode1_Quote_Address_Total_Abstract c)Mage_Sales_Model_Quote_Item d)Mage_Sales_Model_Quote_Payment
Ans : a
Reference:
More Info
Q:25)which of the following will set a template only if a particular module is disabled in Magento?
a)mytemplate.phtml b) Using File: app/code/core/Mage/Core/Model/Layout.php protected function _generateAction($node, $parent) { if (isset($node['ifconfig']? && ($confi$Path = (string)$node['ifconfig'])) { if (!Mage::getStoreConf1gFlag($conf1gPath)) { return $this; } } c)d) None of these.
Q:26)which of the following will correctly display the current theme name in Magento?
a)Mage::getSingleton('core/design_package')->getName(); b)Mage::getDesignPackage()->getName() c)Mage::getSingleton('core/design_package')->getTheme('frontend'); d)Mage::getSingleton('core/design_package')->getName('package');
Ans : c
Reference:
Mage::getSingleton('core/design_package')->getPackageName() Mage::getSingleton('core/design_package')->getTheme('frontend')
Q:27)which of the following statements are correct to store Contact form data in database of magento?
A. By default Magento store the Contact form data in database
B. Need to create a custom module which store data in database by override the core contacts module
a)Statement A is true and Statement B is false b)Statement B is true and Statement A is false c)Both statements are true. d)Both statements are false.
Ans : c
Reference:
More Info
Q:28)How can the checkout process be skipped for downloadable products in Magento?
a)The checkout step cannot be skipped in Magento. b)Downloadable products automatically do not require checkout. c)There is an option in the admin panel to skip the checkout step for downloadable products. d)Magento does not support downloadable products.
Ans : a
Reference:
disable-checkout-in-magento-for-a-downloadable-product
skip-checkout-in-magento-only-for-free-downloadable-products
Q:29)Is it possible to trigger an event after an order has been set to ‘rocessing’ ?
a)Yes, by using a custom module. b)No, since it's a security threat. c)No, since no additional action can be added at this stage. d)Yes, by registering an event
Ans : a
Reference:
More Info
Q:30)Assuming that a column needs to be added under Catalog >> Manage Products in Magento, which file will need to be edited?
a)app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Layout.php b)app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Grid.php c)app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Design.php d)A custom column cannot be added under Catalog >> Manage Products.
Ans : b
Reference:
More Info
Q:31)Consider the following code:
a)"Module's alias" / "Class name relative to the alias“ b)"Controller's Alias“ / "Class name relative to the alias" c)"Controller's Class" / "Method Name" d)"Method Name“ / "Parameter"
Ans : c
Reference:
More Info
Q:32)which of the following XML files will remove an item from Magento’s admin panel navigation?
a) < ?xml version="1.0" ?>b) < ?xml version="1.0" ?> c) < ?xml version="1.0" ?> d) Items under the Magento admin panel can't be removed.
Ans : a
Reference:
removing-an-item-from-magentos-admin-panel-navigation
magento-remove-admin-menu-item
Q:33)what does the Capture method do in the Magento Purchase and Order Processing flow?
a)Sends an authorization request to the payment gateway's API. b)Collects funds from the authorized transaction and puts it in the merchant's account. c)Throws an exception when authorization has failed. d)Collects the order and makes the shipment.
Reference:
magento payment flow
Q:34)which of the following methods will allow access to a Magenta session from other sites on different subdomains?
a)subdomains.domains.com needs to be entered in magento's admin->Systen->Configuration->web->Cookie domains, to make session cookies available to other subdomains. b)subdomains.domains.cou needs to be entered in magento's app/code/core/Mage/Core/Model/Config.php file, to make session cookies available to other subdomains. c)Allowing access to session cookies from other subdomains is not part of magento's core functionality, but it can be achieved using extensions. d)It is not possible to access a Magento site's cookies on a different subdomains.
Ans : a
Reference:
How to access magento customers session from outside magento
Q:35)which of the following statements are true regarding passing data between a controller and a block in Magento?
a)It can not be done by using Magento's MVC approach, but it can be done by emulating traditional PHP MVC behaviors. b)It can not be done by emulating traditional PHP MVC behaviors, but it can be done by using Magento's MVC approach. c)It can be done by writing this code on a controller: Mage::transfer(‘data' , $data) ; and writing this in the block: $data = Mage::registry('data'); d)It can be done by writing this code on a controller: Mage::register(‘data' , $data) ; and writing this in the block: $data = Mage::registry('data');
Ans : a
Reference:
Magento passing data between a controller and a block
Pass data from block to view
Q:36)Magento has the ability to run multiple stores from the same database. After adding the new store from System-> Manage Store, what is the correct code to add to the htaccess file to make Magento automatically load the new store?
a) RewriteCond %{HTTP_HOST} ^oldstore.com RewriteRule ^ - [E=MAGE_RUN_CODE :your0ldStoreCode] RewriteRule ^ - [E=MAGE_RUN_TYPE:website] b) RewriteCond %{HTTP_HOST} ^newstore.com RewriteRule ^ - [E=MAGE_RUN_CODE :yourNewStoreCode] RewriteRule ^ - [E=MAGE_RUN_TYPE:website] c) RewriteCond %{HTTP_HOST} ^newstore.com RewriteRule ^ - [E=MAGE_RUN_CODE :yourStoreCode] RewriteRule ^ - [E=MAGE_RUN_TYPE:website] d) RewriteCond %{HTTP_HOST} ^newstore.com RewriteRule ^ - [E=MAGE_RUN_CODE :yourNewStoreCode] RewriteRule ^ - [E=MAGE_RUN_TYPE:website]
Reference:
Multi site multi domain setup
How to create multiple store with different domain in magento