Questions tagged [containers]

Denotes questions related to Magento 2 containers.

Filter by
Sorted by
Tagged with
1 vote
2 answers
29 views

Elasticsearch 7.11 connection refused using Devilbox

I'm starting the Elasticsearch 7.11 in my linux, and it works when i run curl -XGET localhost:9200 INSIDE MY LINUX. But the issue is, i'm trying to access this Elasticsearch service started in my ...
user avatar
0 votes
2 answers
383 views

How do I place a widget in a custom page layout?

I've created multiple custom pages like a contact page and FAQ page but both the pages and the containers I've labeled don't show up in the widget panel. What's the right way to add widgets to your ...
user avatar
0 votes
1 answer
1k views

How to create a docker image of an existing Magento 2 website running with Apache/PHP7.2/MySQL/ubuntu 18.04 version

We have a Magento 2 website and are trying to deploy the website as docker containers running in Kubernetes in GCP. At present, we have the website set up with a LAMP. So I believe we need to have the ...
user avatar
0 votes
1 answer
1k 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 <...
user avatar
0 votes
1 answer
26 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 '...
user avatar
0 votes
1 answer
311 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\...
user avatar
  • 2,441
0 votes
1 answer
223 views

Magento 2- Add custom container into product listing page

I've search for some answers to this but unfortunately I can't seem to find anything. I would really appreciate some help about this. I have created a custom container using XML in '...
user avatar
0 votes
3 answers
82 views

How to move existing links and add new custom links in top header?

I already check many answers regarding the move header.links to header-wrapper its working but the problem is that it also move my custom links to header content. I am trying to create a new ...
user avatar
1 vote
2 answers
405 views

Adding a block inside a block already in a container

I have a third-party module and I'm trying to inject a block of my own (a CMS block) between two of their blocks. I'm doing something wrong because I can get my block to appear at the very end or the ...
user avatar
  • 679
0 votes
3 answers
1k views

How to create an empty container and render it

I want to create an empty container and get it rendered. Currently my empty container isn't showing up. <container name="empty-container" htmlTag="div" htmlClass="my-class"/>
user avatar
  • 760
0 votes
1 answer
1k views

Running a script inside a docker container using shell script from host

I am new to Docker technology,I am trying to create a shell script on my host to clear caches and to deploy my static content in Magento 2 inside my apach containe. to access to my apach container i ...
user avatar
2 votes
1 answer
152 views

Remove container in block class

I want to remove some items from a page when certain conditions apply. I got a solution but I'm wondering if there isn't any better way to do this. Now the code that I have is for each block that I ...
user avatar
1 vote
0 answers
657 views

Contact form in CMS page with form.additional.info

I'm trying to add the contact form to my CMS page. I can add {{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"}} as indicated on this post ...
user avatar
  • 2,084
2 votes
5 answers
4k views

What is the functional difference of Block & Container in Magento 2?

Block vs Container functional difference. I have followed this url but doesn't clear much for me. Which type of classes are extended by block and container. Note : I know how containers and Block ...
user avatar
  • 7,399
1 vote
0 answers
883 views

Magento 2: How to move block into html div?

I want to move below block in third "col-md-4 col-lg-4" div:- <block class="Magento\Catalog\Block\Product\View" name="product.info" template="Magento_Catalog::product/view/form.phtml" after="alert....
user avatar
0 votes
1 answer
297 views

M2 | How to find referenceBlock name for the Sales Order View : Account Information Section?

Part1: I need to know the referenceBlock name for: Part 2: and put a button at: “If you have knowledge, let others light their candles in it.” ― Margaret Fuller
user avatar
  • 1,521
6 votes
1 answer
990 views

Scaling Magento 2 on multiple containers in production with generated code

I'm working on some auto-scaling Kubernetes infrastructure to run Magento 2, and I noticed that when I start new containers, I can't have the generated/ directory automatically compiled as part of the ...
user avatar
0 votes
1 answer
142 views

Magento 2 | Which refrenceContainer to use for adding additional button on 'Create New Order Page?

I am adding a new button with Add Products button at: Sales->Order->Create New Order->New Add Product Button as shown in screenshot! I searched for the relevant referenceContainer in vendor but all ...
user avatar
  • 1,521
