We have created a custom template to show some documents and download them. This template is located in the backend. You can access through the menu and the submenu of one of the options.

enter image description here

"Dealer Documents" is the option choose to access here. Then, if we close the menu you can see it properly: (but still without styles)

enter image description here

If we use the inspector we can see the layout appears to go to the wrong spot:

enter image description here

The red part is all the menu and the scripts. Basically, Magento's layout. And the green part is the custom template.

The layout code (app/code/ModuleVendor/ModuleName/view/adminhtml/layout/dealer_index.xml)

<?xml version="1.0" encoding="UTF-8"?>    
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="styles"/>
        <container name="content" label="Root">
            <block class="ModuleVendor\ModuleName\Block\Adminhtml\Dealer\Document" name="sap.dealer.document"

And the documents.phtml

<?php if (!empty($path)){?>
    <div class="fieldset-wrapper customer-information">
        <div class="fieldset-wrapper-title">
            <span class="title"><?= __('Dealer documents') ?></span>
        <?php condition{ ?>
            <table class="data-table">
                    <th><?= __('Name') ?></th>
                    <th><?= __('Type') ?></th>
                    <th><?= __('Size') ?></th>
                    <th><?= __('Download') ?></th>
                <?php foreach ($files as $file): ?>
                    <?php $realfile = $path . $file; ?>
                        <td class="col"><?=  ?></td>
                        <td class="col"><?=  ?></td>
                        <td class="col"><?=  ?></td>
                        <td class="col text-center">
                            <a target="_blank" href="" download=""><?= __('Download') ?></a>
                <?php endforeach; ?>
        <?php } else { ?>
            <div class="message warning"><?= __("You don't have any documents.") ?></div>
        <?php } ?>
<?php } else { ?>
    <div class="message warning"><?= __("There's no path defined in the backend.") ?></div>
<?php } ?>

What are we missing?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.