Upwork Magento Test 2016.
82 Answered Test Questions:
1. Which of the following will display a customer’s TAX/VAT number?
Answers:
a. $taxvat = $order[‘customer_taxvat’];
a. $order->getData(‘customer_taxvat’);
a. $order->getQuote()->getCustomerTaxvat();
a. $order->getData()->getCustomerTaxvat();
2. Why does the error, “front controller reached 100 router match iterations”, occur?
Answers:
a. There is an error in the code.
a. Some modules failed to load.
a. Router references were set incorrectly.
a. .htacces is blocking URLs.
3. Which of the following will sort products in the catalog by the date they were added?
Answers:
a. Under “app/code/core/Mage/Catalog/Model/Config.php”, add this value to the $options array: ‘created_at’ => Mage::helper(‘catalog’)->__(‘Date’)
a. 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”);
a. Under “app/code/core/Mage/Catalog/Model/Config.php”, add this value to the $options array: ‘sort_by’ => Mage::helper(‘catalog’)->__(‘Date’)
a. 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:
a. Yes, by using a custom module.
a. Yes, by registering an event.
a. No, since it’s a security threat.
a. 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:
a. $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSelect(‘*’) ->addAttributeToSort(‘position’, ‘ASC’); ->load();
a. $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSelect(‘*’) ->addOrder(‘position’, ‘ASC’); ->load();
a. 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”);
a. 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:
a. Quotes are offers to the user, which if the user accepts get converted into orders.
a. The lifetime of the quote cannot be controlled.
a. Quotes don’t deal with metadata about the store.
a. Quotes are not related to order payment and shipping method information.
7. Select which method will register observers/hooks to events in Magento:
Answers:
a. Mage::registerObserver(‘’,’MyClass::observerFunction’);
a. Using the option in the Magento Admin panel: System > Configuration > Advanced > Developer > Register Observer
a. Registering observers using the XML layout of the module: singleton company_module_model_observer methodToCall
a. 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:
a. RewriteCond %{HTTP_HOST} ^oldstore.com RewriteRule ^ – [E=MAGE_RUN_CODE:yourOldStoreCode] RewriteRule ^ – [E=MAGE_RUN_TYPE:website]
a. RewriteCond %{HTTP_HOST} ^newstore.com RewriteRule ^ – [E=MAGE_RUN_CODE:yourNewStoreCode] RewriteRule ^ – [E=MAGE_RUN_TYPE:website]
a. RewriteCond %{HTTP_HOST} ^newstore.com RewriteRule ^ – [E=MAGE_RUN_CODE:yourStoreCode] RewriteRule ^ – [E=MAGE_RUN_TYPE:website]
a. 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:
a. $_SESSION[‘name’] = ‘frontend’;
a. $session = Mage::getSingleton(“core/session”, array(“name”=>”frontend”)); $session->setData(“device_id”, 4);
a. Mage::getSingleton( ‘customer/session’ )->setValue( ‘name’, array( 1, 2, 3 ) );
a. None of the above
10. Which of the following will get information (‘customer_referrer_id’) from a currently logged-in admin user?
Answers:
a. $collection->addAttributeToFilter(‘customer_referrer_id’, $referrer_id); $referrer_id = Mage::getSingleton(‘admin/session’)->getUser()->getId();
a. $collection->addAttributeToSelection(‘customer_referrer_id’, $referrer_id); $referrer_id = Mage::getSingleton(‘admin/session’)->getUser()->getId();
a. $collection->addAttributeToFilter(‘customer_referrer_id’, $referrer_id); $referrer_id = getSingleton(‘admin/session’)->getUser()->getId();
a. None of these.
11. Which of the following will display a product’s thumbnail?
Answers:
a. $product->hasThumbnail()) $product->setThumbnail($product->getImage());
a.
a.
a.
12. Consider the following code:
1. Which of the following will display a customer’s TAX/VAT number?
Answers:
a. $taxvat = $order[‘customer_taxvat’];
a. $order->getData(‘customer_taxvat’);
a. $order->getQuote()->getCustomerTaxvat();
a. $order->getData()->getCustomerTaxvat();
2. Why does the error, “front controller reached 100 router match iterations”, occur?
Answers:
a. There is an error in the code.
a. Some modules failed to load.
a. Router references were set incorrectly.
a. .htacces is blocking URLs.
3. Which of the following will sort products in the catalog by the date they were added?
Answers:
a. Under “app/code/core/Mage/Catalog/Model/Config.php”, add this value to the $options array: ‘created_at’ => Mage::helper(‘catalog’)->__(‘Date’)
a. 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”);
a. Under “app/code/core/Mage/Catalog/Model/Config.php”, add this value to the $options array: ‘sort_by’ => Mage::helper(‘catalog’)->__(‘Date’)
a. 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:
a. Yes, by using a custom module.
a. Yes, by registering an event.
a. No, since it’s a security threat.
a. 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:
a. $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSelect(‘*’) ->addAttributeToSort(‘position’, ‘ASC’); ->load();
a. $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSelect(‘*’) ->addOrder(‘position’, ‘ASC’); ->load();
a. 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”);
a. 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:
a. Quotes are offers to the user, which if the user accepts get converted into orders.
a. The lifetime of the quote cannot be controlled.
a. Quotes don’t deal with metadata about the store.
a. Quotes are not related to order payment and shipping method information.
7. Select which method will register observers/hooks to events in Magento:
Answers:
a. Mage::registerObserver(‘’,’MyClass::observerFunction’);
a. Using the option in the Magento Admin panel: System > Configuration > Advanced > Developer > Register Observer
a. Registering observers using the XML layout of the module: singleton company_module_model_observer methodToCall
a. 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:
a. RewriteCond %{HTTP_HOST} ^oldstore.com RewriteRule ^ – [E=MAGE_RUN_CODE:yourOldStoreCode] RewriteRule ^ – [E=MAGE_RUN_TYPE:website]
a. RewriteCond %{HTTP_HOST} ^newstore.com RewriteRule ^ – [E=MAGE_RUN_CODE:yourNewStoreCode] RewriteRule ^ – [E=MAGE_RUN_TYPE:website]
a. RewriteCond %{HTTP_HOST} ^newstore.com RewriteRule ^ – [E=MAGE_RUN_CODE:yourStoreCode] RewriteRule ^ – [E=MAGE_RUN_TYPE:website]
a. 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:
a. $_SESSION[‘name’] = ‘frontend’;
a. $session = Mage::getSingleton(“core/session”, array(“name”=>”frontend”)); $session->setData(“device_id”, 4);
a. Mage::getSingleton( ‘customer/session’ )->setValue( ‘name’, array( 1, 2, 3 ) );
a. None of the above
10. Which of the following will get information (‘customer_referrer_id’) from a currently logged-in admin user?
Answers:
a. $collection->addAttributeToFilter(‘customer_referrer_id’, $referrer_id); $referrer_id = Mage::getSingleton(‘admin/session’)->getUser()->getId();
a. $collection->addAttributeToSelection(‘customer_referrer_id’, $referrer_id); $referrer_id = Mage::getSingleton(‘admin/session’)->getUser()->getId();
a. $collection->addAttributeToFilter(‘customer_referrer_id’, $referrer_id); $referrer_id = getSingleton(‘admin/session’)->getUser()->getId();
a. None of these.
11. Which of the following will display a product’s thumbnail?
Answers:
a. $product->hasThumbnail()) $product->setThumbnail($product->getImage());
a.
a.
a.
12. Consider the following code:
What is the meaning of A/B?
Answers:
a. “Module’s alias” / “Class name relative to the alias”
a. “Controller’s Alias” / “Class name relative to the alias”
a. “Controller’s Class” / “Method Name”
a. “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:
a.
a.
a.
a. None of the above.
14. Which of the following will return a visitor’s UserAgent information?
Answers:
a. Mage::helper(‘core/http’)->getHttpUserAgent()
a. Mage::helper(‘core/mage’)->getHttpUserAgent()
a. Mage::helper(‘core/mage’)->getHttpAgent()
a. Mage::helper(‘core/http’)->getHttpUserServer()
15. How can account navigation links be changed?
Answers:
a. Using an XML file to define the template
a. Using a third party module
a. Either using an XML file to define the template, or using a third party module
a. None of these.
16. Which of the following will correctly add a custom event in Magento?
Answers:
a. Mage::registerEvent
a. Mage::dispatchEvent
a. Mage::addAction
a. 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:
a. config.xml in app/code/core/Mage/Install/etc
a. install.xml in app/code/core/Mage/Install/etc
a. extensions.xml in app/code/core/Mage/Install/etc
a. None of these
18. Which of the following will set a template only if a particular module is disabled in Magento?
Answers:
a. mytemplate.phtml
a. 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; } }
a.
a. None of these.
19. Which of the following XML files will remove an item from Magento’s admin panel navigation?
Answers:
a.
Answers:
a. “Module’s alias” / “Class name relative to the alias”
a. “Controller’s Alias” / “Class name relative to the alias”
a. “Controller’s Class” / “Method Name”
a. “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:
a.
a.
a.
a. None of the above.
14. Which of the following will return a visitor’s UserAgent information?
Answers:
a. Mage::helper(‘core/http’)->getHttpUserAgent()
a. Mage::helper(‘core/mage’)->getHttpUserAgent()
a. Mage::helper(‘core/mage’)->getHttpAgent()
a. Mage::helper(‘core/http’)->getHttpUserServer()
15. How can account navigation links be changed?
Answers:
a. Using an XML file to define the template
a. Using a third party module
a. Either using an XML file to define the template, or using a third party module
a. None of these.
16. Which of the following will correctly add a custom event in Magento?
Answers:
a. Mage::registerEvent
a. Mage::dispatchEvent
a. Mage::addAction
a. 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:
a. config.xml in app/code/core/Mage/Install/etc
a. install.xml in app/code/core/Mage/Install/etc
a. extensions.xml in app/code/core/Mage/Install/etc
a. None of these
18. Which of the following will set a template only if a particular module is disabled in Magento?
Answers:
a. mytemplate.phtml
a. 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; } }
a.
a. None of these.
19. Which of the following XML files will remove an item from Magento’s admin panel navigation?
Answers:
a.
a.
a.
a. 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:
a. Mage::app()->getStore();
a. Mage::app()->getStoreId();
a. Mage::app()->getName();
a. None of the above
21. What is the best way to store session values in Magento?
Answers:
a. $myValue=’Hello world’; Mage::getSingleton( ‘customer/session’ )->setMyValue($myValue);
a. $myValue=’Hello world’; Mage::getSingleton( ‘core/session’ )->setMyValue($myValue);
a. $myValue=’Hello world’; Mage::getSingleton( ‘core/variable’ )->setMyValue($myValue);
a. $myValue=’Hello world’; $_SESSION[‘MyValue’] = $myValue;
22. The “Suspected Fraud” Order status is grouped under which state?
Answers:
a. Processing state
a. Payment Processing state
a. Pending shipment state
a. Payment Review state
23. Which of the following needs to be edited to input and display the order attributes in Magento?
Answers:
a. /app/design/adminhtml/default/default/template/sales/order/view/info.phtml
a. /app/design/adminhtml/default/default/template/salesext/edit_form.phtml
a. /app/code/local/CWACI/SalesExt/controllers/Adminhtml/Sales/OrderController.php
a. 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:
a. Replace the logo in the base theme skin directory.
a. Create a new theme and replace the new logo in the skin directory.
a. Update the logo in all transactional emails.
a. 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:
a. When the products are out of stock, but the cart still proceeded to checkout
a. When the products are in stock, but not in the cart
a. When no products are available
a. None of these.
26. Which of the following will change the order of existing blocks via XML?
Answers:
a. child_block_alias child.block.namename_of_block1child_block_alias
a. child.block.namename_of_block1child_block_alias child_block_alias
a. child_block_alias parent.block.namename_of_block1child_block_alias
a. 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:
a. at least 128MB
a. at least 256MB
a. at least 512MB
a. over 512MB
28. How can the checkout process be skipped for downloadable products in Magento?
Answers:
a. The checkout step cannot be skipped in Magento.
a. Downloadable products automatically do not require checkout.
a. There is an option in the admin panel to skip the checkout step for downloadable products.
a. 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:
a. The install script should be placed in MODULE/sql/RESOURCES_KEY/SCRIPT_NAME.
a. The install script should be named using the convention, mysql4-install-MODULE_VERSION.php
a. The module version in config.xml and in the install script file name must be same.
a. 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:
a. Database table ‘core_config_data’
a. config.inc file at magento root
a. app/etc/config.xml
a. app/etc/local.xml
31. What is the best way to create global variables which can be used everywhere in Magento?
Answers:
a. Creating a empty module and adding a system.xml file to it
a. Using the Magento Admin panel: System > Custom Variables > create a new custom variable
a. Via a Magento Session $myValue = ‘Hello World’; Mage::getSingleton(‘core/session’)->setMyValue($myValue);
a. $myValue = ‘Hello World’; Mage::getModel(‘core/variable’)->addMyValue($myValue);
32. The browser is ignoring the file referred on the code below:
20. Which of the following will get active store information (such as the store’s name) in Magento?
Answers:
a. Mage::app()->getStore();
a. Mage::app()->getStoreId();
a. Mage::app()->getName();
a. None of the above
21. What is the best way to store session values in Magento?
Answers:
a. $myValue=’Hello world’; Mage::getSingleton( ‘customer/session’ )->setMyValue($myValue);
a. $myValue=’Hello world’; Mage::getSingleton( ‘core/session’ )->setMyValue($myValue);
a. $myValue=’Hello world’; Mage::getSingleton( ‘core/variable’ )->setMyValue($myValue);
a. $myValue=’Hello world’; $_SESSION[‘MyValue’] = $myValue;
22. The “Suspected Fraud” Order status is grouped under which state?
Answers:
a. Processing state
a. Payment Processing state
a. Pending shipment state
a. Payment Review state
23. Which of the following needs to be edited to input and display the order attributes in Magento?
Answers:
a. /app/design/adminhtml/default/default/template/sales/order/view/info.phtml
a. /app/design/adminhtml/default/default/template/salesext/edit_form.phtml
a. /app/code/local/CWACI/SalesExt/controllers/Adminhtml/Sales/OrderController.php
a. 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:
a. Replace the logo in the base theme skin directory.
a. Create a new theme and replace the new logo in the skin directory.
a. Update the logo in all transactional emails.
a. 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:
a. When the products are out of stock, but the cart still proceeded to checkout
a. When the products are in stock, but not in the cart
a. When no products are available
a. None of these.
26. Which of the following will change the order of existing blocks via XML?
Answers:
a. child_block_alias child.block.namename_of_block1child_block_alias
a. child.block.namename_of_block1child_block_alias child_block_alias
a. child_block_alias parent.block.namename_of_block1child_block_alias
a. 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:
a. at least 128MB
a. at least 256MB
a. at least 512MB
a. over 512MB
28. How can the checkout process be skipped for downloadable products in Magento?
Answers:
a. The checkout step cannot be skipped in Magento.
a. Downloadable products automatically do not require checkout.
a. There is an option in the admin panel to skip the checkout step for downloadable products.
a. 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:
a. The install script should be placed in MODULE/sql/RESOURCES_KEY/SCRIPT_NAME.
a. The install script should be named using the convention, mysql4-install-MODULE_VERSION.php
a. The module version in config.xml and in the install script file name must be same.
a. 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:
a. Database table ‘core_config_data’
a. config.inc file at magento root
a. app/etc/config.xml
a. app/etc/local.xml
31. What is the best way to create global variables which can be used everywhere in Magento?
Answers:
a. Creating a empty module and adding a system.xml file to it
a. Using the Magento Admin panel: System > Custom Variables > create a new custom variable
a. Via a Magento Session $myValue = ‘Hello World’; Mage::getSingleton(‘core/session’)->setMyValue($myValue);
a. $myValue = ‘Hello World’; Mage::getModel(‘core/variable’)->addMyValue($myValue);
32. The browser is ignoring the file referred on the code below:
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:
a. There is no solution; a PHP file cannot be used as a stylesheet.
a. Use the “href” attribute instead of “src” to specify the file’s location, as in: a. Call a static CSS file instead of using a PHP file as a stylesheet.
a. 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:
a. Directly edit the core files of Magento with proper commenting.
a. Mage::registerOverride(‘CoreClassName’,’CoreFunctionName’,’MyClassName’,’MyFunctionname’);
a. Copy the original Magento core file to the app/code/local folder and customize that file.
a. 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:
a. Method
a. Class
a. Event
a. None of these.
35. What is the difference between “Flush Magento Cache” and “Flush Cache Storage” in the Magento Cache Management System?
Answers:
a. “Flush Magento Cache” removes “/tmp/” folder’s cache only, while “Flush Cache Storage” clears everything.
a. “Flush Cache Storage” removes “/tmp/” folder’s cache only, while “Flush Magento Cache” clears everything.
a. “Flush Magento Cache” and “Flush Cache Storage” are equivalent; they work the same way.
a. 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:
a. $productCollection = Mage::getResourceModel(‘catalog/product_collection’) ->addCategoryFilter($category);
a. {{block type=”catalog/product_list” category_id=”7″ template=”catalog/product/list.phtml”}}
a. $productCollection = Mage::getResourceModel(‘catalog/product_collection’) ->addFilter($category);
a. $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:
a. $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(); } }
a. $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(); } }
a. $categories = Mage::getModel(‘catalog/category’) ->getCollection() ->setLoadProducts(true); foreach ($categories as $category) { print $category->getName(); foreach($category->getProducts() as $product){ print $product->getName(); } }
a. $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:
a. $this->setBlockId(‘my_static_block_name’)->toHtml()
a. $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘my_static_block_name’)->toHtml()
a. $this->createBlock(‘cms/block’)->setBlockId(‘my_static_block_name’)->toHtml()
a. $this->getLayout()->createBlock(‘cms/block’)->BlockId(‘my_static_block_name’)->toHtml()
39. Which of the following Magento objects will be created during checkout?
Answers:
a. sales/payment
a. sales/tax
a. sales/order
a. 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:
a. catalog.product.related catalog.product.related
a. catalog.product.related catalog.product.related 1
a. catalog.product.related catalog.product.related 0
a. None of the above.
41. What is the correct method to add an external JavaScript file to Magento’s local.xml file?
Answers:
a.
a.
a.
a. 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:
a. $order = Mage::getModel(‘sales/order’)->getCollection() ->addAttributeToFilter(‘customer_id’,$session->getId()) ->getFirstItem(); if ($orders->getSizeValue()) { }
a. $orders = Mage::getResourceModel(‘sales/order_collection’) ->addFieldToSelect(‘*’) ->addFieldToFilter(‘entity_id’, $customer->getEntityId()); if ($orders->getSize()) { }
a. $orders = Mage::getResourceModel(‘sales/order_collection’) ->addFieldToFilter(‘customer_id’, $customer->getId()); if ($orders->getValue()) { }
a. $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:
a. By adding column name in Model
a. By adding column name in Controller
a. By adding column name in Block
a. By defining column name in Block and table
44. Which of the following will get the order increment ID in Magento?
Answers:
a. $order = Mage::getSingleton(‘sales/order’)->getLastOrderId(); $lastOrderId = $order->getIncrementId();
a. $orderId = $this->getOrderId();
a. $order = Mage::getModel(‘sales/order’); $order->load(Mage::getSingleton(‘sales/order’)->getLastOrderId()); $lastOrderId = $order->getIncrementId();
a. None of these.
45. Which of the following will get the tax amount on a page in Magento?
Answers:
a. Mage::helper(‘checkout’)->getQuote()->getShippingAddress()->getData(‘tax_amount’);
a. $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 = ”; }
a. $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(); } }
a.
46. Which of the following will retrieve a list of all shipping methods in Magento?
Answers:
a. 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; }
a. $salesQuoteRate = Mage::getModel(‘sales/quote_address_rate’)->load($rate_id); if($salesQuoteRate){ echo ‘
CODE : ‘.$salesQuoteRate->getCode(); echo ‘
METHOD : ‘.$salesQuoteRate->getMethod(); }
a. $iOrderId = Mage::getSingleton(‘checkout/session’)->getLastRealOrderId(); $oOrder = Mage::getModel(‘sales/order’)->loadByIncrementId($iOrderId); echo $oOrder->getShippingMethod(); echo $oOrder->getShippingDescription();
a. echo Mage::getSingleton(‘checkout/session’)->getQuote()->getShippingAddress()->getShippingMethod();
47. Which of the following will list all products from a particular category?
Answers:
a. $products = Mage::getModel(‘catalog/category’)->load($category_id) ->getProductCollection() ->addAttributeToSelect(‘*’) ->addAttributeToFilter(‘status’, 1) ->addAttributeToFilter(‘visibility’, 4) ->addAttributeToFilter(‘special_price’, array(‘neq’ => “”)) ->setOrder(‘price’, ‘ASC’) ;
a. $productCollection = Mage::getResourceModel(‘catalog/product_collection’) ->addCategoryFilter($category);
a. $products = Mage::get((‘catalog/category’)->load($category_id) ->getCollection() ->addAttributeToSelect(‘*’) ->addAttributeToFilter(‘status’, 1) ->addAttributeToFilter(‘visibility’, 4) ->addAttributeToFilter(‘special_price’, array(‘neq’ => “”)) ->setOrder(‘price’, ‘ASC’) ;
a. $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:
a. 1 Custom default theme 2 Magento base theme 3 Custom non-default theme
a. 1 Magento base theme 2 Custom default theme 3 Custom non-default theme
a. 1 Custom non-default theme 2 Custom default theme 3 Magento base theme
a. None of the above
49. What is the correct method for calling a single product inside a static block?
Answers:
a. {{block type=”media/product_single” product_id=”1″ template=”catalog/product/singleproduct.phtml”}}
a. {{block type=”catalog/product_single” product_id=”1″ template=”catalog/product/singleproduct.phtml”}}
a. {{block type=”all/product_single” product_id=”1″ template=”catalog/product/singleproduct.phtml”}}
a. {{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:
a. $_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]); }
a. $_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]); }
a. $_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]); }
a. $_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:
a.
a.
a.
a. None of the above.
52. Which of the following methods can be used add a new attribute to all products?
Answers:
a. Using XML layout files
a. By creating a new field in the database table named ‘catalog_attributes’
a. Via the Magento Admin panel (Manage Attributes)
a. 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?
Answers:
a. catalog/navigation
a. core/text_list
a. page/template_container
a. page/html
54. What is the difference between the isSaleable() and isAvailable() functions?
Answers:
a. 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”.
a. There is no difference between the two functions.
a. isSaleable() checks if the product’s type can be sold, while isAvailable() checks if the product itself can be sold.
a. 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:
a. Mage_Sales_Model_Quote_Item_Option
a. Mage_Sales_Model_Quote_Address_Total_Abstract
a. Mage_Sales_Model_Quote_Item
a. 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:
a. Product visibility must be “Listed”;
a. Product must be enabled;
a. Stock and quantity must be greater than 0;
a. 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:
a. By re-indexing
a. By using the following codes: Mage::register(‘product’, $product); Mage::register(‘current_product’, $product); $product->setCanSaveConfigurableAttributes(false); $product->setCanSaveCustomOptions(true);
a. By using the following: 1. setBundleOptionsData() 2. setBundleSelectionsData() 3. setCanSaveBundleSelections(true)
a. 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:
a. $product->hasCustomType();
a. $product->hasCustomOptions();
a. $product->hasOptions();
a. $product->hasOptionsType();
59. Which of the following Events are triggered when the payment has been confirmed?
Answers:
a. checkout_onepage_controller_success_action
a. checkout_payment_confirmed
a. sales_order_payment_pay
a. payment_confirmed_action
60. Which of the following statements are true regarding custom options for products in Magento?
Answers:
a. Custom options are only stored on the quote as option IDs and values.
a. Every time the options are rendered, they are reloaded from the database.
a. If the values for custom options are modified, they would need to be saved, and that will set them for all users.
a. None of these.
61. Which of the following will get a specific product attribute from its product ID without loading the whole product?
Answers:
a. Mage::getResourceModel(‘catalog/product’)->getAttributeRawValue($productId, ‘attribute_code’, $storeId);
a. $product->getResource()->getAttribute($attribute_code)->getFrontend()->getValue($product);
a. $object->getData($this->getAttribute()->getAttributeCode());
a. None of the above
62. Which of the following will display only ‘configurable’ products in a page?
Answers:
a. $_productCollection = $this ->getLoadedProductCollection() ->addAttributeToFilter(‘type_id’,’configurable’);
a.
a. $_productCollection = $this->getLoadedProductCollection(); foreach ($_productCollection as $_product) { if ($_product->_data[‘type_id’] == ‘configurable’) { … } }
a. $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. A) echo $_product->getImageUrl();
a. B) echo $_product->getImagePath();
a. C) Both A and B
a. 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:
a. app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Layout.php
a. app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Grid.php
a.app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Design.php
a. 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:
a. setBundleOptionsData, setBundleSelectionsData, setCanSaveBundleSelections, setAffectBundleProductSelectionssetBundleOptionsData,setCanSaveBundleSelections,setBundleSelectionsData,setAffectBundleProductSelections
a. setBundleOptionsData, setBundleSelectionsData, setAffectBundleProductSelections, saveBundleOptions
a. setBundleOptionsData, setCanSaveBundleSelections,setSelectionCollection, setAffectBundleProductSelections
66. Which of the following code samples will display products from a certain category in random order?
Answers:
a. $_productCollection = Mage::getResourceModel(‘catalog/product_collection’); Mage::getModel(‘catalog/layer’)->prepareProductCollection($_productCollection); $_productCollection->getSelect()->order(‘rand()’);
a. $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSort() ->addAttributeToSelect(‘*”) ->addCategoryFilter(Mage::getModel(‘catalog/category’)->load()); $products->getSelect()->order(new Zend_Db_Expr(‘RAND()’));
a. $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSort(‘id’, ‘RAND()’) ->addAttributeToSelect(‘small_image’) ->addCategoryFilter(Mage::getModel(‘catalog/category’) ->load($catId));
a. $_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:
a. Because it is necessary for magento and you must use that session.
a. Because Magento relies heavily on the Zend Framework as the underpinning and it will be able to be ignored.
a. Because Magento relies heavily on the Zend Framework as the underpinning and I must use that for frontend session without condition.
a. 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:
a. home-page-block
a.
a. home-page-block
a. home-page-block
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:
a. /media/
a. /media/import/
a. /import/
a. /
70. Which of the following methods will allow access to a Magento session from other sites on different subdomains?
Answers:
a. subdomain.domain.com needs to be entered in Magento’s Admin->System->Configuration->Web->Cookie Domain, to make session cookies available to other subdomains.
a. 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.
a. Allowing access to session cookies from other subdomains is not part of Magento’s core functionality, but it can be achieved using extensions.
a. 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:
a.
a.
a. $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);
a. $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:
a.
a.
a.
a. http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js
73. Which of the followings magento features are related to CRM?
Answers:
a. Newsletters
a. Contact and Transactional Emails
a. Poll
a. All of above
74. Which of the following statements are true regarding passing data between a controller and a block in Magento?
Answers:
a. It can not be done by using Magento’s MVC approach, but it can be done by emulating traditional PHP MVC behaviors.
a. It can not be done by emulating traditional PHP MVC behaviors, but it can be done by using Magento’s MVC approach.
a. 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’);
a. 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:
a. By using block syntax {{block type=”core/template” name=”contactForm” template=”contacts/form.phtml”}}
a. By Using Layout Update
a. By Creating an Widget of Contact form and adding that widget to CMS page
a. 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:
a. Mage::app()->getStore()->isAdmin()
a. Mage::code()->getStore()->isAdminArea()
a. Mage::app()->getStore()->Admin()
a. 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:
a. Statement A is true and Statement B is false
a. Statement B is true and Statement A is false
a. Both statements are true.
a. Both statements are false.
78. What does the Capture method do in the Magento Purchase and Order Processing flow?
Answers:
a. Sends an authorization request to the payment gateway’s API.
a. Collects funds from the authorized transaction and puts it in the merchant’s account.
a. Throws an exception when authorization has failed.
a. 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:
a. app/etc/config.xml
a. app/db/config.xml
a. app/etc/local.xml
a. app/code/core/db/local.xml
80. Which of the following attributes are the data member of magento Mage_Newsletter_Model_Subscriber Class?
Answers:
a. STATUS_SUBSCRIBED
a. STATUS_NOT_ACTIVE
a. STATUS_UNSUBSCRIBED
a. All the above
81. Which of the following will not increase the performance of a Magento site?
Answers:
a. Reducing the time spent on creation of the blocks
a. Disabling the cache in the admin panel
a. Switching on compiler mode
a. Using auto-optimization extensions
82. Which of the following will correctly display the current theme name in Magento?
Answers:
a. Mage::getSingleton(‘core/design_package’)->getName();
a. Mage::getDesignPackage()->getName();
a. Mage::getSingleton(‘core/design_package’)->getTheme(‘frontend’);
a. Mage::getSingleton(‘core/design_package’)->getName(‘package’)
Answers:
a. There is no solution; a PHP file cannot be used as a stylesheet.
a. Use the “href” attribute instead of “src” to specify the file’s location, as in: a. Call a static CSS file instead of using a PHP file as a stylesheet.
a. 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:
a. Directly edit the core files of Magento with proper commenting.
a. Mage::registerOverride(‘CoreClassName’,’CoreFunctionName’,’MyClassName’,’MyFunctionname’);
a. Copy the original Magento core file to the app/code/local folder and customize that file.
a. 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:
a. Method
a. Class
a. Event
a. None of these.
35. What is the difference between “Flush Magento Cache” and “Flush Cache Storage” in the Magento Cache Management System?
Answers:
a. “Flush Magento Cache” removes “/tmp/” folder’s cache only, while “Flush Cache Storage” clears everything.
a. “Flush Cache Storage” removes “/tmp/” folder’s cache only, while “Flush Magento Cache” clears everything.
a. “Flush Magento Cache” and “Flush Cache Storage” are equivalent; they work the same way.
a. 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:
a. $productCollection = Mage::getResourceModel(‘catalog/product_collection’) ->addCategoryFilter($category);
a. {{block type=”catalog/product_list” category_id=”7″ template=”catalog/product/list.phtml”}}
a. $productCollection = Mage::getResourceModel(‘catalog/product_collection’) ->addFilter($category);
a. $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:
a. $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(); } }
a. $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(); } }
a. $categories = Mage::getModel(‘catalog/category’) ->getCollection() ->setLoadProducts(true); foreach ($categories as $category) { print $category->getName(); foreach($category->getProducts() as $product){ print $product->getName(); } }
a. $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:
a. $this->setBlockId(‘my_static_block_name’)->toHtml()
a. $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘my_static_block_name’)->toHtml()
a. $this->createBlock(‘cms/block’)->setBlockId(‘my_static_block_name’)->toHtml()
a. $this->getLayout()->createBlock(‘cms/block’)->BlockId(‘my_static_block_name’)->toHtml()
39. Which of the following Magento objects will be created during checkout?
Answers:
a. sales/payment
a. sales/tax
a. sales/order
a. 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:
a. catalog.product.related catalog.product.related
a. catalog.product.related catalog.product.related 1
a. catalog.product.related catalog.product.related 0
a. None of the above.
41. What is the correct method to add an external JavaScript file to Magento’s local.xml file?
Answers:
a.
a.
a.
a. 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:
a. $order = Mage::getModel(‘sales/order’)->getCollection() ->addAttributeToFilter(‘customer_id’,$session->getId()) ->getFirstItem(); if ($orders->getSizeValue()) { }
a. $orders = Mage::getResourceModel(‘sales/order_collection’) ->addFieldToSelect(‘*’) ->addFieldToFilter(‘entity_id’, $customer->getEntityId()); if ($orders->getSize()) { }
a. $orders = Mage::getResourceModel(‘sales/order_collection’) ->addFieldToFilter(‘customer_id’, $customer->getId()); if ($orders->getValue()) { }
a. $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:
a. By adding column name in Model
a. By adding column name in Controller
a. By adding column name in Block
a. By defining column name in Block and table
44. Which of the following will get the order increment ID in Magento?
Answers:
a. $order = Mage::getSingleton(‘sales/order’)->getLastOrderId(); $lastOrderId = $order->getIncrementId();
a. $orderId = $this->getOrderId();
a. $order = Mage::getModel(‘sales/order’); $order->load(Mage::getSingleton(‘sales/order’)->getLastOrderId()); $lastOrderId = $order->getIncrementId();
a. None of these.
45. Which of the following will get the tax amount on a page in Magento?
Answers:
a. Mage::helper(‘checkout’)->getQuote()->getShippingAddress()->getData(‘tax_amount’);
a. $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 = ”; }
a. $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(); } }
a.
46. Which of the following will retrieve a list of all shipping methods in Magento?
Answers:
a. 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; }
a. $salesQuoteRate = Mage::getModel(‘sales/quote_address_rate’)->load($rate_id); if($salesQuoteRate){ echo ‘
CODE : ‘.$salesQuoteRate->getCode(); echo ‘
METHOD : ‘.$salesQuoteRate->getMethod(); }
a. $iOrderId = Mage::getSingleton(‘checkout/session’)->getLastRealOrderId(); $oOrder = Mage::getModel(‘sales/order’)->loadByIncrementId($iOrderId); echo $oOrder->getShippingMethod(); echo $oOrder->getShippingDescription();
a. echo Mage::getSingleton(‘checkout/session’)->getQuote()->getShippingAddress()->getShippingMethod();
47. Which of the following will list all products from a particular category?
Answers:
a. $products = Mage::getModel(‘catalog/category’)->load($category_id) ->getProductCollection() ->addAttributeToSelect(‘*’) ->addAttributeToFilter(‘status’, 1) ->addAttributeToFilter(‘visibility’, 4) ->addAttributeToFilter(‘special_price’, array(‘neq’ => “”)) ->setOrder(‘price’, ‘ASC’) ;
a. $productCollection = Mage::getResourceModel(‘catalog/product_collection’) ->addCategoryFilter($category);
a. $products = Mage::get((‘catalog/category’)->load($category_id) ->getCollection() ->addAttributeToSelect(‘*’) ->addAttributeToFilter(‘status’, 1) ->addAttributeToFilter(‘visibility’, 4) ->addAttributeToFilter(‘special_price’, array(‘neq’ => “”)) ->setOrder(‘price’, ‘ASC’) ;
a. $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:
a. 1 Custom default theme 2 Magento base theme 3 Custom non-default theme
a. 1 Magento base theme 2 Custom default theme 3 Custom non-default theme
a. 1 Custom non-default theme 2 Custom default theme 3 Magento base theme
a. None of the above
49. What is the correct method for calling a single product inside a static block?
Answers:
a. {{block type=”media/product_single” product_id=”1″ template=”catalog/product/singleproduct.phtml”}}
a. {{block type=”catalog/product_single” product_id=”1″ template=”catalog/product/singleproduct.phtml”}}
a. {{block type=”all/product_single” product_id=”1″ template=”catalog/product/singleproduct.phtml”}}
a. {{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:
a. $_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]); }
a. $_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]); }
a. $_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]); }
a. $_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:
a.
a.
a.
a. None of the above.
52. Which of the following methods can be used add a new attribute to all products?
Answers:
a. Using XML layout files
a. By creating a new field in the database table named ‘catalog_attributes’
a. Via the Magento Admin panel (Manage Attributes)
a. 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?
Answers:
a. catalog/navigation
a. core/text_list
a. page/template_container
a. page/html
54. What is the difference between the isSaleable() and isAvailable() functions?
Answers:
a. 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”.
a. There is no difference between the two functions.
a. isSaleable() checks if the product’s type can be sold, while isAvailable() checks if the product itself can be sold.
a. 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:
a. Mage_Sales_Model_Quote_Item_Option
a. Mage_Sales_Model_Quote_Address_Total_Abstract
a. Mage_Sales_Model_Quote_Item
a. 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:
a. Product visibility must be “Listed”;
a. Product must be enabled;
a. Stock and quantity must be greater than 0;
a. 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:
a. By re-indexing
a. By using the following codes: Mage::register(‘product’, $product); Mage::register(‘current_product’, $product); $product->setCanSaveConfigurableAttributes(false); $product->setCanSaveCustomOptions(true);
a. By using the following: 1. setBundleOptionsData() 2. setBundleSelectionsData() 3. setCanSaveBundleSelections(true)
a. 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:
a. $product->hasCustomType();
a. $product->hasCustomOptions();
a. $product->hasOptions();
a. $product->hasOptionsType();
59. Which of the following Events are triggered when the payment has been confirmed?
Answers:
a. checkout_onepage_controller_success_action
a. checkout_payment_confirmed
a. sales_order_payment_pay
a. payment_confirmed_action
60. Which of the following statements are true regarding custom options for products in Magento?
Answers:
a. Custom options are only stored on the quote as option IDs and values.
a. Every time the options are rendered, they are reloaded from the database.
a. If the values for custom options are modified, they would need to be saved, and that will set them for all users.
a. None of these.
61. Which of the following will get a specific product attribute from its product ID without loading the whole product?
Answers:
a. Mage::getResourceModel(‘catalog/product’)->getAttributeRawValue($productId, ‘attribute_code’, $storeId);
a. $product->getResource()->getAttribute($attribute_code)->getFrontend()->getValue($product);
a. $object->getData($this->getAttribute()->getAttributeCode());
a. None of the above
62. Which of the following will display only ‘configurable’ products in a page?
Answers:
a. $_productCollection = $this ->getLoadedProductCollection() ->addAttributeToFilter(‘type_id’,’configurable’);
a.
a. $_productCollection = $this->getLoadedProductCollection(); foreach ($_productCollection as $_product) { if ($_product->_data[‘type_id’] == ‘configurable’) { … } }
a. $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. A) echo $_product->getImageUrl();
a. B) echo $_product->getImagePath();
a. C) Both A and B
a. 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:
a. app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Layout.php
a. app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Grid.php
a.app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Design.php
a. 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:
a. setBundleOptionsData, setBundleSelectionsData, setCanSaveBundleSelections, setAffectBundleProductSelectionssetBundleOptionsData,setCanSaveBundleSelections,setBundleSelectionsData,setAffectBundleProductSelections
a. setBundleOptionsData, setBundleSelectionsData, setAffectBundleProductSelections, saveBundleOptions
a. setBundleOptionsData, setCanSaveBundleSelections,setSelectionCollection, setAffectBundleProductSelections
66. Which of the following code samples will display products from a certain category in random order?
Answers:
a. $_productCollection = Mage::getResourceModel(‘catalog/product_collection’); Mage::getModel(‘catalog/layer’)->prepareProductCollection($_productCollection); $_productCollection->getSelect()->order(‘rand()’);
a. $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSort() ->addAttributeToSelect(‘*”) ->addCategoryFilter(Mage::getModel(‘catalog/category’)->load()); $products->getSelect()->order(new Zend_Db_Expr(‘RAND()’));
a. $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSort(‘id’, ‘RAND()’) ->addAttributeToSelect(‘small_image’) ->addCategoryFilter(Mage::getModel(‘catalog/category’) ->load($catId));
a. $_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:
a. Because it is necessary for magento and you must use that session.
a. Because Magento relies heavily on the Zend Framework as the underpinning and it will be able to be ignored.
a. Because Magento relies heavily on the Zend Framework as the underpinning and I must use that for frontend session without condition.
a. 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:
a. home-page-block
a.
a. home-page-block
a. home-page-block
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:
a. /media/
a. /media/import/
a. /import/
a. /
70. Which of the following methods will allow access to a Magento session from other sites on different subdomains?
Answers:
a. subdomain.domain.com needs to be entered in Magento’s Admin->System->Configuration->Web->Cookie Domain, to make session cookies available to other subdomains.
a. 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.
a. Allowing access to session cookies from other subdomains is not part of Magento’s core functionality, but it can be achieved using extensions.
a. 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:
a.
a.
a. $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);
a. $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:
a.
a.
a.
a. http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js
73. Which of the followings magento features are related to CRM?
Answers:
a. Newsletters
a. Contact and Transactional Emails
a. Poll
a. All of above
74. Which of the following statements are true regarding passing data between a controller and a block in Magento?
Answers:
a. It can not be done by using Magento’s MVC approach, but it can be done by emulating traditional PHP MVC behaviors.
a. It can not be done by emulating traditional PHP MVC behaviors, but it can be done by using Magento’s MVC approach.
a. 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’);
a. 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:
a. By using block syntax {{block type=”core/template” name=”contactForm” template=”contacts/form.phtml”}}
a. By Using Layout Update
a. By Creating an Widget of Contact form and adding that widget to CMS page
a. 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:
a. Mage::app()->getStore()->isAdmin()
a. Mage::code()->getStore()->isAdminArea()
a. Mage::app()->getStore()->Admin()
a. 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:
a. Statement A is true and Statement B is false
a. Statement B is true and Statement A is false
a. Both statements are true.
a. Both statements are false.
78. What does the Capture method do in the Magento Purchase and Order Processing flow?
Answers:
a. Sends an authorization request to the payment gateway’s API.
a. Collects funds from the authorized transaction and puts it in the merchant’s account.
a. Throws an exception when authorization has failed.
a. 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:
a. app/etc/config.xml
a. app/db/config.xml
a. app/etc/local.xml
a. app/code/core/db/local.xml
80. Which of the following attributes are the data member of magento Mage_Newsletter_Model_Subscriber Class?
Answers:
a. STATUS_SUBSCRIBED
a. STATUS_NOT_ACTIVE
a. STATUS_UNSUBSCRIBED
a. All the above
81. Which of the following will not increase the performance of a Magento site?
Answers:
a. Reducing the time spent on creation of the blocks
a. Disabling the cache in the admin panel
a. Switching on compiler mode
a. Using auto-optimization extensions
82. Which of the following will correctly display the current theme name in Magento?
Answers:
a. Mage::getSingleton(‘core/design_package’)->getName();
a. Mage::getDesignPackage()->getName();
a. Mage::getSingleton(‘core/design_package’)->getTheme(‘frontend’);
a. Mage::getSingleton(‘core/design_package’)->getName(‘package’)
No comments:
Post a Comment