2 votes
2 answers
3k views

Magento 2 | When to use referenceContainer and when referenceBlock?

I am getting same output if I use referenceContainer or referenceBlock As <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:...
user avatar
  • 1,521
0 votes
3 answers
584 views

Move block before Tab Magento2

i would like to create a banner on product view page and move this banner AFTER the short description and before the tab content. I user this code under catalog_product_view.xml <move element="...
user avatar
1 vote
1 answer
296 views

Conditionally removing a container

I am trying to replace the customer.login.container on the login page, which can be done through customer_account_login.xml by adding something like: <referenceContainer name="customer.login....
user avatar
  • 246
1 vote
1 answer
421 views

Magento2: Is it possible to get a reference to containers and programmatically add blocks to them?

$block = $this->getLayout() ->createBlock('Magento\Framework\View\Element\Template') ->setTemplate('MyModule_ProductTile::widget\test.phtml'); $this->getLayout()->...
user avatar
  • 467
2 votes
1 answer
814 views

In which referenceContainer of product page we add block for custom rich snippets of current product?

I have to extend default rich snippets for products. For this I have my script in .phtml file as: <script type="application/ld+json"> { "@context": "http://schema.org/", "@type": "Product", <...
user avatar
  • 1,521
0 votes
1 answer
1k views

Magento 2 : hide sidebar on mobile view

Magento 2.2.3 Theme: Luma My homepage uses layout: 2 column with left bar. I want to hide the image block ( CMS static block ) or whole sidebar container referenceContainer name="sidebar.main" from ...
user avatar
2 votes
1 answer
776 views

Why root block render automatically content in Magento 2

In Magento 1 we have the possibility the add a block in a root block so it will not be displayed because root is not a core/text_list block type (structural block), it doesn't render automatically the ...
user avatar
  • 11.3k
0 votes
0 answers
86 views

Find referenceContainer in Magento 2.1 module

This is my first attempt to write a Module for Magento 2.1 I have read the documentation for referenceContainer that is not very helpful, I would like to know how can I access and apply my change in ...
user avatar
1 vote
1 answer
2k views

Magento 2 : How to Remove Container Div From CMS Page

How to remove container block from cms page for particular layout. I have created new layout and apply on cms page but not able to customize it. Below my custom layout code: app/design/frontend/...
user avatar
  • 1,473
0 votes
1 answer
371 views

Magento 2.2.2 - Add Custom Wrapper using XML

I need to add additional wrapper inside page.wrapper so that other containers will be inside by custom wrapper. app/design/frontend/Vendor/Theme/Magento_Theme/page_layout/1column.xml <?xml ...
user avatar
2 votes
1 answer
303 views

Add container under body directly in Magento 2

In Magento 2, I want add a new container right.sidebar under <body> directly, not under content container. Then move the block catalog.product.related to the new container. I write the codes ...
user avatar
  • 3,185
1 vote
1 answer
3k views

Adding a new container to Magento 2 header-wrapper for main navigation

I'm trying to add a new container to Magento 2 and have a main navigation menu displayed in here (which I've created as a frontend block) then trying to add it to my own container where I can add a ...
user avatar
  • 217
5 votes
2 answers
9k views

Creating a new container and placing it where I want in Magento 2

