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
0
votes
1answer
355 views

Magento “left” reference element xml layout problem

I have been trying to solve the issue for past few days with no luck. The left sidebar is missing from all of the 2column-left pages. It worries me especially when it comes to customer account as the ...
12
votes
3answers
16k views

How to render HTML with AJAX in Magento 2

I try to find the best way to render HTML through AJAX in Magento 2. Way 1 : Using Controller without layout File Foo/Bar/Controller/Popin/Content.php <?php namespace Foo\Bar\Controller\...
12
votes
1answer
13k views

What is the difference between getChildHtml and getBlockHtml

Synopsis What is the difference between getChildHtml and getBlockHtml? How can I get the cms/block title in the template? I have essentially replaced the footer with my own footer and set my own <...
12
votes
1answer
4k views

Magento 2: Does Module Sequence Impact Layout Handle XML Loading Order?

Do the <sequence/> tags in module.xml files impact the order Magento will process layout handle XML files in? My preliminary research says no, but that seems wrong so I'm looking for ...
9
votes
4answers
53k views

Adding CSS and JS to <head> using a module layout.xml for block

Synopsis I would like to add a block to my grouped product view and my simple product view. This block will have some nice tooltips for hover states, i'm using a small library with one jquery plugin ...
5
votes
1answer
14k views

Move layered navigation block between product list toolbar and product list

I have moved the layered navigation block into the content section however I can't figure out how to position the block. I can only get it to show at the very top of the page or the bottom. I need it ...
4
votes
2answers
17k views

Magento 2 create new page header section

I am new to Magento2 and I am confused how to proceed when I want to rewrite default part of the Luma theme page completely. For example the header - I want to rebuild it from scratch, adding whatever ...
2
votes
1answer
11k views

How to add extra fields in Registration Form? [closed]

How can I add a paragraph and extra fields in Registration Form?
15
votes
1answer
3k views

Incorrect loading order of Layout XML

When I create a layout file for the admin area (whether in the community or local code pool), sometimes Magento is loading that layout xml in before the Adminhtml module layout xml is loaded. The ...
10
votes
2answers
26k views

Magento2: Add custom template to product details page below add to cart section

I'm trying to add custom template to product page under social sharing section. In my module I've following code in layout file default.xml <body> <referenceContainer name="product.info....
8
votes
2answers
6k views

How to add breadcrumbs on cart page in magento2?

I want to add breadcrumbs to the shopping cart page before the page title like this: How can I achieve this.? Thanks..!
4
votes
4answers
11k views

Magento2 custom module overrides layout: The element “checkout.cart.item.renderers” already has a child with alias “simple” in exception log

In a custom module I override the cart item template. It works, but my exception log is filling up with The element "checkout.cart.item.renderers" already has a child with alias "default" and alias "...
12
votes
3answers
15k views

Magento 2: style-m.css vs style-l.css

How style-m.css and style-l.css files are generated in Magento2? In theory style-m.css should have less code and to have styles only for mobile devices than style-l.css in order to load on mobile ...
9
votes
3answers
11k views

Magento 2 : How to remove and change My Account Navigation

I'm trying to remove some tabs and change the navigations title : As you can see above navigation How to remove some navigation and change the title ? For example removing Address Book change ...
8
votes
1answer
4k views

Remove Title suffix from home page only

I have give Title suffix in magento system configuration like | Magento site. So this 'll add Title to every page in the store as suffix. But when i goto home page title shows like Home | Magento ...
7
votes
2answers
3k views

Layout local.xml versus module layout

I've recently started using the local.xml as my playground for layouts. Before I had my doubts using it because of...reasons. I got to see it's advantages, but I hit a brick wall now. In the default ...
5
votes
1answer
2k views

Cache blocks that contain form_key (i.e. dynamic content)

I wonder, if there is a best practice to use block caching for blocks that contain a form with the form_key input (CSRF token). I am not talking about full page cache hole punching, but the standard ...
3
votes
2answers
11k views

How can i override this vendor layout file with my custom layout file in magento 2?

I have created a custom module in magento 2 and its layout file is located in app/code/Learning/RewriteSales/view/adminhtml/layout/sales_order_view.xml but the system loads the layout from vendor/...
3
votes
2answers
6k views

How to move correctly block-search and minicart to panel wrapper? Magento 2

How to move correctly block-search and minicart to panel wrapper?
3
votes
1answer
5k views

parent and child themes

I have followed the article here, http://alanstorm.com/magento_infinite_fallback_theme_xml and I have it working 99%. There is an odd thing happening that clearing the cache and all the moving around ...
2
votes
1answer
1k views

Relationship Between Module Layout Handle XML files and Theme Update XML Files

What's the relationship between a module's layout handle XML file and a theme's layout handle XML file? Which files have priority? When does one file replace another file? When does one file merge ...
21
votes
2answers
7k views

Difference between <remove name=”" /> and <action method=”unsetChild”> in layout

What is the difference between <action method=”unsetChild”> and <remove name=""/>? Both functions are used to remove a block from the layout. Could someone explain with an example?
13
votes
4answers
26k views

Pass data to getChildHtml() or call method on child block

I want to be able to pass data to the getChildHtml() call. The reason is, the output of the block is dependant upon a product type. So i want to pass the product to the getChildHtml so that it can ...
12
votes
3answers
1k views

Remove a block from layout without a name

I want to remove a block from the layout in magento 2 that is declared in a third party extension, but the block does not have a name. Can I do that? The block is declared like this <...
9
votes
4answers
11k views

How to add custom layout handles programatically for Category View in Magento 2

