We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [layout]

Denotes the xml files used to define the block hierarchy which eventually renders the template files.

Filter by
Sorted by
Tagged with
91
votes
4answers
44k views

Explanation of UI Component Grid in Magento 2

Is there a good explaination and/or sample of the bare minimum configuration needed to create a UI Component Grid in Magento 2? I know there are myriad core components, such as ./vendor/magento/...
15
votes
2answers
10k views

What is the correct way/approach to modify a Magento template?

Please suggest me the right approach, I want to customize the "EMAIL to Friend" page into pop up window, when user click on the button (email this product). By enabling template hinting, I found out ...
52
votes
6answers
34k views

Magento 2: Changing a Block's Template

In Magento 1, as a module developer it's possible to change a block's template using layout XML code something like this <reference name="block_to_change"> <action method="setTemplate"&...
50
votes
4answers
20k views

Magento 2: how do customer sections / sections.xml work?

I recently came accross a new concept in Magento 2 that I found interesting: customer sections Some of you may have notice the presence of sections.xml files that look like this: <?xml version="1....
35
votes
7answers
35k views

Move all Javascript includes to before </body>

Does anyone know how to have all of Magento's JS script tags e.g. <script type="text/javascript" src="http://sitename.com/js/prototype/prototype.js"></script> render out before the closing ...
18
votes
3answers
20k views

Magento 2 remove “Estimate shipping costs and tax” from cart

I want to get rid of the "Estimate Shipping costs and Tax" block in the cart. The devdocs tell Disabling a component is the way to go, so I tried the following: <body> <referenceBlock ...
35
votes
3answers
54k views

Remove block from layout in Magento 2

In Magento 1 I could remove a block added by a layout file by adding this in my layout block <remove ="block_id_here" /> How can I do the same for Magento 2? As a practical exercise, let's say ...
36
votes
6answers
41k views

Debugging layout XML loading

TL;DR: is there a way I can debug the loading of the layout? As I believe one module's layout is conflicting with another. Related to a previous question I made: How to make a module layout to be ...
12
votes
4answers
23k views

Add new tab on product detail page Magento 2 [duplicate]

I want to add an extra tab on product detail page just like review tab, It will look like a product question tab. How can I do this? My block file: namespace Example\ProductQuestion\Block; use ...
23
votes
1answer
12k views

Magento 2: Adding Arbitrary HTML to the <head> of Every Page?

In Magento 2, is it possible to add an arbitrary bit of HTML to every frontend/cart page's <head/>? I know I can add a block to the content/<body> area with code something like this <...
17
votes
6answers
23k views

How to add/remove links on my account navigation magento2?

How to remove "Billing Agreements" and "My Wishlist" links from the navigation menu on customer account page?
14
votes
14answers
14k views

Magento2 : Change order of Tabs on Product Page

I'm trying to change the order of the tabs on the product page in Magento 2. Default is Details|More Information|Reviews. I tried: Vendor/theme/Magento_Catalog/layout/catalog_product_view.xml <...
14
votes
2answers
32k views

Adding custom layouts for CMS and Category use with custom module trouble

I have a category in my store that requires a totally different layout to the standard Magento layouts. So I created a new copy of the 1column.phtml and renamed it and made one small change to test. ...
22
votes
4answers
44k views

Best Practices Way to Edit Magento Top-Links

Let's say we want to add a shopping cart icon right before the "My Cart" link on Magento's top links (see top links below). What is the best way to do this? Do something to toplinks.php? Do ...
21
votes
1answer
5k views

Block with Cachable=false not rendered on product view page

I am using magento2-1.0.0-beta4 I have copied the checkout.root block from app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml to the product page. Everything is working fine, ...
16
votes
7answers
18k views

Add header and footer in checkout page Magento2

By default Magento 2 don't provide HEADER and FOOTER in CHECK OUT page. So I checked checkout_index_index.xml file on path app/design/frontend/package_name/theme_name/Magento_Checkout/layout/...
3
votes
1answer
3k views

