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
42 views

Magento 2: How to add a new phtml(template) to a layout file so I can use it in the head section?

I am trying to add a phtml template file to the layout file so that I can use this template in the head section to insert contents from an JS file. Please tell me what is the best way to do this?
0
votes
1answer
403 views

Magento 2: Exception #0 (Magento\Framework\Exception\LocalizedException): Invalid block type: Perfectmirrors\PmmLayout\Block\Head

I am really not sure how to create the block class Pmm\PmmLayout\Block\Head , function of which $block->getAllPagesJSContent() should be called inside my phtml file pmm_head.phtml <...
0
votes
2answers
270 views

Add block below short description on product page

I am developing a module and would like to put a block on the product page, immediately underneath the short description and above the dropdown selection. I have looked at every single answered ...
0
votes
1answer
274 views

Magento 2 - custom layout extending 2columns-left not working

I know there are 2 or 3 similar questions but there's no response for them. I'm creating a custom layout based on the 2columns-left layout. I have investigated from everywhere on the internet and the ...
0
votes
1answer
23 views

container after instruction doesn't work for some elements

I have created a custom theme from scratch, everything works perfectly except one thing, in my home page Vendor/Theme/Magento_Theme/layout/default.xml I can't place my 'main' container after my '...
0
votes
2answers
49 views

Magento 2.3 - adding block to layout

I created default.xml for my module. I want to inject block into header. I tried different ways like: <referenceContainer name="header.container" before="-"> <block class="Vendor\Name\...
0
votes
1answer
37 views

The correct way of layout declaration?

I'm doing some Magento 2 certification test questions. There's one question I do not understand. The question is as the screenshot. My answer is D, but the correct answer from the test is B I've ...
0
votes
1answer
238 views

How to change the product detail page to a 2 column layout in Magento 2.3?

I have created a layout XML file for a custom theme which inherits from the default Magento Blank theme: app/design/frontend/<Vendor>/<Theme>/Magento_Catalog/layout/catalog_product_view....
0
votes
1answer
205 views

Magento 2.3.4 - How to add css for a specific group of cms pages

I am going through hard times. After the latest updates, there is no more the Layout Update XML field in the admin panel (Magento 2.3.4). I needed to create a custom layout for some types of cms pages,...
0
votes
2answers
821 views

2.3.4: Update “Custom Layout Update” in Category doesn't work