So, I want to add a custom layout handle for all category view pages.. the handle that is supposed to be loaded depends on certain category parameters, so the handle needs to be added programmatically ...
6
votes
1answer
5k views

complete flow of a magento

I want to know the complete flow of a magento view. Suppose i am viewing the home page, can I ask how the flow of control goes through the PHTML, XML and PHP files , in order to view the home page? ...
6
votes
3answers
23k views

Display more items per row in products/category pages

I am trying to display more products on a single row. I don't know where I could do that? For now, it displays only 3 products per row and there is a lot of empty space. I would like to display 5 ...
6
votes
1answer
6k views

Magento 2 add custom data to checkout

I am trying to add some additonal data under checkout items summary (right sidebar). I am not figuring out how to get dynamic data from maybe Block (or other way). Here it is what I have already ...
6
votes
2answers
6k views

How to Add a viewModel to a core block?

I am trying to overwrite a core template and add my custom logic using a viewModel as follows: <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&...
6
votes
3answers
8k views

Magento2: How to rename the Details tab on the product details page, via overwriting layout file?

How can I use arguments in an xml layout file to overwrite the Details tab title on the product details page? The layout file I hope to overwrite is: vendor/magento/module-catalog/view/frontend/layout/...
5
votes
4answers
514 views

How to use $htmlAttributes?

In vendor/magento/module-theme/view/base/templates/root.phtml:11 there is this code: <html <?= /* @escapeNotVerified */ $htmlAttributes ?>> ... </html> It looks like we can use ...
5
votes
1answer
18k views

Calling custom .phtml file in footer?

I am having trouble getting a custom .phtml file to output in the footer. Here is the path to the file: beckin/themesettings/socialaccounts.phtml I created an xml file called beckin_themesettings....
5
votes
2answers
20k views

Using “Layout Update XML” to add a block to the sidebar

When I create a new page in Magento 2 using the "two columns with left bar" layout it by default puts the wishlist in there. Using the "layout update XML" in the design options tab I can remove that ...
4
votes
1answer
21k views

Add block in header layout

I have added my custom module block in header in layout like below pinsearch.xml <default> <reference name="header"> <block type="core/template" name="pinsearch" as="...
4
votes
1answer
277 views

How to make grouped products table show in its own row above the details tab and below the images/short description?

If it's a grouped product then how do I show the products table above the details tab in the Luma theme? See this image to for a better explanation: Basically, I want it to work as follows: If the ...
4
votes
2answers
14k views

how to add js in custom module layout xml file

I want to add js in my custom module layout xml file Below is my code: <reference name="head"> <action method="addJs"><script>varien/provfvfvfvf.js</script></action> &...
4
votes
1answer
1k views

Custom added field to checkout is not validating when I go the next step

I've added a date of birth field to the checkout in Magento 2 like so: <body> <referenceBlock name="checkout.root"> <arguments> <argument name="jsLayout" ...
3
votes
3answers
9k views

How to determine all blocks and child blocks attached to a handle?

Is there a way to determine which blocks are attached to a handle and/or what child-blocks a block have?
3
votes
4answers
11k views

Magento 2 - How to move the product price block before addtocart button?

I am using custom theme and trying to move the "product.info.price" block before the addtocart button. I have tried, direct into addtocart.phtml file but not working. <?php echo $this->...
2
votes
6answers
22k views

Product Attribute on Products Grid/List View (manufacturer)

I try to show Product-Attributes on the Grid-View (catalog(products/list.phtml). At app/code/coreMage/Catalog/Block/Product/List.php I found this public function addAttribute($code) { $this->...
2
votes
1answer
1k views

Magento 2 Homepage as a Category

Is there a way to make the home page display as the default category? I don't want to use the cms widget, I want the customer to be able to sort and refine the products displayed. I thought I could do ...
2
votes
2answers
952 views

M2: Referencing a container vs referencing a block

I'm trying to add some text (label) to product page. Following works for me: <referenceContainer name="product.info.main"> <block class="Magento\Framework\View\Element\Text" ...
2
votes
2answers
5k views

How to create custom cms page layout file?

In Magento 2, is there any solution to creating a custom layout XML file for custom cms page? I want to add XML code and CSS and Js only for my custom cms page. I know about there is one field ...
1
vote
2answers
2k views

layout - call left column block within main column (in the 1column.phtml template)

I have a category list page which uses the 1column.phtml template. However, when the user navigates to a category where there are no subcategories - and only its products are displayed - I would like ...
1
vote
1answer
3k views

how to achieve this 2 columns page layout?

I try to get a hang of how to design a custom homepage design. I tried the samples I found here Creating a custom homepage template in Magento2 and have build a basic custom layout as pointed out. ...
1
vote
2answers
9k views

How to change Layout for Desktop and Mobile in Magento2

I will discuss this issue with live example. I want different structured header layout for desktop and mobile version. First I create page_layout home.xml in my theme path app/design/frontend/...
0
votes
2answers
895 views

Change theme dynamically from frontend doesn't update xml layout

So i have a dropdown i created that fires a request to change a theme by saving the selected theme in the current session. I set up an event/observer that changes the theme based on that session ...
14
votes
3answers
1k views

Is there a local theme layout XML file other than local.xml?

I've built a theme by creating and editing the following file: frontend/mypackage/default/layout/local.xml I have a store view "site1", and wish to make exceptions on the default local.xml of "...
9
votes
1answer
1k views

Make selected custom shipping method shows custom input textarea at onepage checkout

I successfully added custom shipping method like this: app/etc/config.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="...
9
votes
4answers
16k views

Set and get block arguments programatically

In layout when I create a block I can set custom arguments, for example: <block class="Company\Module\Block\Hello" name="block_name" template="test.phtml"> <arguments> <...