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