Pregunta 1
Pregunta
You are building MyCompany/MyTheme and need to customize the header template. Where do you place the new phtml template to override the header?
Respuesta
-
MyCompany/MyTheme/templates/html/header.phtml
-
MyCompany/MyTheme/Magento_Theme/html/header.phtml
-
MyCompany/MyTheme/Magento_Theme/templates/html/header.phtml
-
MyCompany/MyTheme/Magento_Theme/templates/override/html/header.phtml
Pregunta 2
Pregunta
What is true regarding the differences between the define and require functions?(2)
Respuesta
-
define is passive and only runs when it is called.
-
require is always run (as long as the module's file is loaded).
-
define is an application's entry point. This is what should be used in a phtml template.
-
require is a dependency of the application and a error will result if this module is missing.
Pregunta 3
Pregunta
You are making some major modifications to the customer account page. These modifications mean that you are unable to use the original layout instructions for this page. In what file do you place your custom layout instructions?
Respuesta
-
app/design/frontend/MyCompany/MyTheme/layout/customer_account_index.xml
-
app/design/frontend/MyCompany/MyTheme/Magento_Customer/layout/customer_account_index.xml
-
app/design/frontend/MyCompany/MyTheme/Magento_Customer/layout/override/frontend/customer_account_index.xml
-
app/design/frontend/MyCompany/MyTheme/Magento_Customer/customer_account_index.xml
Pregunta 4
Pregunta
You are browsing the Magento_Catalog's widget file and see this:
<widget id="new_products" class="Magento\Catalog\Block\Product\Widget\NewWidget">
<parameters> <!-- ... --> </parameters> <containers> <container name="sidebar.additional">
<template name="default" value="list_default" /> <template name="names_only" value="list_names" />
<template name="images_only" value="list_images" />
</container>
</containers>
</widget>
What is the purpose of the template nodes?
Respuesta
-
It filters options for the template when the widget is inserted into a page's layout.
-
It sets a data value on the block when it is used in a CMS page or block.
-
It adds a new option to the widget configuration area.
-
It creates new templates when the widget is used in a container.
Pregunta 5
Pregunta
How do you locate strings to be translated a custom module.
Respuesta
-
Enable inline translation in Stores > Configuration
-
bin/magento i18n:collect-phrases
-
grep your module for __\(['"].*?['"]\)
-
Open the admin panel's Content > Translation Wizard.
Pregunta 6
Pregunta
What command symlinks files from a module or the var/view_preprocessed directories to their respective location in pub/static?
Respuesta
-
bin/magento dev:source-theme:deploy
-
bin/magento indexer:reindex
-
bin/magento setup:static-content:deploy
-
bin/magento setup:di:compile
Pregunta 7
Pregunta
On the catalog product page, this XML instruction is executed:
<block class="Magento\Catalog\Block\Product\View" name="product.info.review" template="Magento_Catalog::product/view/review.phtml" after="product.info.stock.sku"/> You have created MyCompany_MyModule which needs to utilize your own version of review.phtml. What layout XML instruction do you use to accomplish this?
Respuesta
-
<referenceBlock name="product.info.review" template="MyCompany_MyModule::new-review.phtml"/>
-
<referenceBlock name="product.info.review">
<action method="setTemplate"><template>MyCompany_MyModule::new-review.phtml</template></action>
</referenceBlock>
-
<referenceBlock name="product.info.review">
<parameters>
<argument name="template" xsi:type="string">MyCompany_MyModule::new-review.phtml</argument>
</parameters>
</referenceBlock>
-
<referenceBlock name="product.info.review" remove="true"/>
<block name="product.info.review" template="MyCompany_MyModule::new-review.phtml"/>
Pregunta 8
Pregunta
Magento 2 Themes use a combination of ------ to achieve the desired look(Fill in gap)
Respuesta
-
PHP,HTML & XML
-
XML, CSS & HTML
-
CSS and JavaScript
-
HTML, JavaScript & CSS
-
All
Pregunta 9
Pregunta
Where Composer-based themes can be stored ?
Pregunta 10
Pregunta
You are building a module that will be sold on Magento Marketplace . This module adds significant functionality is meant as a foundation for building extra functionality & u need to provide developers with a way to easily add additional style. How do you do this?
Respuesta
-
In your _module.less file , add //@magento_import source/_foundation.less'; This will include all _foundation.less files into your module's _module.less
-
The _extends.less with an S at the end within the Blank Theme, is a file where they created all the classes that can be extended via LESS later within the theme, without the need of creating new components or modular structure for style changes
-
In your _modules.less file , Add @import 'source/_foundation.less'; .Magento has extentded the @import directive to search all modules
-
In view/web/css/source/includes.xml add: <includeAll>_foundation.less<includeAll>
-
You need to utilize the Assuilder class to compile other module's LESS files.
Pregunta 11
Pregunta
You see this <script/> in the source on a page:
{ "*": {"MyCompany_MyModule/js/modal": {} } }
What is the effect of the asterisk (*)?
Respuesta
-
The asterisk means that this module is not initialized with an associated element.
-
The asterisk means that this module is initialized with an associated element.
-
The asterisk is a typo & should be a dash (-)
-
The asterisk means that this module is initialize for each element on the page
-
The asterisk means that the module is initialized once for each root element
Pregunta 12
Pregunta
You are building a jQuery widget that renders this text : Welcome, %s! . How do you translate this?
Respuesta
-
Require mage/translate as $t , then : $t('Welcome, %s ').replace('%s', name)
-
Require magento/translate as $t , then : $t('Welcome, %s ').replace('%s', name)
-
_('Welcome, %s!', name);
-
Require mage/translate as $t , then : $t('Welcome, %s ', name)
-
Create a translation.json in view/web/js . Then , require MyCompany_MyModule/translation.json & parse the JSON
Pregunta 13
Pregunta
Your reviewing a Magento 2 build that another company developed , before the website goes live. In this process, you notice that while the original page load quickly ( and you see unformatted text & images ), it takes several seconds for the text & images to become styled. What is the solution ?
Respuesta
-
Switch the LESS compilation mode from Client-side to Server-side
-
Switch the SASS compilation mode from Client-side to Server-side
-
Switch the CSS compilation mode from Client-side to Server-side
-
Switch the JS compilation mode from Client-side to Server-side
Pregunta 14
Pregunta
You have been tasked with configuring a new setting in Content> Design. Where are the values saved that are set in this panel?
Respuesta
-
core_config_data
-
etc/system.xml
-
etc/config.xml
-
design_change
-
theme_confiquration
Pregunta 15
Pregunta
u r customizing the display of particular product. On this page u need to change the container in which the product option appear. Keeping ,maintainability in mind , how do u do this?
Respuesta
-
In the product admin page , choose the correct option in the "Display Product Option in" drop-down list
-
In the category that the product is associated with , choose the correct option in the "Product Options Container" dropdown
-
This is only possible with a layout XML update
-
In the product's admin page, change the Layout to be "2 columns with right bar"
Pregunta 16
Pregunta
U'v built a module: MyCompany_ProductEnhancements. ThirdParty_ProductModifier already exists in installation. u need to change a data variable set in <arguments> node . However, that change is not taking effect: it continues as value set by ThirdParty_SalesTax. How do u solve this problem?
Respuesta
-
Make MyCompany_ProductEnhancements dependent on ThirdParty_ProductUpdates
-
Copy the layout instructions from ThirdParty_ProductEnhancements into MyCompany_MyModule
-
Make ThirdParty_ProductUpdates depend on MyCompany_ProductEnhancements
-
Create a new layout XML file in MyCompany_ProductEnhancements layout/modifier directory
Pregunta 17
Pregunta
Magento contains the following layout instructions: <head><css src="css/styles-m.css"> <css src="css/style-l.css" meadia="screen and (min-width:768px)"> </head>. However, styles-m.css generated? How is styles-m.css generated?
Respuesta
-
Magento replace the .css files extension with .less & searches for styles-m.less in the web/css directory.
-
The Less preprocessor looks for all LESS files that match styles-m.less in the app/design/frontend directory
-
Magento automaticaly create styles-m.less which contain references to the other LESS files to be iported
-
The association of styles-m.less & sstyles-m.css is in a constant array it is always rendered
Pregunta 18
Pregunta
You Have been tasked with making a couple of small style modification in the Magento Luma Theme. Keeping upgrade-ability in mind, where do you add these changes?
Pregunta 19
Pregunta
u r creating a JS module that applies the magento accordion UI widget to an element . You have written this code: require(['jquery','accordion', ], function ($ , accordion){ var accordionWigdget = $ ("#accordion"). accordion(); }); How do u call method on the accordion after it has been initialized?
Respuesta
-
$("#accordion").accordion("activate");
-
$("#accordion").callWidgetMethod("accordion","activate");
-
$("#accordion").accordion.activate();
-
$("#accordion").accordion().activate();
Pregunta 20
Pregunta
What module initializes uiComponents?
Pregunta 21
Pregunta
What are differences between a container & a Block?(select 3)
Respuesta
-
Containers automatically render their children
-
container can render an HTML tag that surrounds child elements
-
Block render text or html
-
Blocks can only be placed inside containers
-
Only blocks render HTML
Pregunta 22
Pregunta
Magento provides a polyfill for ES6's string templates feature. This utilizes the syntax: ${}. What are valid values to be evaluated? (2)
Respuesta
-
$ { $.e1 }
-
$ { 1+1 }
-
${ bind:template }
-
${ this.value }
Pregunta 23
Pregunta
How do you configure a uiComponent on the frontend with layout XML?
Respuesta
-
<block name="my.block.name template="MyModule_MyCompany::block.phtml">
<arguments> <argument name="jsLayout" xsi:type="array"><!---Config here-->
</argument> </arguments> </block>
-
<block name="my.block.name template="MyModule_MyCompany::block.phtml">
<arguments> <argument name="cssLayout" xsi:type="array"><!---Config here-->
</argument> </arguments> </block>
-
<referenceBlock name="ui.components" >
<add name="new.component">
<!---Config here-->
<referenceBlock>
-
<block name="my.blcok.name" template="MyModule_MyCompany::block.phtml">
<ui_component>
<!---Config here-->
</ui_component>
</block>
-
<ui_component name = "conponent_name"/> Then , add configuration in
ui_component/component_name.xml
Pregunta 24
Pregunta
When you override an existing template using design fallback directories, what are potential problems? (2)
Respuesta
-
If the theme that contains the overriding template is not utilized for the website, the template will not be used
-
When original template is upgraded , it is easy to miss that the overriding template needs to be updated
-
If there is an error the new template file , the old one will be rendered
-
If the store configuration , design/templates/allow_symlinks == false , the overriding template will not be rendered
Pregunta 25
Pregunta
You have configured a new block in Layout XML with this code:
<block name ="my.block" template="MyCompany_MyModule::myTemplate.phtml"> <argument name="test_value" xsi:type="number">1000<argument> <argument> </arguments> </block> (2)
Respuesta
-
<?=block->test_value ?>
-
<?= $block->getTestValue; ?>
-
<?= $block->getTestData; ?>
-
<?= $block->getTestArg; ?>
Pregunta 26
Pregunta
ur creating a custom theme(MyCompany/MyTheme) that inherits ModuleVendor>BeautifulTheme. This inherite the Magento Blank theme. I what order will be the Magento fallback mechanism look for files?
Respuesta
-
MyCompany/MyModule >ModuleVendor/BeautifulTheme>Magento/Blank>Module
-
MyCompany/MyTheme >MyThemeVendor/BeautifulTheme>Magento/Blank>MyTheme
-
MyCompany/MyModule>Module
-
MyCompany/MyModule >ModuleVendor/BeautifulTheme>Module
Pregunta 27
Pregunta
u need to achieve this output fro a container:
<div class="product_view"> <!--content goes here--> </div> What attributes do you use on the <container/> layout instruction to achieve this? (2)
Pregunta 28
Pregunta
Themes provide customization options in etc/view.xml. You are writing a PHTML template that will utilize configuration in this file. In your templete, how do you load a value from etc/view.xml ?
Respuesta
-
<?= $block->getVar("image_width",Magento_Catalog");?>
-
<?= $block->getScopeConfig()->getValue('theme/Magento_Catalog/image_width'); ?>
-
<?= $block->getData('theme_Magento_Catalog_image_width'); ?>
-
<?php
$objectManager= \Magento\Framework\App\objectManager::getInstance();
$configuration =$objectManager->create('\Magento\Framework\Theme\Model\Configuration');
echo $configuration->getValue(Magento_Catalog/image_width);
?>
Pregunta 29
Pregunta
ur needing to add some extra spaces into the rendering of a customer's address. Keeping maintainability in mind , where do you make this change?
Respuesta
-
Store>Configuration>Customers>Customer Configuration>Address templates
-
Store>Configuration>Customers>Customer Configuration>Account Information Options
-
Store>Configuration>Customers>Customer Configuration>Name and Address Options
-
Store>Configuration>Customers>Customer Configuration>Login Options
Pregunta 30
Pregunta
Calling and initializing JavaScript, Magento 2, you have two options for specifying declarative notation: using the data-mage-init attribute & <script type="text/x-magento-init" /> tag Use the data-mage-init attribute to insert a JS component in a specified HTML element. The following example inserts a JS component in the <nav/> element:
What are valid ways to initialize Magento-dependent Javascript on a page? (Select 2)
Respuesta
-
In a HTML element: <div data-mage-init='{ "MyCompany_MyModule/js/modal": {} }' > </div>
-
In ur modules requirejs-config.js: var config = {deps: [MyConmpany_MyModule/js/modal ]};
-
using the data-mage-init attribute
-
using the <script type="text/x-magento-init" /> tag
Pregunta 31
Pregunta
U'v tasked with creating a new page layout type:text. This similar to a 2-column layout, except that larger of 2columns is slightly smaller so that text is easier to read. U'v created view/page_layout/text.xml but 2 columns r not rendering. Keeping upgradeability in mind, what dud to fix?
Respuesta
-
Add <update handle="2columns-right">
-
Add <update handle="2columns">
-
Add <update handle="3columns">
-
Add <update handle="1columns">
Pregunta 32
Pregunta
ur browsing the uiComponent confiquration in checkout_index_index.xml & see the following code:
<item name="customer-email" xsi:type="array"> <item name="component" xsi:type="string"> Magento_checkout/js/view. </item> <item name="displayArea" xsi:type="string">customer-email </item>
</item>
Respuesta
-
In a knockout template:
<!-- ko foreach: getRegion('before-login-form')-->
<!-- /ko -->
-
In a knockout template:
<!-- ko foreach: getRegion('after-login-form')-->
<!-- /ko -->
-
In a knockout template:
<!-- ko foreach: getRegion('before-register-form')-->
<!-- /ko -->
-
In a knockout template:
<!-- ko foreach: getRegion('login-form')-->
<!-- /ko -->
Pregunta 33
Pregunta
u see these layout handles r available for customization on the catalog product pages: catalog_product_view catalog_product_vew_type_bundle default 2columns-left ; Which layout handle is always loaded firest on the catalog product page?
Respuesta
-
default
-
blank
-
custom
-
luma
Pregunta 34
Pregunta
What effects does enableing a category's "Anchor" setting have?(select 2)
Respuesta
-
it enables layered navigation
-
it includes childs products alongside any products associated with the current category
-
it disables layered navigation
-
it delete layered navigation
Pregunta 35
Pregunta
ur maintaining Magento website that is hosted on an old server(& due to corporate bureaucracy cannot be moved to a better hosting). This server utlizes Apache 2.2 & serves files over a HTTP/1 connection. When the page loads, there is a significant gap untile any Javascript-enabled functionality is usable. What do u do to remediate the slow Javascript?
Respuesta
-
Enable javascript bundling in Store>Configuration>Advanced> Developer>JS
-
Enable css bundling in Store>Configuration>Advanced> Developer>CS
-
Enable full page cache
-
Remove unnecessary js from running requirejs-config.js
-
Buld the static assets with the --bundleJs flag
Pregunta 36
Pregunta
n browsing through Magento Luma theme, u see a etc/view.xml file .What is purpose of this file?
Respuesta
-
This file contains configuration settings for aspects of rendering the theme.
-
This file contains configuration settings for aspects of rendering the module.
-
This file contains directive for how to hanlde fallback theme
-
This file contains layout xml for updating parameter for exiting block
Pregunta 37
Pregunta
u have created a new module & all its required files. A ur then making additions to catlog_product_view.xml no change r visible. What is remedy?
Respuesta
-
Run bin/magento module:enable MyCompnay_MyModule
-
Run bin/magento module: set: enable MyCompnay_MyModule
-
Run bin/magento module:active MyCompnay_MyModule
-
Run bin/magento module:live MyCompnay_MyModule
Pregunta 38
Pregunta
Keeping maintability i mind , how d u render a link on a CMS pages/block?
Respuesta
-
{{ store url="/path/to/destination"}}
-
{{ store url="/path/to/theme"}}
-
{{ store url="/path/to/module"}}
-
{{ store url="/path/to/plugin"}}
Pregunta 39
Pregunta
u need to set cache_key on a block that does not contain a class attribute. How dud this?
Respuesta
-
<referenceBlock name="block.name">
<arguments> <argument name="cache_key" xsi:type="string"> kayName<argument> </arguments>
</referenceBlock>
-
<referenceBlock name="block.name">
<arguments> <argument name="cache_key" xsi:type="string"> cache_key<argument> </arguments>
</referenceBlock>
-
<referenceBlock name="page.name">
<arguments> <argument name="cache_key" xsi:type="string"> cache_key<argument> </arguments>
</referenceBlock>
-
<referenceBlock name="page.name">
<arguments> <argument name="kayName" xsi:type="string"> cache_key<argument> </arguments>
</referenceBlock>
Pregunta 40
Pregunta
Ur creating a new transactional email template. Keeping maintainability in mind , how du add an image located in u theme?
Respuesta
-
<img src="{{ view url="Mycompany _MyModule/images/image.png}}">
-
<img src ="/path/to/file.png"/>
-
<img src="{{ media url="Mycompany _MyModule/image/image.png}}">
-
{{ image theme ="MyCompany_MyModule/images/image.png"}}