I've search for some answers to this but I can't seem to find anything. I understand how to create the container and then move the blocks in there (which I've done), so this article wasn't that ...
user avatar
  • 217
0 votes
1 answer
151 views

Add container to custom page layout

I'm trying to add containers/blocks to a newly created page layout. However, they do not show up in the DOM at all: vendor/my/module/view/frontend/layouts.xml: <page_layouts xmlns:xsi="http://www....
user avatar
  • 326
2 votes
0 answers
564 views

Magento2 : Page_layout Container And Widget Configuration

I'm new on Magento 2, I have created a custom theme and a custom page_layout in /app/design/frontend/[Vendor]/[ThemeDir]/Magento_Theme/page_layout/homepage.xml <referenceContainer name="page....
user avatar
  • 21
1 vote
2 answers
3k views

Xml Element reference is not allowed here

I am new to Magento & I am using Magento version 2.1.7 in my Windows 8.1 system with Xampp while creating a new module I am getting an error in my XML file located in the app/code/vendor/module/...
user avatar
3 votes
2 answers
4k views

Magento 2 - Custom Homepage block not showing

I have developed a custom homepage layout and applied to the homepage. I've tried to add a created block in Magento_theme/templates/html/homepage.html but it is not displaying. Can anyone check ...
user avatar
  • 181
0 votes
1 answer
2k views

Magento2: Wrap all contents under .page-wrapper in new container

Im trying to add a secondary div wrapper if you like underneath the .page-wrapper, for example: <div class="page-wrapper"> <div class="my-new-wrapper-div"> <!-- ALL OTHER ...
user avatar
1 vote
1 answer
319 views

How To Add Block Outside of Magento_Theme?

<container name="container" label="header-container" as="header-container" htmlTag="div" htmlClass="container"> <container name="header-options" label="header-options" as="header-...
user avatar
  • 757
1 vote
1 answer
780 views

Reference container "left" not showing in Magento 2

I've written "Edit" page referencing this tutorial. https://github.com/mageplaza/magento-2-sample-module The top buttons are showing, but none of the "left" tabs are. I've gotten it to work with a ...
user avatar
0 votes
1 answer
220 views

Fetch product data by referenceContainer in product list page

I need to hide product price in product list page. By below code, I can hide price but I need some product data for condition. I have read that $block variable is available in block but I am using ...
user avatar
  • 91
0 votes
1 answer
816 views

How to create new container inside <main> tag in magento 2?

I am working with magento 2 layout containers. I need to create a container inside and below <div class="columns"> . My HTML should be like below, <main id="maincontent" class="page-main"&...
user avatar
1 vote
1 answer
551 views

Magento 2 Layout XML <container> "as" attribute

What exactly is the "as" attribute in <container> for in a layout xml? When do I need to reference this one contrary to "name"? <container name="sidebar.additional" as="sidebar_additional" ...
user avatar
  • 447
1 vote
1 answer
2k views

Adding top.links to new header container magento 2

I've added a new reference container inside of: Magento_Theme/layout/default.xml Here is my code for adding the new container: <referenceContainer name="header.container"> <!-- ...
user avatar
  • 1,353
0 votes
1 answer
466 views

Admin page content not loading: latter doesn't exist

I'm running Magento 2.1.3, and am seeing empty page content in my custom module's admin page, with the error Broken reference: the '[layout element name]' element cannot be added as child to 'left', ...
user avatar
  • 694
3 votes
1 answer
3k views

Magento 2 - wrap everything in a div

I need to wrap all my content in a div. I'm trying to add a container w/o any success. I created a child theme and a custom-home.xml config file as follow: <layout xmlns:xsi="http://www.w3.org/...
user avatar
  • 673
0 votes
1 answer
2k views

Magento 2 Add block to custom layout via admin panel widget

I've made a custom theme and custom homepage layout that renders a custom container and inside it a block with a custom template: custom_homepage.xml inside Magento_Theme/page_layout folder <?...
user avatar
2 votes
1 answer
3k views

Is it possible to Change Container htmlClass by override Magento 2?

I have a container defined in a layout file, but in some case with help of other xml I would like to change its htmlClass value, is it possible by override or something ? or need to create new ...
user avatar
4 votes
3 answers
12k views

How to add extra container to page header in Magento 2

I am working on a new theme which is based on the Luma theme. I need to add a extra container to page header.my problem is that I can't identify how/where to add this. Can anyone advise on what page ...
user avatar
2 votes
2 answers
8k views

Additional wrapper inside page.wrapper

I need to add additional wrapper in my Magento2 custom theme layout, so it would be <div class="page-wrapper"> <div class="my-custom-wrapper"> ... all other cotainers .... </...
user avatar
  • 1,605
3 votes
0 answers
159 views

Magento 2 - setting a container class programatically

How can I retrieve a container from the layout programmatically and then set/update the htmlClass? I would like to be able to do something like the following: $container = $layout->getContainer('...
user avatar
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