Upwork MAGENTO TEST 2016

Hello Freelancer, Welcome to allupworktestanswers.com Here to get the MAGENTO TEST of Latest version 2016. We are ready here to provide your desire upwork test answer. We already tested all exam test information Available include on here. So Dear, Why Late? Read the below full exam test and get more information from our website. 


1. Which of the following will display a customer’s TAX/VAT number?
Answers:
  1. $taxvat = $order[‘customer_taxvat’];
  2. $order->getData(‘customer_taxvat’);
  3. $order->getQuote()->getCustomerTaxvat();
  4. $order->getData()->getCustomerTaxvat();
2. Why does the error, “front controller reached 100 router match iterations”, occur?
Answers:
  1. There is an error in the code.
  2. Some modules failed to load.
  3. Router references were set incorrectly.
  4. .htacces is blocking URLs.
3. Which of the following will sort products in the catalog by the date they were added?
Answers:
  1. Under “app/code/core/Mage/Catalog/Model/Config.php”, add this value to the $options array: ‘created_at’ => Mage::helper(‘catalog’)->__(‘Date’)
  2. Under “app/code/core/mage/catalog/model/resource/eav/mysql4/product/collection.php”, add this value to the $options array: $this->getSelect()->order(“e.entity_id desc”);
  3. Under “app/code/core/Mage/Catalog/Model/Config.php”, add this value to the $options array: ‘sort_by’ => Mage::helper(‘catalog’)->__(‘Date’)
  4. It’s not possible to sort products in the catalog by date.
4. Is it possible to trigger an event after an order has been set to “processing”?
Answers:
  1. Yes, by using a custom module.
  2. Yes, by registering an event.
  3. No, since it’s a security threat.
  4. No, since no additional action can be added at this stage.
5. Which of the following code samples will get all products sorted by ‘position’, assuming ‘position’ is of a numeric type?
Answers:
  1. $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSelect(‘*’) ->addAttributeToSort(‘position’, ‘ASC’); ->load();
  2. $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSelect(‘*’) ->addOrder(‘position’, ‘ASC’); ->load();
  3. function cmp($a, $b) { if ($a == $b) { return 0; } return ($a < $b) ? -1 : 1; } $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSelect(‘*’) ->load(); usort($products, “cmp”);
  4. function mySortByPosition($a, $b) { if ($a[‘position’] == $b[‘position’]) { return 0; } return ($a[‘position’] < $b[‘position’]) ? -1 : 1; } $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSelect(‘*’) ->addSorter(mySortByPosition) ->load();
6. Which of the following statements are correct about Magento quotes?
Answers:
  1. Quotes are offers to the user, which if the user accepts get converted into orders.
  2. The lifetime of the quote cannot be controlled.
  3. Quotes don’t deal with metadata about the store.
  4. Quotes are not related to order payment and shipping method information.
7. Select which method will register observers/hooks to events in Magento:
Answers:
  1. Mage::registerObserver(‘<EventNameToHook>’,’MyClass::observerFunction’);
  2. Using the option in the Magento Admin panel: System > Configuration > Advanced > Developer > Register Observer
  3. 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>
  4. Mage::registerObserver(‘myglobalobserver’); Function myglobalobserver($event,$args){ switch($event){ case ‘event1’: processevent1($args); break; case ‘event2’: processevent2($args); break; } }
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:
  1. RewriteCond %{HTTP_HOST} ^oldstore.com RewriteRule ^ – [E=MAGE_RUN_CODE:yourOldStoreCode] RewriteRule ^ – [E=MAGE_RUN_TYPE:website]
  2. RewriteCond %{HTTP_HOST} ^newstore.com RewriteRule ^ – [E=MAGE_RUN_CODE:yourNewStoreCode] RewriteRule ^ – [E=MAGE_RUN_TYPE:website]
  3. RewriteCond %{HTTP_HOST} ^newstore.com RewriteRule ^ – [E=MAGE_RUN_CODE:yourStoreCode] RewriteRule ^ – [E=MAGE_RUN_TYPE:website]
  4. RewriteCond %{HTTP_HOST} ^newstore.com 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:
  1. $_SESSION[‘name’] = ‘frontend’;
  2. $session = Mage::getSingleton(“core/session”, array(“name”=>”frontend”)); $session->setData(“device_id”, 4);
  3. Mage::getSingleton( ‘customer/session’ )->setValue( ‘name’, array( 1, 2, 3 ) );
  4. None of the above