I added the file :- app/design/frontend/VENDOR/THEME/Magento_Catalog/layout/catalog_category_view_selectable_[ID]_name.xml Edited the category in the backend to use the Specific Layout (Catalog->...
1
vote
1answer
272 views

How to remove the attribute element in the layout in magento 2

I wish to remove the attribute element in the catalog_product_view.xml file I have tried below <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
0
votes
1answer
51 views

I can not add a custom attribute to the product page

I use Magento 2.3.4 EE and when I try to add a custom attribute to the product page - I can’t do it. Mi file: app/design/vendor/theme/Magento_Catalog/layout/catalog_product_view.xml My code: &...
0
votes
2answers
85 views

Error getting Block in controller Magento 2: Element 'block', attribute 'class': [facet 'pattern']

I'm trying to get block in my frontend controller like this: $resultPage = $this->resultPageFactory->create(); $breadcrumbs = $resultPage->getLayout()->getBlock('breadcrumbs'); this is ...
0
votes
1answer
605 views

Magento 2.3.4 custom layout update - insert different facebook OG on each page

I need to have a different Facebook OG:IMAGE for each CMS PAGE. I found on official documentation how to add a custom layout update on Magento 2.3.4 --> I've already created this file ...
0
votes
1answer
101 views

Street Address Validation in Checkout for Magento 2 issue

I am trying to apply a street address validation from the checkout. In my checkout_index_index.xml file, I've added this: <referenceBlock name="checkout.root"> <arguments> &...
0
votes
1answer
76 views

unable to add css to checkout index page

i want to add custom css to only checkout index page but it seems not working tried below steps 1: created css file /usr/share/nginx/html/app/design/frontend/package_name/theme_name/Magento_Checkout/...
0
votes
1answer
217 views

overriding product page title and meta title in multi language store

I have Magento store with two languages, English and Arabic. When we inserted the products in the English store view, then translate the product title to Arabic. The product meta title, description ...
2
votes
0answers
149 views

Use knockoutjs in Ui component of Admin form

I have created a form using UI component on Admin side. If i want to add a .phtml then i can add the file this way. <htmlContent name="driven_form_design"> <block class="Magento\Backend\...
0
votes
2answers
303 views

Magento 2 - Moving Custom Options under the main image on Product Page

Greetings Stack community - I'd like to move the first custom option group under the main image (see image). Separating the options is probably not that simple, so I think that moving the "Options ...
1
vote
1answer
59 views

How to add view.xml in custom module for displaying custom gallery in magento 2

I am displaying a custom gallery in a custom module and I have to resize my images. I need to know how I can use view.xml in my custom module. If you have a relevant answer then please let me know.
0
votes
1answer
159 views

Magento 2 - new container not showing in overriden layout file

I try to change the layout vendor\magento\module-catalog\view\frontend\layout\catalog_product_view.xml in my own theme. I have overriden the layout file completly: app\design\frontend\company\base\...
0
votes
1answer
90 views

Magento 2 | Add field to customer edit in adminhtml

I want to edit a field to the customer edit in admin html. When you look at the picture I want to add a field below "First Name". I don't want to create a customer attribute, I just want to add a ...
0
votes
1answer
47 views

Magento 2 | add custom customer attribute to checkout

I created a custom customer attribute and now want the customer to be able to edit in in checkout. How can I do that? Thanks in Advance!
1
vote
2answers
83 views

Magento 2.3 Frontend module page blank

I'm trying to create a simple frontend module on Magento 2.3.2, It seems to work, but I see a blank content on frontend. I have this folder structure -app -code -MyVendor -...
0
votes
1answer
335 views

Magento 2.3 show Block only when customer not logged in

I need to show a Block on my product detail page when the customer is not logged in only. What is the best way to achieve that in Magento 2.3? Thanks in advance!
0
votes
1answer
125 views

Magento2: How can get current page layout?

How can I get the current page layout programatically? I have tried this: $block->getLayout()->getUpdate()->getPageLayout(); But the output is: 1column but that is wrong. Any idea how to ...
0
votes
1answer
171 views

Magento 2 | add Terms & Conditions to customer registration

I am currently trying to add Terms & Conditions to the customer registration. I thought the best would be just to update the layout. So I simply extended customer_account_create.xml this in my ...
0
votes
1answer
48 views

Link Custom Block to custom page

I created a custom block and was able to link to it on the home page or display it there. Unfortunately I don't get the block displayed on another page I created via the backend. If I understand the ...
0
votes
1answer
31 views

Apple Safari Column Layout Issues on Category pages Magento 2.3

I am hoping someone will be able to give me some advice. I have noticed that when using Apple Safari browser, the columns on our product category pages do not seem to line up. I have the left hand ...
0
votes
1answer
35 views

Magento 2 - Should I always copy the whole layout file into my theme and make my changes?

I have to modify the layout of the catalog_product_view.xml. Should I copy the whole file into my theme and then make my changes or should I create the file catalog_product_view.xml in my theme and ...
0
votes
1answer
15 views

Simple colums in editor

the best way to create column in the editor is? I try to create with Bootstrap class but, it's not working... Thanks
0
votes
1answer
231 views

Magento 2 - Load .css file on checkout page

I need to load the css file THEME\Magento_Checkout\web\css\checkout\index\index.css in the checkout page only. So I created the file THEME\Magento_Checkout\layout\checkout_index_index.xml and added a ...
0
votes
0answers
18 views

Price issue with move element in xml file

catalog_product_view_type_grouped.xml I have assign configurable product in group product and price is showing properly for configurable product's swatch option. But when i write below script to ...
0
votes
1answer
113 views

i want to override file vendor/magento/module-theme/view/frontend/layout/default.xml in magento 2.3 porto theme

I am using smartwave porto theme in magneto 2.3.2.I am new in magento.How to override this above title file. But I checked in app/design/frontend/Smartwave/porto/Smartwave_Porto/ In above path module-...
0
votes
1answer
462 views

Magento 2.3: My layout handle is not working in email template

I had created the custom email template in that I declared the layout handle email template it is not working what can I do for it. I passed the data from the controller but the email is not coming ...
0
votes
1answer
23 views

Remove cacheable=“false” form Block in Layout file

In my multiple layout file has many block which have cacheable="false" attribute <block class="Block\Class" name="blockname" cacheable="false" /> if cacheable="false" is not add there have ...
0
votes
1answer
52 views

Magento Commerce 2.3 remove register-link B2B in layout.xml

In my B2C store I removed the register-link in my theme. I achieved this removing it in the Magento_Theme default.xml with the following directive: <referenceBlock name="register-link" remove="...
0
votes
1answer
89 views

I want to get images form product gallery of a product and display them one by one in Product detail page

This is the gallery.phtml code which is displaying main thumbnail image only <?php $images = $block->getGalleryImages()->getItems(); $mainImage = current(array_filter($images, function (...
0
votes
1answer
95 views

Magento 2 - How to get base URL in layout file?

I need to add the livereload script which listens on a certain port, e.g. <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../....
0
votes
2answers
628 views

Magento 2: Product image to be displayed one by one instead of slider

Right now the images are shown in slider but I want to show them one by one like 1st image 2nd image 3rd Image Not like the slider Gallery.phtml contain the following code <div ...
0
votes
2answers
286 views

Display related products on sidebar

I want to display related products if they exist on the sidebar on product page over featured products. Please advise EDIT ADDED catalog_product_view.xml code <referenceBlock ...
-1
votes
1answer
65 views

Magento2 static block now being moved via xml

I have a Magento2.4 based site and I edited the default.xml to load static cms block in the footer div and align them next to each other. My issue is one of the static blocks keeps appear outside the ...
0
votes
2answers
41 views

Element 'body' : Character content other than whitespace is not allowed because the content is 'element-only' after Magento 2.3.4 upgrade

After Magento 2.3.4 upgrade, Error is "Element 'body' : Character content other than whitespace is not allowed because the content is 'element-only'" on Product details page. Actually after ...
0
votes
1answer
859 views

Magento 2 - How to change the sort order of customer account navigation links

I want to change the sort order of the customer account sidebar navigation links and rename the texts, please help me to get the output for this situation. Current Order & Text's: Change to : ...
0
votes
1answer
258 views

Magento 2.3.3 - Change price in catalog product view

I want to change the price in the Catalog View Page, I use a price attribute with the name rrp, and I need when customers are logged to display this price attribute otherwise display the normal price. ...
2
votes
1answer
193 views

Magento 2 Product page layout change

Magento 2 change the product page layout as below :- <referenceBlock name="head.components"> <block class="Magento\Framework\View\Element\Js\Components" name="...
0
votes
2answers
102 views

Magento 2: Product Detail Layout change

I want to make the product detail into 2 Columns with images at the side and description on the other side... I want the right side containing the detail to be sticky while scrolling and left side ...
1
vote
1answer
43 views

Magento2 - Adobe XD to Magento2 font size

On the xd design the font-size is 55 and when I apply this font-size in my Magento layout It is bigger ? Why is it so?
0
votes
2answers
943 views

Layout Update XML for Category in Magento 2.3.4

Can anyone help me how to change number of products per page for a SPECIFIC category. I am on magento 2.3.4 and noticed that Layout Update XML does not exist anymore.
0
votes
1answer
222 views

Magento 2 - change block class in layout

I know I can change the template of a block with: <referenceBlock name="copyright"> <action method="setTemplate"> <argument name="template" xsi:type="string">Dfr_Backend:...

1 2 3
4
5
56