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
103 votes
4 answers
54k 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/...
user avatar
  • 43.7k
65 votes
4 answers
42k 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....
user avatar
15 votes
2 answers
11k 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 ...
user avatar
61 votes
6 answers
60k 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"&...
user avatar
  • 43.7k
36 votes
7 answers
37k 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 ...
user avatar
14 votes
4 answers
37k 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 ...
user avatar
45 votes
3 answers
89k views

Remove block from layout XML 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 ...
user avatar
  • 195k
29 votes
5 answers
37k 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 ...
user avatar
37 votes
6 answers
42k 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 ...
user avatar
  • 742
25 votes
1 answer
14k 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 <...
user avatar
  • 43.7k
25 votes
6 answers
36k 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?
user avatar
16 votes
5 answers
9k 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 ...
user avatar
  • 1,091
14 votes
2 answers
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. ...
user avatar
  • 1,497
23 votes
4 answers
45k 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 ...
user avatar
12 votes
2 answers
43k 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 ...
user avatar
  • 1,635
21 votes
1 answer
7k 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, ...
user avatar
  • 14.7k
21 votes
10 answers
29k 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/...
user avatar
  • 1,635
3 votes
1 answer
5k 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 ...
user avatar
23 votes
15 answers
28k 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 <...
user avatar
  • 3,232
18 votes
2 answers
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"> <...
user avatar
  • 35.6k
12 votes
1 answer
18k 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 ...
user avatar
9 votes
2 answers
15k 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 ...
user avatar
  • 3,242
6 votes
2 answers
15k 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>...
user avatar
19 votes
2 answers
18k 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"...
user avatar
6 votes
1 answer
15k 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/...
user avatar
  • 1,427
6 votes
2 answers
29k 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> &...
user avatar
  • 2,044
2 votes
1 answer
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 ...
user avatar
  • 1,451
34 votes
3 answers
34k 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/...
user avatar
  • 2,172
14 votes
2 answers
57k 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"> ...
user avatar
  • 887
9 votes
4 answers
23k 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/...
user avatar
  • 1,622
23 votes
1 answer
9k 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.*.
user avatar
13 votes
2 answers
8k 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 ...
user avatar
  • 380
8 votes
2 answers
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 ...
user avatar
10 votes
3 answers
13k 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 ...
user avatar
  • 1,254
6 votes
3 answers
9k 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/...
user avatar
  • 1,622
9 votes
4 answers
7k 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" ...
user avatar
  • 3,758
6 votes
7 answers
15k 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 ...
user avatar
  • 151
4 votes
1 answer
9k 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" ...
user avatar
  • 3,153
13 votes
2 answers
15k views

Magento2: Default to sort by price descending not ascending

Ok so I have my categories sorting by price. Magento 2 defaults this to price ascending. But I would prefer it to be by price descending. Pretty sure I can do this by customising ...
user avatar
7 votes
2 answers
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 ...
user avatar
3 votes
2 answers
418 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? ...
user avatar
2 votes
2 answers
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 ...
user avatar
2 votes
5 answers
3k 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.
user avatar
  • 2,009
11 votes
1 answer
8k 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?
user avatar
  • 4,613
9 votes
3 answers
6k 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 ...
user avatar
14 votes
6 answers
31k views

Find out the "name" for a referenceBlock in Magento 2

I want to remove some blocks from my page. Say for example that I want to remove the container for the logo. Then I create /app/design/frontend/MYVENDORNAME/MYTHEMENAME/Magento_Theme/layout/default....
user avatar
  • 451
8 votes
1 answer
18k 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 ...
user avatar
14 votes
2 answers
10k 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 ...
user avatar
  • 1,579
6 votes
1 answer
15k 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"/> &...
user avatar
  • 609
26 votes
3 answers
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 ...
user avatar
  • 698

1
2 3 4 5
7