10. Which of the following will get information (‘customer_referrer_id’) from a currently logged-in admin user?
Answers:
  1. $collection->addAttributeToFilter(‘customer_referrer_id’, $referrer_id); $referrer_id = Mage::getSingleton(‘admin/session’)->getUser()->getId();
  2. $collection->addAttributeToSelection(‘customer_referrer_id’, $referrer_id); $referrer_id = Mage::getSingleton(‘admin/session’)->getUser()->getId();
  3. $collection->addAttributeToFilter(‘customer_referrer_id’, $referrer_id); $referrer_id = getSingleton(‘admin/session’)->getUser()->getId();
  4. None of these.
11. Which of the following will display a product’s thumbnail?
Answers:
  1. $product->hasThumbnail()) $product->setThumbnail($product->getImage());
  2. <img src=”<?php echo $this->helper(‘catalog/image’)->init($_item->getProductThumbnail(), ‘image’)->resize(50); ?>” alt=”<?php echo $_item->getName() ?>” />
  3. <img src=”<?php echo $_item->getProduct()->getThumbnailUrl() ?>” alt=”<?php echo $_item->getName() ?>” />
  4. <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:
  1. “Module’s alias” / “Class name relative to the alias”
  2. “Controller’s Alias” / “Class name relative to the alias”
  3. “Controller’s Class” / “Method Name”
  4. “Method Name” / “Parameter”
13. Which of the following code samples will display a list of both active and inactive sub-categories of the current category?
Answers:
  1. <?php $_category = $this->getCurrentCategory(); $collection = Mage::getModel(‘catalog/category’)->getCategories($_category->entity_id); $helper = Mage::helper(‘catalog/category’); foreach ($collection as $cat): if($_category->getIsActive()): $cur_category = Mage::getModel(‘catalog/category’)->load($cat->getId()); ?> <a href=”<?php echo $helper->getCategoryUrl($cat);?>”> <?php echo $cat->getName();?> </a> <?php endif; endforeach; ?>
  2. <?php $_category = $this->getCurrentCategory(); $collection = Mage::getModel(‘catalog/category’)->getCategories($_category->entity_id); $helper = Mage::helper(‘catalog/category’); foreach ($collection as $cat): $cur_category = Mage::getModel(‘catalog/category’)->load($cat->getId()); ?> <a href=”<?php echo $helper->getCategoryUrl($cat);?>”> <?php echo $cat->getName();?> </a> <?php endforeach; ?>
  3. <?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; ?>
  4. None of the above.
14. Which of the following will return a visitor’s UserAgent information?
Answers:
  1. Mage::helper(‘core/http’)->getHttpUserAgent()
  2. Mage::helper(‘core/mage’)->getHttpUserAgent()
  3. Mage::helper(‘core/mage’)->getHttpAgent()
  4. Mage::helper(‘core/http’)->getHttpUserServer()
15. How can account navigation links be changed?
Answers:
  1. Using an XML file to define the template
  2. Using a third party module
  3. Either using an XML file to define the template, or using a third party module
  4. None of these.
16. Which of the following will correctly add a custom event in Magento?
Answers:
  1. Mage::registerEvent
  2. Mage::dispatchEvent
  3. Mage::addAction
  4. Mage::registerObserverEvent
17. Which XML file(s) should be checked when the following Magento error occurs during installation?
“PHP Extensions “0” must be loaded”
Answers:
  1. config.xml in app/code/core/Mage/Install/etc
  2. install.xml in app/code/core/Mage/Install/etc
  3. extensions.xml in app/code/core/Mage/Install/etc
  4. None of these