Magento 2 Custom Theme : Which files to edit in order to customize home page / category css?

I'm trying to insert some CSS changes, after already inserting the html changes in the "content" part of the Home Page cms page.Changes to category pages will follow the same process, once proven that ...
18
votes
2answers
9k views

Google CDN jQuery with Local Fallback in Magento Layout XML

I've done the following to include jQuery from Google CDN in Magento: <default> <reference name="head"> <block type="core/text" name="google.cdn.jquery"> <...
23
votes
1answer
7k views

Magento2: what is the difference between referenceContainer and referenceBlock

Both referenceBlock and referenceContainer entities are used in layout in magento2. What is the main difference between them and how can I relate these entities to magento1.*.
10
votes
2answers
31k views

Creating a custom homepage template in Magento2

As all you know that magento2 have some layout template like 1column , 2 columns-left , 2 columns-right , 3 columns and I want to create custom homepage layout template in Magento2 for that I follow ...
7
votes
2answers
11k views

Magento 2 - How to affect street address in checkout forms with layout xml/ui arguments

I'm trying to set a placeholder on street address fields on shipping address form in checkout. Followed this example: http://devdocs.magento.com/guides/v2.0/howdoi/checkout/checkout_form.html I've ...
5
votes
2answers
14k views

Magento 2 - Custom Page Layout

I wish to add a custom home page layout in Magento 2. In Magento 1, it's very simple, i create my module : <?xml version="1.0"?> <config> <modules> <Vendor_Custom>...
15
votes
2answers
11k views

Remove a UI component child via Layout XML

How do I remove a UI component child via Layout XML? For example, from the below xml directive in checkout_index_index.xml. How do I remove the shipping node ? <item name="sidebar" xsi:type="array"...
13
votes
4answers
6k views

What is the proper way of positioning/ordering CSS files in Magento 2?

In the Magento 2 DevDoc it says To include a CSS file, add the <css src="<path>/<file>" media="print|<option>"/> block in <head> section in a layout file. However it ...
2
votes
1answer
5k views

Magento 2 Block/Element order

A pretty basic question mainly because I'm still trying to wrap my head around Magento 2's templating system. But I'm just trying to switch the order of the mini-cart element and the search element ...
32
votes
3answers
30k views

Conditionally show/hide blocks in layout XML

How to conditionally add a block (depending on the configuration in the admin panel) in Magento's layout XML? We can check if config is true on actions. In the example below, if sample/config/...
8
votes
4answers
20k views

Magento 2 - How to add custom css files into the head?

In Magento 1.x, I can add the CSS files into the head using the helper like below code. <reference name="head"> <action method="addCss"><stylesheet helper="module/helperclass/...
11
votes
1answer
11k views

Magento 2: How to add text within container via XML

I am attempting to render a single line of text prior to a Link list in the footer. Creating a template file to do this seems to be a waste of resources for this task. As I understood it, I could ...
8
votes
2answers
34k views

Changing the footer in magento theme

I'm fairly new to editing the footer in magento. I want to transform footer. I managed to change only address part, but not the rest. Getting struck in complex file structure of Magento. I want to ...
10
votes
3answers
9k views

Magento 2 html file and phtml file in custom template process?

As I checked from magento 2 documentation about changing minicart content. There are two ways : In this page : http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/themes/theme-inherit.html ...
11
votes
2answers
35k views

Move blocks to other container how to

Being newby I look for a workaround to move Sign in and Store switcher from header.panel to header.container. I just tried this code but won't work <referenceContainer name="header.container"> ...
5
votes
3answers
7k views

Magento 2 - Set the page layout dynamically based on admin configuration

I want to know how to set the page layout dynamically based on an extension's admin configuration values. I found how to change the page layout in the layout xml file, http://devdocs.magento.com/...
9
votes
4answers
5k views

Magento 2: How to use the Layout Handle customer_logged_in?

Does Magento 2 have such handle as customer_logged_in? If yes how can I use it? I tried to create ../view/frontend/layout/customer_logged_in.xml and added there <referenceBlock name="content" ...
5
votes
7answers
12k views

