People who code: we want your input. Take the Survey

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
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. ...
0
votes
2answers
908 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
2k 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 "...
11
votes
4answers
19k 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> <...
8
votes
2answers
9k views

What is <update handle=“customer_account”/>?

What is the Handler? Can someone explain the below code? <update handle="customer_account"/> or same code like above for example : <update handle="default"/> and how it worked !?
8
votes
1answer
18k views

Reference before_body_end doesn't work - after_body_start does?

Starting to think I've lost my mojo... Both blocks named before_body_end and after_body_start are of type core/text_list. However, the following layout xml: <layout> <default> ...
7
votes
2answers
5k views

Magento 2 - How to reset XML block arguments such as CSS

I'm wondering how to unset CSS that has been set through the XML, for example: <block class="Magento\Framework\View\Element\Template" name="navigation.sections" before="-" template="Magento_Theme::...
6
votes
2answers
3k views

Magento 2.2.1 - how to give discount on payment methods?

I go to Magento 2.2.1 Admin > Marketing > Promotions > Cart Price Rules and create a new Rule: Conditions. Option "Payment Method" is not showing up in Conditions Tab. I want to give some ...
5
votes
1answer
2k views

How can I add meta noindex to all catalog search result pages in Magento2?

As the title states: How can I add meta noindex to all catalog search result pages in Magento2? I am hoping for an XML Layout solution.
5
votes
5answers
4k views

How to remove “Help us keep magento healthy” in Magento 2.1

Can anybody tell me where they moved this? Changed the footer.phtml in /html/vendor/magento/module-theme/view/frontend/templates/html But it is still being shown, so it must be somewhere else.
5
votes
2answers
2k views

Add custom block to admin order view

I am trying to add a custom block to the admin order view page and am doing this via an observer using the event core_block_abstract_to_html_before. I am using the giftmessage block, clone it and add ...
4
votes
1answer
10k views

Magento 2 - how to make a custom (home) page-layout [duplicate]

The overrides structure that I have made for custom theme is (based on Blank): app > design > frontend > Magento > gc>Magento_Theme > templates It's now possible to override phtml ...
4
votes
1answer
3k views

NO INDEX, NO FOLLOW on Specific Category Magento 2

Can I set a specific category to NO INDEX, NO FOLLOW in Magento 2? In the previous version I could use an updated layout XML reference to do this within a specific category.
4
votes
1answer
4k views

Remove Css and js from new custom page_layout from header and body Magento 2

I have created a new Design Layout (named "blank") for select in page creation in my theme i have these created. design/frontend/Vendor/Theme/Magento_Theme/layouts.xml <?xml version="1.0" ...
4
votes
2answers
12k views

How to override product list page [duplicate]

I'm trying to override the list product page. My objective is add certain information on each product above the add to cart button for example. I already did with the single page product, just ...
4
votes
2answers
752 views

Where does Magento look for a controller when the layout filename is bigger than three names?

I understand that in my module/view/frontend/layout folder, if I create a file called social_index_index.xml this file will refer to a controller located at Social/Controller/Index/Index.php. However ...
4
votes
1answer
2k views

Can I get store configuration value in layout.xml file?

I have created a module in which I have some setting in admin panel for layout. My layout.xml code (in this I have added link in top links): <reference name="top.links"> <...
4
votes
2answers
3k views

How to move Success, Error messages position?

How to move Add to cart success and error message above Add to cart button and not at the top ?
3
votes
1answer
4k views

Change order of JavaScript files in head

I add a custom JavaScript file with the following code: <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../...
3
votes
3answers
9k views

How to remove tool bar in Magento 2

I would like to remove the tool bar from my theme since I don't have that many products. So far I have tried this in my /app/design/frontend/VENDORNAME/THEME/Magento_Theme/layout/default.xml <...
3
votes
3answers
14k views

Changing the Search Results page to use 1 column layout in Magento2

As far as I can tell Magento2 is not working as expected here. In /Magento_CatalogSearch/layout/ I have 4 XML files: catalogsearch_advanced_index.xml catalogsearch_advanced_results.xml ...
3
votes
2answers
4k views

Completely overwrite parent theme layout from the default.xml file of the child theme

I am working on a Magento 2.1.7 shop. To achieve this, I have created a child-theme of Magento Blank. I am new to Magento unfamiliarized with the complexity of overwriting the parent theme's layout ...
3
votes
1answer
3k views

Magento load layout handle directive programmatically

In an e-mail template I found this layout handle which is displaying an overview of purchased products: {{layout handle="sales_email_order_items" order=$order}} I'm trying to load this layout handle ...
2
votes
3answers
5k views

Magento 2: change the “Contact Us” page layout

I am working on a Magento 2.1.7 shop and I have created a child-theme of Magento Blank. I've changed the layout of my homepage to 2 columns with left bar from Content -> Pages. I need to do the ...
2
votes
2answers
114 views

Is there any events that are `specific layout handle based` or `specific controller based`?

So I have a situation where I really need to observe an event which is layout handle specific. In my case, I want to set a root template for the handle catalog_category_default. I think I can use ...
2
votes
2answers
13k views

How to move category title above products column in Magento 2

In Blank theme the category name is located to the left just above the layered navigation sidebar. I'd like to move the category name to the right, above the products column, so the side bar goes up.
2
votes
0answers
136 views