18. Which of the following will set a template only if a particular module is disabled in Magento?
Answers:
  1. <action method=”setTemplate” ifconfig=”advanced/modules_disable_output/Myname_Mymodule”> <template>mytemplate.phtml</template> </action>
  2. Using File: app/code/core/Mage/Core/Model/Layout.php protected function _generateAction($node, $parent) { if (isset($node[‘ifconfig’]) && ($configPath = (string)$node[‘ifconfig’])) { if (!Mage::getStoreConfigFlag($configPath)) { return $this; } }
  3. <action method=”setTemplate”> <template helper=”mymodule/myhelper/switchTemplateIf”/> </action>
  4. None of these.
19. Which of the following XML files will remove an item from Magento’s admin panel navigation?
Answers:
  1. <?xml version=”1.0″ ?> <config> <menu> <xmlconnect> <disabled>1</disabled> </xmlconnect> </menu> </config>
  2. <?xml version=”1.0″ ?> <config> <menu> <xmlconnect> <hide>1</hide> </xmlconnect> </menu> </config>
  3. <?xml version=”1.0″ ?> <config> <menu> <xmlconnect> <delete>1</delete> </xmlconnect> </menu> </config>
  4. Items under the Magento admin panel can’t be removed.
20. Which of the following will get active store information (such as the store’s name) in Magento?
Answers:
  1. Mage::app()->getStore();
  2. Mage::app()->getStoreId();
  3. Mage::app()->getName();
  4. None of the above
21. What is the best way to store session values in Magento?
Answers:
  1. $myValue=’Hello world’; Mage::getSingleton( ‘customer/session’ )->setMyValue($myValue);
  2. $myValue=’Hello world’; Mage::getSingleton( ‘core/session’ )->setMyValue($myValue);
  3. $myValue=’Hello world’; Mage::getSingleton( ‘core/variable’ )->setMyValue($myValue);
  4. $myValue=’Hello world’; $_SESSION[‘MyValue’] = $myValue;
22. The “Suspected Fraud” Order status is grouped under which state?
Answers:
  1. Processing state
  2. Payment Processing state
  3. Pending shipment state
  4. Payment Review state
23. Which of the following needs to be edited to input and display the order attributes in Magento?
Answers:
  1. /app/design/adminhtml/default/default/template/sales/order/view/info.phtml
  2. /app/design/adminhtml/default/default/template/salesext/edit_form.phtml
  3. /app/code/local/CWACI/SalesExt/controllers/Adminhtml/Sales/OrderController.php
  4. 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:
  1. Replace the logo in the base theme skin directory.
  2. Create a new theme and replace the new logo in the skin directory.
  3. Update the logo in all transactional emails.
  4. 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:
  1. When the products are out of stock, but the cart still proceeded to checkout
  2. When the products are in stock, but not in the cart
  3. When no products are available
  4. None of these.
26. Which of the following will change the order of existing blocks via XML?
Answers:
  1. <reference name=”parent.block.name”> <action method=”unsetChild”><alias>child_block_alias</alias></action> <action method=”insert”><blockName>child.block.name</blockName><siblingName>name_of_block</siblingName><after>1</after><alias>child_block_alias</alias></action> </reference>
  2. <reference name=”parent.block.name”> <action method=”insert”><blockName>child.block.name</blockName><siblingName>name_of_block</siblingName><after>1</after><alias>child_block_alias</alias></action> <action method=”unsetChild”><alias>child_block_alias</alias></action> </reference>
  3. <reference name=”child.block.name”> <action method=”unsetParent”><alias>child_block_alias</alias></action> <action method=”insert”><blockName>parent.block.name</blockName><siblingName>name_of_block</siblingName><after>1</after><alias>child_block_alias</alias></action> </reference>
  4. It is not possible to edit the order of existing blocks.
27. Which of the following is the minimum memory requirement for running a Magento site?
Answers:
  1. at least 128MB
  2. at least 256MB
  3. at least 512MB
  4. over 512MB
28. How can the checkout process be skipped for downloadable products in Magento?
Answers:
  1. The checkout step cannot be skipped in Magento.
  2. Downloadable products automatically do not require checkout.
  3. There is an option in the admin panel to skip the checkout step for downloadable products.
  4. Magento does not support downloadable products.
29. Which of the following conditions must be met in order to successfully run a Magento install script?
Answers:
  1. The install script should be placed in MODULE/sql/RESOURCES_KEY/SCRIPT_NAME.
  2. The install script should be named using the convention, mysql4-install-MODULE_VERSION.php
  3. The module version in config.xml and in the install script file name must be same.
  4. 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:
  1. Database table ‘core_config_data’
  2. config.inc file at magento root
  3. app/etc/config.xml
  4. app/etc/local.xml
31. What is the best way to create global variables which can be used everywhere in Magento?
Answers:
  1. Creating a empty module and adding a system.xml file to it
  2. Using the Magento Admin panel: System > Custom Variables > create a new custom variable
  3. Via a Magento Session $myValue = ‘Hello World’; Mage::getSingleton(‘core/session’)->setMyValue($myValue);
  4. $myValue = ‘Hello World’; Mage::getModel(‘core/variable’)->addMyValue($myValue);
32. The browser is ignoring the file referred on the code below:
<link src=”http://siteurl.com/theme/skin/frontend/default/mytheme/css/colors.css.php” 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:
  1. There is no solution; a PHP file cannot be used as a stylesheet.
  2. Use the “href” attribute instead of “src” to specify the file’s location, as in: <link href=”http://siteurl.com/theme/skin/frontend/default/mytheme/css/colors.css.php” rel=”stylesheet” type=”text/css”>
  3. Call a static CSS file instead of using a PHP file as a stylesheet.
  4. Send a valid Content-Type HTTP header, as in: header(“content-type: text/css”);
33. What is the recommended way to override/extend Magento core functionality?
Answers:
  1. Directly edit the core files of Magento with proper commenting.
  2. Mage::registerOverride(‘CoreClassName’,’CoreFunctionName’,’MyClassName’,’MyFunctionname’);
  3. Copy the original Magento core file to the app/code/local folder and customize that file.
  4. 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
34. An observer in Magento is defined as a:
Answers:
  1. Method
  2. Class
  3. Event
  4. None of these.
35. What is the difference between “Flush Magento Cache” and “Flush Cache Storage” in the Magento Cache Management System?
Answers:
  1. “Flush Magento Cache” removes “/tmp/” folder’s cache only, while “Flush Cache Storage” clears everything.
  2. “Flush Cache Storage” removes “/tmp/” folder’s cache only, while “Flush Magento Cache” clears everything.
  3. “Flush Magento Cache” and “Flush Cache Storage” are equivalent; they work the same way.
  4. None of the above.
36. Which of the following will get a list of products belonging to a specific category within a view file?
Answers:
  1. $productCollection = Mage::getResourceModel(‘catalog/product_collection’) ->addCategoryFilter($category);
  2. {{block type=”catalog/product_list” category_id=”7″ template=”catalog/product/list.phtml”}}
  3. $productCollection = Mage::getResourceModel(‘catalog/product_collection’) ->addFilter($category);
  4. $productCollection = Mage::getModel(‘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:
  1. $categories = Mage::getModel(‘catalog/category’) ->getCollection(); foreach ($categories as $category) { print $category->getName(); $categoryDetails = Mage::getModel(‘catalog/category’)->load($category->getId()); $products = $categoryDetails->loadChildProducts(); foreach($products as $product){ Print $product->getName(); } }
  2. $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(); } }
  3. $categories = Mage::getModel(‘catalog/category’) ->getCollection() ->setLoadProducts(true); foreach ($categories as $category) { print $category->getName(); foreach($category->getProducts() as $product){ print $product->getName(); } }
  4. $products = Mage::getModel(‘catalog/product’) ->getCollection(); foreach ($products as $product) { print $product->getCategory()->getName(); print $product->getName(); }
