public function __construct(
    Context $context,
    array $data = []
) {
    parent::__construct($context, $data);
    $block  =  $this->getLayout()

    $this->getLayout()->addBlock($block, 'popup', 'popup.container');

This is my default.xml file

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <move element="header.switchers" destination="footer.panel.container" after="-"/>
    <!-- add new popup container-->
    <referenceContainer name="page.wrapper">
        <container name="popup.container" as="popup_container" label="PopupContainer" htmlTag="div" htmlClass="popup-container" before="main.content"/>

I get the following error:

Failed to filter the template: elements with an ID of "popup" are already defined

  • Without testing it, I would recommend changing popup to something else. Aug 20, 2018 at 16:17
  • It doesn't work, I tried other names but still the same...
    – glafche
    Aug 20, 2018 at 16:18
  • Did you bin/magento cache:clean after changing name? Aug 20, 2018 at 16:28
  • yes, I did but still nothing
    – glafche
    Aug 20, 2018 at 16:36


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.