Adding CSS to a CMS page using Layout Update XML

I need to add a specific CSS file to a CMS page using Magento 2. I am wanting to achieve this by using the Layout Update XML area in the admin. However, I cannot figure out or find any working ...
4
votes
1answer
7k views

Conditionally show block in layout XML

<referenceContainer name="header-wrapper"> <block class="VES\Sociallogin\Block\Buttons" ifconfig="section/group/field/type_multiselect" value="something" as="block.buttons.header" ...
3
votes
1answer
9k views

Magento 2: How to include JS on the product page?

I'm trying to get a custom js on the product page, I'm using Magento 2, what's the page I need to edit to do that? I've already tried to create a local.xml into /app/design/frontend/Venustheme/yume/...
7
votes
2answers
1k views

Re-add left block after it's been removed

Running Magento 1.9 CE. I am trying to re-add a left block after is has been removed in base. base/default/layout/storelocator.xml: <dealers_index_index translate="label"> <update ...
3
votes
2answers
406 views

Why every layout xml root node has a version

Why does the root layout xml node have a version number: <layout version="0.1.0"> I have searched the source code and cannot find this being used. Is it a feature that never got implemented? ...
2
votes
2answers
1k views

Magento 1.9.0.1 + Patch SUPEE-6788 breaks custom theme

I have tried to apply the new patch SUPEE-6788 on my website which was successful without any errors. After that I recompiled Magento using Configuration > tools > compilation. After doing that my ...
2
votes
5answers
2k views

Disable extension in one of the store views that uses same theme as others

Is there any way to disable a third party extension for one of the store views. Since, all the store views are using same theme, I can not do it through xml file in layout folder.
9
votes
2answers
4k views

How to add “Empty Cart” button to minicart

How can you add an "Empty Cart" button to the minicart in Magento 2. Is it possible with layout xml?
7
votes
1answer
14k views

how to create custom layout page in custom theme

I want to create a custom page layout in my custom theme. I have created a custom theme named "ktheme" with a parent theme. I created cutome_home.xml in the layout folder but I am just getting a blank ...
6
votes
3answers
3k views

Magento 2: move the javascript to the end of the body

As Magento 2 migrated away from Prototype I was expecting that this would be fixed in M2. So, is there a way (easy or not) to move all the <script> tags to the end of the <body> tag ...
10
votes
1answer
5k views

Magento 2 custom theme layout xml and css not working

I created a new theme and it was working fine but after a few days, I realized some things weren't working. default_head_blocks.xml is no longer pulling in any css files that I include (both hosted ...
5
votes
1answer
11k views

how to change block ordering in layouts

I am creating a custom theme for Magento 2. I have a header block defined this way (in Magento_Theme/layout/default.xml file): <move element="catalog.topnav" destination="header-wrapper"/> &...
26
votes
3answers
5k views

When to use 'name' and when to use 'as'

I've found that when trying to use the unsetChild method, sometimes I have to use the 'name' attribute and others 'as'. It seems that if a block is added normally, you use 'as' but if it is added to ...
8
votes
7answers
4k views

Magento2 How to move toolbar

Anyone have any idea about How to move toolbar before left and right sidebar in magento2 using XML? Currently it is showing in Right side-bar.
10
votes
1answer
5k views

Magento 2 : How to add placeholder text to street fields in checkout?

In back-end I've set the street address to have 3 lines. I'd like to put a different placeholder in each field: Street Building / Apartment Area This way user can enter data in a more structured ...
8
votes
3answers
13k views

How to load a specific JS at the end of all other included JS files?

I have a specific fancybox.js file which I want to load at the end of all the JS files included in my local.xml If load order can be changed then how can a JS file be loaded (included) at the end ? ...
5
votes
2answers
19k views

Add custom js in head in magento2?

I have custom module. I want add file my.js in folder app\code\Xanka\Slider\view\frontend\web\js\slider\my.js. I used code in app\code\Xanka\Slider\view\frontend\layout\default.xml <head> &...