0

I try to extend

  • /vendor/magento/module-sales/view/frontend/layout/sales_order_view.xml

Therefore I created

  • /app/design/frontend/Company/basic/Magento_Sales/layout/sales_order_view.xml

inside my sub-theme with this content:

<?xml version="1.0"?>
<!--
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content" remove="true" />
    </body>
</page>

In the end I want to add content under the purchased items. Removing something is just for seeing if it works.

The theme is correctly used as far as I can see (I can overwrite templates inside the sub-theme folder)

But nothing changes on this page:

  • domain-dev.de/sales/order/view/order_id/1/

If I change /vendor/magento/module-sales/view/frontend/layout/sales_order_view.xml directly it works. But obviously this is not the correct way of doing things.

I also tried to add a block via sales_order_view.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="page.main.title">
            <block class="Magento\Sales\Block\Order\Info" name="customtext" template="customtextab.phtml" />
        </referenceContainer>
    </body>
</page>

and therefore added the file /app/design/frontend/Company/basic/Magento_Sales/templates/customtext.phtml with this content:

<div class="block" style="float: right;margin-bottom: 0.5%;margin-top: 0.5%;">
    <?php echo __('This is Custom Text overwritten'); ?>
</div>

like described here: How To Use Magento 2 Layouts

But nothing changes. I flushed the cache every time:

rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/*
php bin/magento cache:clean
php bin/magento cache:flush

And installed the theme by doing

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento indexer:reindex

I'm using Magento 2.1.7 with the vagrant box from paliarush: https://github.com/paliarush/magento2-vagrant-for-developers in case that matters.

Can anybody help me?

0

I solved it somehow myself.

I tried the exact same codebase on different infrastructures. It worked without any further investigation on aws/ec2 and vagrant/virtualbox.

Both are created with my own boot scripts. Could be that some configuration of the paliarush magento2 box prevented the layout cache to be flushed.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.