38. Which of the following will call a static block inside one of Magento’s template files?
Answers:
  1. $this->setBlockId(‘my_static_block_name’)->toHtml()
  2. $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘my_static_block_name’)->toHtml()
  3. $this->createBlock(‘cms/block’)->setBlockId(‘my_static_block_name’)->toHtml()
  4. $this->getLayout()->createBlock(‘cms/block’)->BlockId(‘my_static_block_name’)->toHtml()
39. Which of the following Magento objects will be created during checkout?
Answers:
  1. sales/payment
  2. sales/tax
  3. sales/order
  4. 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:
  1. <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>
  2. <catalog_product_view> <reference name=”right”> <action method=”unsetChild”> <block>catalog.product.related</block> </action> </reference> <reference name=”product.info”> <action method=”insert”> <block>catalog.product.related</block> <after>1</after> </action> </reference> </catalog_product_view>
  3. <catalog_product_view> <reference name=”right”> <action method=”unsetChild”> <block>catalog.product.related</block> </action> </reference> <reference name=”product.info”> <action method=”insert”> <block>catalog.product.related</block> <after>0</after> </action> </reference> </catalog_product_view>
  4. None of the above.
41. What is the correct method to add an external JavaScript file to Magento’s local.xml file?
Answers:
  1. <action method=”addScript”><script>jquery/jquery.js</script></action>
  2. <action method=”addCss”><script>jquery/jquery.js</script></action>
  3. <action method=”addJS”><script>jquery/jquery.js</script></action>
  4. None of the above
42. Which of the following will check whether the currently logged-in customer ever placed an order at the Magento store?
Answers:
  1. $order = Mage::getModel(‘sales/order’)->getCollection() ->addAttributeToFilter(‘customer_id’,$session->getId()) ->getFirstItem(); if ($orders->getSizeValue()) { }
  2. $orders = Mage::getResourceModel(‘sales/order_collection’) ->addFieldToSelect(‘*’) ->addFieldToFilter(‘entity_id’, $customer->getEntityId()); if ($orders->getSize()) { }
  3. $orders = Mage::getResourceModel(‘sales/order_collection’) ->addFieldToFilter(‘customer_id’, $customer->getId()); if ($orders->getValue()) { }
  4. $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:
  1. By adding column name in Model
  2. By adding column name in Controller
  3. By adding column name in Block
  4. By defining column name in Block and table