Missing column in Shopping Cart Table in magento 2

Here is my snapshot: The row of "Angel Light Running Short" does not having column stock. And then I tried to empty my app/code/Company/ModuleName/view/frontend/templates/cart/item/default.phtml ...
2
votes
1answer
3k views

How to override the blank theme by default.xml?

I tried to override the app/design/frontend/Vendor/MyTheme/Magento_Theme/layout/default.xml, but it doesn't show any changes. I want to add custom links in top.links of parent theme (blank theme): &...
2
votes
2answers
2k views

How to override adminhtml phtml in Magento2?

How to override vendor/magento/module-shipping/view/adminhtml/templates/view/form.phtml file in magento2
2
votes
1answer
3k views

how to disable cache for a CMS page?

I want to disable the cache for a particular CMS page I have hours and hours search through the internet and gained nothing. I know that an observer load pages and so i can ban cache for the ...
2
votes
2answers
1k views

How to Get Layout Name in which is block is placed

I have My block <block class="Vendor\ModuleName\Block\Frontend\Linked" name="catalog.product.linked" template="Vendor_ModuleName::slide.phtml" /> in this file app\code\Vendor\ModuleName\...
2
votes
2answers
969 views

How to target a specific Admin Config section with a layout update

It is relatively easy to target the adminhtml_system_config_edit node with layout updates in a layout.xml file by using: <adminhtml_system_config_edit> <reference name="head"> ...
2
votes
3answers
7k views

How to check whether a block exist ( based on its type )

This really confuses me !! I came to a situation, where I need to create a new block (core/template block) programmatically, if there is CMS Block present in a page layout. In general case, according ...
2
votes
1answer
2k views

Magento 2 : Add header and Footer in Checkout custom theme

I need to add header and footer on checkout page. i have try below code for this but its not working its display only Logo on Header i want to add full header with menu and top links. app/design/...
2
votes
3answers
2k views

How add div after image block in Magento 2?

I want to add custom div after image block of product view page. In that div I will add custom html like add any text, image etc. Anyone have idea how we add custom div by plugin or observer?
1
vote
1answer
2k views

Form Creation for Custom tab in customer dashboard Magento 2

I added custom tab in customer dashboard, using customer_account.xml and i need to create form to this custom tab, if I click this custom tab, form will open in content area based on customer ...
1
vote
3answers
2k views

how to call phtml inside phtml

I have a custom phtml inside I called attribute.phtml but it's not working: echo $block->getTemplateFile('Magento_Catalog::product/view/attribute.phtml'); echo $this->getLayout() ->...
1
vote
2answers
7k views

Magento Local XML not called

I was wondering why my Magento local.xml is not being called. I have a package with multiple themes. Package Default /layout/local.xml Theme1 /layout/local.xml Theme2 /layout/local.xml I'm ...
1
vote
2answers
4k views

Magento 2: magento layout not pick by magento

I found this error in system.log file and my layout is not loading in frontend. main.CRITICAL: Broken reference: No element found with ID 'before.body.end'. [] []
1
vote
2answers
339 views

where is default template for link defined?

Please look at this screenshot: Then look at "Mi cuenta" and "Crear una cuenta" links. As you see, those don't have templates defined, and in fact, when I saw the XML for layout, there is no en ...
1
vote
3answers
12k views

Magento custom block shows Fatal error: Call to a member function setTemplate() on a non-object

I have created one block inside my custom module but it's not working. My module is working fine but my block is not working when I call my block from footer.phtml file it shows 'Fatal error: Call to ...
1
vote
2answers
4k views

Add a child block to product.info.tabs description tab

I am using tabs for my product view page. In my local.xml I have the following: <catalog_product_view> <reference name="product.info"> <block type="catalog/...
1
vote
2answers
1k views

XML block Layout

I am trying to show newsletter block in the footer, except for the Homepage where I want to show it only in content area. I used local.xml to move newsletter from left to footer: <reference name="...
1
vote
1answer
11k views

change the layout of the home page

I am trying to change the layout of home page to 2columns-left.phtml. According to my understanding if I change the template file of the "root" block, in page.xml layout file, to the above template ...
0
votes
1answer
3k views

Magento 2- How to move custom options after cart button?

I want to move custom options below Add to Cart button and also want to move short description within form tag.How can I achieve this? Also I want to know why my custom php code not working in ...
0
votes
1answer
9k views

How to Add Admin page new menu and a sub menu under existing menu

I tried to create a simple module and menu.The Menu is successfully created and show. My question is how to add the same menu as a sub menu of existing menus(Ex : System). here is my Approach to ...
0
votes
4answers
10k views

How to move the add to cart section under the short description on product view page

I am customizing the Magento2 Blank theme, by using a custom child theme. On the product page, I want the custom options and add to cart section to appear below the short description. All products ...
0
votes
3answers
2k views

Difference between <catalog_category_default> and <catalog_category_view>

in vendor.xml file Difference between <catalog_category_default > <reference name="content"> <block type="vendor/vendor" name="vendor" template="vendor/...
0
votes
1answer
2k views

Magento 2: How to add custom css class in Checkout shipping address form

Want two input fields in one Line on checkout page. Looks like it is binded by knockoutjs. Didn't figure out where to add custom classes. Looked into so many files (Magento_Ui and Magento_Checkout) ...

1 2 3
4
5
7