cancel
Showing results for 
Search instead for 
Did you mean: 

override xml layout only items

override xml layout only items

hi there. i want to override phtml of third party extension. 

 

i read this(quite usuful) and create my module.

How to Override a phtml File Using a Custom Module in Magento 2 

 

and put there files but does not work.

 

MyModule
    ├── etc
    │   └── module.xml
    ├── registration.php
    └── view
        └── frontend
            ├── layout
            │   └── quotation_quote_checkout.xml
            └── templates
                └── quote
                    └── add-to-quote-button.phtml

this is what i want to override

vendor/cart2quote/module-quotation-encoded/view/frontend/layout/quotation_quote_checkout.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">                         
    <body>
        <referenceBlock name="quotation.quote.form">
            <block class="Cart2Quote\Quotation\Block\Quote\QuoteCheckout\Onepage" name="checkout.root" template="Cart2Quote_Quotation::quote/quote-form.phtml" cacheable="false">
                <arguments>
                    <argument name="jsLayout" xsi:type="array">
                        <item name="types" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="config" xsi:type="array">
<item name="deps" xsi:type="array">
<item name="0" xsi:type="string">checkoutProvider</item>
</item>
</item> <!-- lots of items abridgement-->
<item name="add-to-quote-button" xsi:type="array"> <item name="component" xsi:type="string">Cart2Quote_Quotation/js/quote-checkout/view/add-to-quote-button</item> <item name="sortOrder" xsi:type="string">999</item> <item name="displayArea" xsi:type="string">quotation-fields</item> </item>

just want to overide only the item names 'add-to-quote-button' (i deleted indent because toooo much long)

 

my quotation_quote_checkout.xml is 

<?xml version="1.0"?>                                                                                                                                                                             
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="checkout.root" template="MyCompany_MyModule::quote/add-to-quote-button.phtml"/>
    </body>
</page>

then

setup:upgrade

setup:di:compile

setup:static-content:deploy

 

i just checked pub/static/frontend/MyTheme/, there is a original file, not mine.

could you give me any advice?

 

1 REPLY 1

Re: override xml layout only items

o perform overriding you must create an overriding layout file in the directory of your theme. You can override base layouts and theme layouts as well. The mechanism is pretty similar, but there are some differences. So let’s consider the examples  McDVOICE.