44. Which of the following will get the order increment ID in Magento?
Answers:
  1. $order = Mage::getSingleton(‘sales/order’)->getLastOrderId(); $lastOrderId = $order->getIncrementId();
  2. $orderId = $this->getOrderId();
  3. $order = Mage::getModel(‘sales/order’); $order->load(Mage::getSingleton(‘sales/order’)->getLastOrderId()); $lastOrderId = $order->getIncrementId();
  4. None of these.
45. Which of the following will get the tax amount on a page in Magento?
Answers:
  1. Mage::helper(‘checkout’)->getQuote()->getShippingAddress()->getData(‘tax_amount’);
  2. $totalItemsInCart = Mage::helper(‘checkout/cart’)->getItemsCount(); $totals = Mage::getSingleton(‘checkout/session’)->getQuote()->getTotals(); $subtotal = round($totals[“subtotal”]->getValue()); $grandtotal = round($totals[“grand_total”]->getValue()); >if(isset($totals[‘discount’]) && $totals[‘discount’]->getValue()) { $discount = round($totals[‘discount’]->getValue()); } else { $discount = ”; } if(isset($totals[‘tax’]) && $totals[‘tax’]->getValue()) { $tax = round($totals[‘tax’]->getValue()); } else { $tax = ”; }
  3. $order = Mage::getModel(‘sales/order’)->load($order_id); $items = $order->getAllItems(); $subtotals = array(); foreach ($items as $_item) { if (array_key_exists($subtotals[$_item->getTaxClassId()])) { $subtotals[$_item->getTaxClassId()] += $_item->getRowTotal(); } else { $subtotals[$_item->getTaxClassId()] = $_item->getRowTotal(); } }
  4. <?php $order = Mage::getModel(‘sales/order’)->loadByIncrementId($this->getOrderId()); $data = $order->getData(); ?>
46. Which of the following will retrieve a list of all shipping methods in Magento?
Answers:
  1. 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; }
  2. $salesQuoteRate = Mage::getModel(‘sales/quote_address_rate’)->load($rate_id); if($salesQuoteRate){ echo ‘<br/>CODE : ‘.$salesQuoteRate->getCode(); echo ‘<br/>METHOD : ‘.$salesQuoteRate->getMethod(); }
  3. $iOrderId = Mage::getSingleton(‘checkout/session’)->getLastRealOrderId(); $oOrder = Mage::getModel(‘sales/order’)->loadByIncrementId($iOrderId); echo $oOrder->getShippingMethod(); echo $oOrder->getShippingDescription();
  4. echo Mage::getSingleton(‘checkout/session’)->getQuote()->getShippingAddress()->getShippingMethod();
