latest Post

Upwork/oDesk Magento Test Answers

1. Which of the following will display a customer's TAX/VAT number?
 Answers: • $taxvat = $order['customer_taxvat']; or • $order->getData('customer_taxvat');

 2. Why does the error, "front controller reached 100 router match iterations", occur?
 Answers: • Router references were set incorrectly.

 3. Which of the following will sort products in the catalog by the date they were added?
 Answers: • Under "app/code/core/Mage/Catalog/Model/Config.php", add this value to the $options array: 'created_at' => Mage::helper('catalog')->__('Date')

 4. Is it possible to trigger an event after an order has been set to "processing"?
 Answers: • Yes, by using a custom module.

 5. Which of the following code samples will get all products sorted by 'position', assuming 'position' is of a numeric type?
 Answers: • $products = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('*') ->addAttributeToSort('position', 'ASC'); ->load();

 6. Which of the following statements are correct about Magento quotes?
 Answers: • Quotes are offers to the user, which if the user accepts get converted into orders.

 7. Select which method will register observers/hooks to events in Magento:
 Answers: • Registering observers using the XML layout of the module: <events> <EVENT_TO_HOOK> <observers> <module> <type>singleton</type> <class>company_module_model_observer</class> <method>methodToCall</method> </module> </observers> </EVENT_TO_HOOK> </events>

 8. 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?
 Answers: • RewriteCond %{HTTP_HOST} ^ RewriteRule ^ - [E=MAGE_RUN_CODE:yourNewStoreCode] RewriteRule ^ - [E=MAGE_RUN_TYPE:website]

 9. Which of the following will save a custom session variable in Magento?
 Answers: • $session = Mage::getSingleton("core/session", array("name"=>"frontend")); $session->setData("device_id", 4);

 10. Which of the following will get information ('customer_referrer_id') from a currently logged-in admin user?
 Answers: • $collection->addAttributeToFilter('customer_referrer_id', $referrer_id); $referrer_id = Mage::getSingleton('admin/session')->getUser()->getId();

 11. Which of the following will display a product's thumbnail?
 Answers: • <img src="<?php echo $this->helper('catalog/image')->init($_item->getProduct(), 'thumbnail')->resize(50); ?>" alt="<?php echo $_item->getName() ?>" />

 12. Consider the following code:
 <block type="A/B" name="root" output="toHtml" template="example/view.phtml">

 What is the meaning of A/B?
 Answers: • "Module's alias" / "Class name relative to the alias"

 13. Which of the following code samples will display a list of both active and inactive sub-categories of the current category?
 Answers: • <?php $_helper = Mage::helper('catalog/category'); $_categories = $_helper->getStoreCategories(); if (count($_categories) > 0): foreach($_categories as $_category): ?> <a href="<?php echo $_helper->getCategoryUrl($_category) ?>"> <?php echo $_category->getName() ?> </a> <?php endforeach; endif; ?>

 14. Which of the following will return a visitor's UserAgent information?
 Answers: • Mage::helper('core/http')->getHttpUserAgent()

 15. How can account navigation links be changed?
 Answers: • Using an XML file to define the template

 16. Which of the following will correctly add a custom event in Magento?
 Answers: • Mage::dispatchEvent

 17. Which XML file(s) should be checked when the following Magento error occurs during installation?
 "PHP Extensions "0" must be loaded"
 Answers: • config.xml in app/code/core/Mage/Install/etc

 18. Which of the following will set a template only if a particular module is disabled in Magento?
 Answers: • <action method="setTemplate" ifconfig="advanced/modules_disable_output/Myname_Mymodule"> <template>mytemplate.phtml</template> </action>

 19. Which of the following XML files will remove an item from Magento's admin panel navigation?
 Answers: • <?xml version="1.0" ?> <config> <menu> <xmlconnect> <disabled>1</disabled> </xmlconnect> </menu> </config>

 20. Which of the following will get active store information (such as the store's name) in Magento?
 Answers: • Mage::app()->getStore();

 21. What is the best way to store session values in Magento?
 Answers: • $myValue=’Hello world’; Mage::getSingleton( 'core/session' )->setMyValue($myValue);

 22. The "Suspected Fraud" Order status is grouped under which state?
 Answers: • Payment Processing state

 23. Which of the following needs to be edited to input and display the order attributes in Magento?
 Answers: • Both /app/design/adminhtml/default/default/template/sales/order/view/info.phtml and /app/code/local/CWACI/SalesExt/controllers/Adminhtml/Sales/OrderController.php

 24. When using a custom Magento logo as the default logo for transactional emails; which of the following is the correct way for the logo to be maintained even after Magento system upgrades?
 Answers: • Create a new theme and place the new logo, named as "logo_email.png", in the skin directory.

 25. When does the following error occur? "Not all products are available in the requested quantity"
 Answers: • When the products are out of stock, but the cart still proceeded to checkout

 26. Which of the following will change the order of existing blocks via XML?
 Answers: • <reference name=""> <action method="unsetChild"><alias>child_block_alias</alias></action> <action method="insert"><blockName></blockName><siblingName>name_of_block</siblingName><after>1</after><alias>child_block_alias</alias></action> </reference>

 27. Which of the following is the minimum memory requirement for running a Magento site?
 Answers: • at least 256MB

 28. How can the checkout process be skipped for downloadable products in Magento?
 Answers: • The checkout step cannot be skipped in Magento.

 29. Which of the following conditions must be met in order to successfully run a Magento install script?
 Answers: • All of these.

 30. When migrating a Magento store to a new server, after moving the files and the database, where must the database access details be configured for the new server?
 Answers: • app/etc/local.xml

 31. What is the best way to create global variables which can be used everywhere in Magento?
 Answers: • Via a Magento Session $myValue = 'Hello World'; Mage::getSingleton('core/session')->setMyValue($myValue);

 32. The browser is ignoring the file referred on the code below:
 <link src="" rel="stylesheet" type="text/css">

 Assume that this is a PHP file that is used as a stylesheet in a Magento extension.

 Which of the following choices will make the browser apply the stylesheet?
 Answers: • Call a static CSS file instead of using a PHP file as a stylesheet.

 33. What is the recommended way to override/extend Magento core functionality?
 Answers: • Copy the original Magento core file to the app/code/local folder and customize that file.

 34. An observer in Magento is defined as a:
 Answers: • Class

 35. What is the difference between "Flush Magento Cache" and "Flush Cache Storage" in the Magento Cache Management System?
 Answers: • "Flush Magento Cache" removes "/tmp/" folder's cache only, while "Flush Cache Storage" clears everything.

 36. Which of the following will get a list of products belonging to a specific category within a view file?
 Answers: • $productCollection = Mage::getResourceModel('catalog/product_collection') ->addCategoryFilter($category);

 37. Assuming that trees must have categories as parents and products as children, and that there are no sub-categories under main categories, which of the following code samples will get the full catalog tree?
 Answers: • $categories = Mage::getModel('catalog/category') ->getCollection(); foreach ($categories as $category) { print $category->getName(); $products = Mage::getModel('catalog/category') ->load($category->getId()) ->getProductCollection(); foreach($products as $product){ Print $product->getName(); } }

 38. Which of the following will call a static block inside one of Magento's template files?
 Answers: • $this->getLayout()->createBlock('cms/block')->setBlockId('my_static_block_name')->toHtml()

 39. Which of the following Magento objects will be created during checkout?
 Answers: • sales/quote

 40. Assuming the following choices are to be added to a custom theme layout's local.xml file; which of the following will move the "related products" box in the "product details page" to the bottom center column?
 Answers: • <catalog_product_view> <reference name="right"> <action method="unsetChild"> <block>catalog.product.related</block> </action> </reference> <reference name="content"> <action method="insert"> <block>catalog.product.related</block> </action> </reference> </catalog_product_view>

 41. What is the correct method to add an external JavaScript file to Magento's local.xml file?
 Answers: • <action method="addJS"><script>jquery/jquery.js</script></action>

 42. Which of the following will check whether the currently logged-in customer ever placed an order at the Magento store?
 Answers: • $orders = Mage::getResourceModel('sales/order_collection') ->addFieldToSelect('*') ->addFieldToFilter('customer_id', $customer->getId()); if ($orders->getSize()) { }

 43. How can a new column be added in sales_flat_order to save a custom value in Magento?
 Answers: • By defining column name in Block and table

 44. Which of the following will get the order increment ID in Magento?
 Answers: • $order = Mage::getSingleton('sales/order')->getLastOrderId(); $lastOrderId = $order->getIncrementId();

 45. Which of the following will get the tax amount on a page in Magento?
 Answers: • Mage::helper('checkout')->getQuote()->getShippingAddress()->getData('tax_amount');

 46. Which of the following will retrieve a list of all shipping methods in Magento?
 Answers: • public function toOptionArray($isMultiSelect = false) { $methods = Mage::getSingleton('shipping/config')->getActiveCarriers(); $options = array(); foreach($methods as $_code => $_method) { if(!$_title = Mage::getStoreConfig("carriers/$_code/title")) $_title = $_code; $options[] = array('value' => $_code, 'label' => $_title . " ($_code)"); } if($isMultiSelect) { array_unshift($options, array('value'=>'', 'label'=> Mage::helper('adminhtml')->__('--Please Select--'))); } return $options; }

 47. Which of the following will list all products from a particular category?
 Answers: • $productCollection = Mage::getResourceModel('catalog/product_collection') ->addCategoryFilter($category);

 48. By default, Magento allows 3 themes to be loaded at any time. In what order are they loaded? (1 being first and 3 being last)
 Answers: • 1 Custom non-default theme 2 Custom default theme 3 Magento base theme

 49. What is the correct method for calling a single product inside a static block?
 Answers: • {{block type="catalog/product_single" product_id="1" template="catalog/product/singleproduct.phtml"}}

 50. Which of the following code samples will link a configurable product's images to its constituent simple products, in the product details page?
 Answers: • $_parentIdArray = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($_product->getId()); if(sizeof($_parentIdArray)==1 && Mage::getModel('catalog/product')->load($_parentIdArray[0])->getTypeId() == 'configurable'){ $_product = Mage::getModel('catalog/product')->load($_parentIdArray[0]); }

 51. Which of the following will add a new custom block on the product details page after the media block, using a custom module?
 Answers: • <reference name=""> <block type="mymodule/folder_class" after="media" name="mymodule.folder.class" template="mymodule/folder/class.phtml" as="mymodule_folder_class"></block> </reference> <?php echo $this->getChildHtml('mymodule_folder_class');?>

 52. Which of the following methods can be used add a new attribute to all products?
 Answers: • Via the Magento Admin panel (Manage Attributes)

 53. Assuming a left column is going to be added, which of the following are possible values of the block type in the code below?

 <block type="" name="left" as="left" template="page/html/left.phtml" />
 Answers: • page/html

 54. What is the difference between the isSaleable() and isAvailable() functions?
 Answers: • isAvailable() is used to decide whether to display the product as "in stock" or "out of stock", while isSaleable() is used to decide whether to show an "Add to Cart" button or not.

 55. Which of the following Magento classes should be used for adding custom duties/taxes to a quote during the checkout process?
 Answers: • Mage_Sales_Model_Quote_Address_Total_Abstract

 56. Select which conditions can be checked to track down a product that is not showing in a category page.
 Answers: • Product must be enabled;

 57. How can programmatically added bundle products be shown in Magento's front-end?
 Answers: • By using the following codes: Mage::register('product', $product); Mage::register('current_product', $product); $product->setCanSaveConfigurableAttributes(false); $product->setCanSaveCustomOptions(true);

 58. Which of the following is the correct method to use to check if custom options were added to a product?
 Answers: • $product->hasOptions();

 59. Which of the following Events are triggered when the payment has been confirmed?
 Answers: • sales_order_payment_pay

 60. Which of the following statements are true regarding custom options for products in Magento?
 Answers: • If the values for custom options are modified, they would need to be saved, and that will set them for all users.

 61. Which of the following will get a specific product attribute from its product ID without loading the whole product?
 Answers: • Mage::getResourceModel('catalog/product')->getAttributeRawValue($productId, 'attribute_code', $storeId);

 62. Which of the following will display only 'configurable' products in a page?
 Answers: • $collectionConfigurable = Mage::getResourceModel('catalog/product_collection') ->addAttributeToFilter('type_id', array('eq' => 'configurable'));

 63. Which of the following will return the absolute path for a product image in Magento?
 Answers: • A) echo $_product->getImageUrl();

 64. Assuming that a column needs to be added under Catalog >> Manage Products in Magento, which file will need to be edited?
 Answers: • app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Grid.php

 65. Select the correct sequence of methods to use to create a bundle product in Magento.
 Answers: • setBundleOptionsData, setBundleSelectionsData, setCanSaveBundleSelections, setAffectBundleProductSelections

 66. Which of the following code samples will display products from a certain category in random order?
 Answers: • $products = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSort() ->addAttributeToSelect('*'') ->addCategoryFilter(Mage::getModel('catalog/category')->load()); $products->getSelect()->order(new Zend_Db_Expr('RAND()'));

 67. For data security and privacy reasons, Magento uses two cookies for frontend session.
 All I know is that one of them is being set in Mage_Core_Model_Cookie::set(..) and the other one in Zend_Session::expireSessionCookie().
 Why does Magento use the Zend_Session::expireSessionCookie()?
 Answers: • It is the vestigial code, so I was able to delete the Zend cookie without any apparent deleterious effects

 68. Which of the following will add a static block on the site's home page in Magento?
 Answers: • <cms_index_index> <reference name="content"> <block type="cms/block" name="home-page-block"> <action method="setBlockId"><block_id>home-page-block</block_id></action> </block> </reference> <cms_index_index>

 69. Assuming that product images need to be imported from a product import file, which folder should the images be uploaded to, before running the import profile routine?
 Answers: • <MAGENTOROOT>/media/import/

 70. Which of the following methods will allow access to a Magento session from other sites on different subdomains?
 Answers: • needs to be entered in Magento's Admin->System->Configuration->Web->Cookie Domain, to make session cookies available to other subdomains.

 71. Which of the following code samples will detect if the account being checked on the front-end is an admin account?
 Answers: • <?php require_once 'app/Mage.php'; ini_set('display_errors',true); Mage::setIsDeveloperMode(true); umask(0) ; Mage::app(); //get the admin session Mage::getSingleton('core/session', array('name'=>'adminhtml')); //verify if the user is logged in to the backend if(Mage::getSingleton('admin/session')->isLoggedIn()){ echo "Admin Logged in with following details".'<br>'; echo "Admin Username: - ".Mage::getSingleton('admin/session')->getData('user')->getUsername().'<br>'; echo "Admin Encrypted Password: - ".Mage::getSingleton('admin/session')->getData('user')->getPassword().'<br>'; } else { echo "You need to be logged in as an admin."; } ?>

 72. Which of the following will add an external JavaScript file to a Magento page?
 Answers: • <reference name=”head”> <action method=”addJs”><script>folder/file.js</script></action> </reference>

 73. Which of the followings magento features are related to CRM?
 Answers: • All of above

 74. Which of the following statements are true regarding passing data between a controller and a block in Magento?
 Answers: • It can not be done by using Magento's MVC approach, but it can be done by emulating traditional PHP MVC behaviors.

 75. How magento contact form can be shown on a CMS page?
 Answers: • All of above is correct

 76. Which of the following will check if the current request is for a backend page or a frontend page?
 Answers: • Mage::app()->getStore()->isAdmin()

 77. 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
 Answers: • Statement B is true and Statement A is false

 78. What does the Capture method do in the Magento Purchase and Order Processing flow?
 Answers: • Collects funds from the authorized transaction and puts it in the merchant's account.

 79. Which file needs to change to update database when transfer a local Magento install onto live server?
 Answers: • app/etc/local.xml

 80. Which of the following attributes are the data member of magento Mage_Newsletter_Model_Subscriber Class?
 Answers: • All the above

 81. Which of the following will not increase the performance of a Magento site?
 Answers: • Disabling the cache in the admin panel

 82. Which of the following will correctly display the current theme name in Magento?
 Answers: • Mage::getSingleton('core/design_package')->getTheme('frontend');

About sandesh saini

sandesh saini
Recommended Posts × +


Post a Comment