47. Which of the following will list all products from a particular category?
Answers:
  1. $products = Mage::getModel(‘catalog/category’)->load($category_id) ->getProductCollection() ->addAttributeToSelect(‘*’) ->addAttributeToFilter(‘status’, 1) ->addAttributeToFilter(‘visibility’, 4) ->addAttributeToFilter(‘special_price’, array(‘neq’ => “”)) ->setOrder(‘price’, ‘ASC’) ;
  2. $productCollection = Mage::getResourceModel(‘catalog/product_collection’) ->addCategoryFilter($category);
  3. $products = Mage::get((‘catalog/category’)->load($category_id) ->getCollection() ->addAttributeToSelect(‘*’) ->addAttributeToFilter(‘status’, 1) ->addAttributeToFilter(‘visibility’, 4) ->addAttributeToFilter(‘special_price’, array(‘neq’ => “”)) ->setOrder(‘price’, ‘ASC’) ;
  4. $products = Mage::getModel(‘catalog/category’)->load($category_id) ->getProduct() ->addAttributeToSelect(‘*’) ->addAttributeToFilter(‘status’, 1) ->addAttributeToFilter(‘visibility’, 4) ->addFilter(‘special_price’, array(‘neq’ => “”)) ->setOrder(‘price’, ‘ASC’) ;
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. 1 Custom default theme 2 Magento base theme 3 Custom non-default theme
  2. 1 Magento base theme 2 Custom default theme 3 Custom non-default theme
  3. 1 Custom non-default theme 2 Custom default theme 3 Magento base theme
  4. None of the above
49. What is the correct method for calling a single product inside a static block?
Answers:
  1. {{block type=”media/product_single” product_id=”1″ template=”catalog/product/singleproduct.phtml”}}
  2. {{block type=”catalog/product_single” product_id=”1″ template=”catalog/product/singleproduct.phtml”}}
  3. {{block type=”all/product_single” product_id=”1″ template=”catalog/product/singleproduct.phtml”}}
  4. {{block type=”categories/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:
  1. $_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]); }
  2. $_childIdArray = Mage::getModel(‘catalog/product_type_configurable’)->getChildIds($_product->getId()); if(sizeof($_childIdArray)==1 && Mage::getModel(‘catalog/product’)->load($_childIdArray[0])->getTypeId() == ‘configurable’){ $_product = Mage::getModel(‘catalog/product’)->load($_childIdArray[0]); }
  3. $_parentIdArray = Mage::getModel(‘catalog/product’)->getIdsByChild($_product->getId()); if(sizeof($_parentIdArray) >= 1 && Mage::getModel(‘catalog/product’)->load($_parentIdArray[0])->getTypeId() == ‘configurable’){ $_product = Mage::getModel(‘catalog/product’)->load($_parentIdArray[0]); }
  4. $_childIdArray = Mage::getModel(‘catalog/product’)->getChildIdsByParent($_product->getId()); if(sizeof($_childIdArray)==1 && Mage::getModel(‘catalog/product’)->load($_childIdArray[0])->getTypeId() == ‘configurable’){ $_product = Mage::getModel(‘catalog/product’)->load($_childIdArray[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:
  1. <reference name=”product.info”> <block type=”mymodule/folder_class” name=”mymodule.folder.class” template=”mymodule/folder/class.phtml” as=”mymodule_folder_class”></block> </reference>
  2. <reference name=”product.info”> <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’);?>
  3. <reference name=”product.info”> <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_class’);?>
  4. None of the above.
52. Which of the following methods can be used add a new attribute to all products?
Answers:
  1. Using XML layout files
  2. By creating a new field in the database table named ‘catalog_attributes’
  3. Via the Magento Admin panel (Manage Attributes)
  4. By creating a new module
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:
  1. catalog/navigation
  2. core/text_list
  3. page/template_container
  4. page/html
54. What is the difference between the isSaleable() and isAvailable() functions?
Answers:
  1. isAvailable() is used to decide whether to show an “Add to Cart” button or not, while isSaleable() is used to decide whether to display the product as “in stock” or “out of stock”.
  2. There is no difference between the two functions.
  3. isSaleable() checks if the product’s type can be sold, while isAvailable() checks if the product itself can be sold.
  4. 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:
  1. Mage_Sales_Model_Quote_Item_Option
  2. Mage_Sales_Model_Quote_Address_Total_Abstract
  3. Mage_Sales_Model_Quote_Item
  4. Mage_Sales_Model_Quote_Payment
56. Select which conditions can be checked to track down a product that is not showing in a category page.
Answers:
  1. Product visibility must be “Listed”;
  2. Product must be enabled;
  3. Stock and quantity must be greater than 0;
  4. If using multiple websites, check which website the product points to;
57. How can programmatically added bundle products be shown in Magento’s front-end?
Answers:
  1. By re-indexing
  2. By using the following codes: Mage::register(‘product’, $product); Mage::register(‘current_product’, $product); $product->setCanSaveConfigurableAttributes(false); $product->setCanSaveCustomOptions(true);
  3. By using the following: 1. setBundleOptionsData() 2. setBundleSelectionsData() 3. setCanSaveBundleSelections(true)
  4. It is not possible to show programmatically added bundle products in the front-end.
58. Which of the following is the correct method to use to check if custom options were added to a product?
Answers:
  1. $product->hasCustomType();
  2. $product->hasCustomOptions();
  3. $product->hasOptions();
  4. $product->hasOptionsType();
59. Which of the following Events are triggered when the payment has been confirmed?
Answers:
  1. checkout_onepage_controller_success_action
  2. checkout_payment_confirmed
  3. sales_order_payment_pay
  4. payment_confirmed_action
60. Which of the following statements are true regarding custom options for products in Magento?
Answers:
  1. Custom options are only stored on the quote as option IDs and values.
  2. Every time the options are rendered, they are reloaded from the database.
  3. If the values for custom options are modified, they would need to be saved, and that will set them for all users.
  4. None of these.
61. Which of the following will get a specific product attribute from its product ID without loading the whole product?
Answers:
  1. Mage::getResourceModel(‘catalog/product’)->getAttributeRawValue($productId, ‘attribute_code’, $storeId);
  2. $product->getResource()->getAttribute($attribute_code)->getFrontend()->getValue($product);
  3. $object->getData($this->getAttribute()->getAttributeCode());
  4. None of the above
62. Which of the following will display only ‘configurable’ products in a page?
Answers:
  1. $_productCollection = $this ->getLoadedProductCollection() ->addAttributeToFilter(‘type_id’,’configurable’);
  2. <?php if($_product->getTypeId() == “configurable”): ?> <?php $_configurable = $_product->getTypeInstance()->getUsedProductIds(); ?> <?php foreach ($_configurable as $_config): ?> <?php $_simpleproduct = Mage::getModel(‘catalog/product’)->load($_config); ?> <?php //Magic php with a $_simpleproduct. ?> <?php endforeach; ?> <?php endif; ?>
  3. $_productCollection = $this->getLoadedProductCollection(); foreach ($_productCollection as $_product) { if ($_product->_data[‘type_id’] == ‘configurable’) { … } }
  4. $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:
  1. A) echo $_product->getImageUrl();
  2. B) echo $_product->getImagePath();
  3. C) Both A and B
  4. D) None of the above
64. Assuming that a column needs to be added under Catalog >> Manage Products in Magento, which file will need to be edited?
Answers:
  1. app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Layout.php
  2. app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Grid.php
  3. app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Design.php
  4. A custom column cannot be added under Catalog >> Manage Products.
65. Select the correct sequence of methods to use to create a bundle product in Magento.
Answers:
  1. setBundleOptionsData, setBundleSelectionsData, setCanSaveBundleSelections, setAffectBundleProductSelections
  2. setBundleOptionsData,setCanSaveBundleSelections,setBundleSelectionsData,setAffectBundleProductSelections
  3. setBundleOptionsData, setBundleSelectionsData, setAffectBundleProductSelections, saveBundleOptions
  4. setBundleOptionsData, setCanSaveBundleSelections,setSelectionCollection, setAffectBundleProductSelections
66. Which of the following code samples will display products from a certain category in random order?
Answers:
  1. $_productCollection = Mage::getResourceModel(‘catalog/product_collection’); Mage::getModel(‘catalog/layer’)->prepareProductCollection($_productCollection); $_productCollection->getSelect()->order(‘rand()’);
  2. $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSort() ->addAttributeToSelect(‘*”) ->addCategoryFilter(Mage::getModel(‘catalog/category’)->load()); $products->getSelect()->order(new Zend_Db_Expr(‘RAND()’));
  3. $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSort(‘id’, ‘RAND()’) ->addAttributeToSelect(‘small_image’) ->addCategoryFilter(Mage::getModel(‘catalog/category’) ->load($catId));
  4. $_productCollection = Mage::getResourceModel(‘catalog/product_collection’); Mage::getModel(‘catalog/layer’)->prepareProductCollection($_productCollection); $_productCollection->getSelect()->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:
  1. Because it is necessary for magento and you must use that session.
  2. Because Magento relies heavily on the Zend Framework as the underpinning and it will be able to be ignored.
  3. Because Magento relies heavily on the Zend Framework as the underpinning and I must use that for frontend session without condition.
  4. 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:
  1. <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>
  2. <?php $ref = new Mage_Page_Block_Html_Header(); if($ref->getIsHomePage()){ ?> <?php echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘Your_StaticBlock_Id’)->toHtml();?> <?php } ?>
  3. <cms_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>
  4. <cms_index> <reference name=”homepage”> <block type=”cms/block” name=”home-page-block”> <action method=”setBlockId”><block_id>home-page-block</block_id></action> </block> </reference> <cms_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:
  1. <MAGENTOROOT>/media/
  2. <MAGENTOROOT>/media/import/
  3. <MAGENTOROOT>/import/
  4. <MAGENTOURL>/
70. Which of the following methods will allow access to a Magento session from other sites on different subdomains?
Answers:
  1. subdomain.domain.com needs to be entered in Magento’s Admin->System->Configuration->Web->Cookie Domain, to make session cookies available to other subdomains.
  2. subdomain.domain.com needs to be entered in Magento’s app/code/core/Mage/Core/Model/Config.php file, to make session cookies available to other subdomains.
  3. Allowing access to session cookies from other subdomains is not part of Magento’s core functionality, but it can be achieved using extensions.
  4. It is not possible to access a Magento site’s cookies on a different subdomain.
71. Which of the following code samples will detect if the account being checked on the front-end is an admin account?
Answers:
  1. <?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.”; } ?>
  2. <?php Mage::getSingleton(‘core/session’, array(‘name’=>’adminhtml’) ); $adminsession = Mage::getSingleton(‘admin/session’, array(‘name’=>’adminhtml’)); if($adminsession->isLoggedIn()) { echo “<br>”. “Admin Logged in”; } else { echo “<br>”. “Admin NOT logged in”; } ?>
  3. $sesId = isset($_COOKIE[‘adminhtml’]) ? $_COOKIE[‘adminhtml’] : false ; $session = false; if($sesId){ $session = Mage::getSingleton(‘core/resource_session’)->read($sesId); } $loggedIn = false; if($session) { if(stristr($session,’Mage_Admin_Model_User’)) { $loggedIn = true; } } var_dump($loggedIn);
  4. $userArray = Mage::getSingleton(‘admin/session’)->getData(); $user = Mage::getSingleton(‘admin/session’); echo $userId = $user->getUser()->getUserId(); echo $userEmail = $user->getUser()->getEmail(); echo $userFirstname = $user->getUser()->getFirstname(); echo $userLastname = $user->getUser()->getLastname(); echo $userUsername = $user->getUser()->getUsername(); echo $userPassword = $user->getUser()->getPassword();
72. Which of the following will add an external JavaScript file to a Magento page?
Answers:
  1. <reference name=”head”> <action method=”addJs”><script>folder/file.js</script></action> </reference>
  2. <action method=”addJs”> <script>http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js</script> </action>
  3. <action method=”Jsadd”> <script>http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js</script> </action>
  4. <action method=”addJs”>http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js</action>
73. Which of the followings magento features are related to CRM?
Answers:
  1. Newsletters
  2. Contact and Transactional Emails
  3. Poll
  4. All of above
74. Which of the following statements are true regarding passing data between a controller and a block in Magento?
Answers:
  1. It can not be done by using Magento’s MVC approach, but it can be done by emulating traditional PHP MVC behaviors.
  2. It can not be done by emulating traditional PHP MVC behaviors, but it can be done by using Magento’s MVC approach.
  3. 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’);
  4. 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’);
75. How magento contact form can be shown on a CMS page?
Answers:
  1. By using block syntax {{block type=”core/template” name=”contactForm” template=”contacts/form.phtml”}}
  2. By Using Layout Update <reference name=”content”> <block type=”core/template” name=”contactForm” template=”contacts/form.phtml”/> </reference>
  3. By Creating an Widget of Contact form and adding that widget to CMS page
  4. 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:
  1. Mage::app()->getStore()->isAdmin()
  2. Mage::code()->getStore()->isAdminArea()
  3. Mage::app()->getStore()->Admin()
  4. Mage::app()->getStore()->AdminHtml()
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:
  1. Statement A is true and Statement B is false
  2. Statement B is true and Statement A is false
  3. Both statements are true.
  4. Both statements are false.
78. What does the Capture method do in the Magento Purchase and Order Processing flow?
Answers:
  1. Sends an authorization request to the payment gateway’s API.
  2. Collects funds from the authorized transaction and puts it in the merchant’s account.
  3. Throws an exception when authorization has failed.
  4. Collects the order and makes the shipment.
79. Which file needs to change to update database when transfer a local Magento install onto live server?
Answers:
  1. app/etc/config.xml
  2. app/db/config.xml
  3. app/etc/local.xml
  4. app/code/core/db/local.xml
80. Which of the following attributes are the data member of magento Mage_Newsletter_Model_Subscriber Class?
Answers:
  1. STATUS_SUBSCRIBED
  2. STATUS_NOT_ACTIVE
  3. STATUS_UNSUBSCRIBED
  4. All the above
81. Which of the following will not increase the performance of a Magento site?
Answers:
  1. Reducing the time spent on creation of the blocks
  2. Disabling the cache in the admin panel
  3. Switching on compiler mode
  4. Using auto-optimization extensions
82. Which of the following will correctly display the current theme name in Magento?
Answers:
  1. Mage::getSingleton(‘core/design_package’)->getName();
  2. Mage::getDesignPackage()->getName();
  3. Mage::getSingleton(‘core/design_package’)->getTheme(‘frontend’);
  4. Mage::getSingleton(‘core/design_package’)->getName(‘package’);

Finally no more words require about the MAGENTO TEST  information in this session of this content. If you are require knowing more, Please ask to us via our contact us form or comment box. Please make sure that, you don’t send Personal information via the Comment box.  Thank you very mutch for being with us.

0 comments: