PHP code example of copex / module-warranty-label

1. Go to this page and download the library: Download copex/module-warranty-label library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

copex / module-warranty-label example snippets

xml
<!-- app/design/frontend/<Vendor>/<theme>/Magento_Catalog/layout/catalog_product_view.xml -->
<referenceBlock name="copex.warrantylabel.garan.product" remove="true"/>
<referenceBlock name="product.info">
    <block class="Magento\Catalog\Block\Product\View"
           name="copex.warrantylabel.garan.product.hyva"
           template="CopeX_WarrantyLabel::garan-product.phtml"
           ifconfig="copex_warrantylabel/garan/enabled">
        <arguments>
            <argument name="view_model" xsi:type="object">CopeX\WarrantyLabel\ViewModel\GaranProduct</argument>
        </arguments>
    </block>
</referenceBlock>
phtml
<!-- .../Magento_Catalog/templates/product/view/product-info.phtml, where the label belongs -->
<?= $block->getChildHtml('copex.warrantylabel.garan.product.hyva') 
xml
<!-- app/design/frontend/<Vendor>/<theme>/Magento_Checkout/layout/checkout_index_index.xml -->
<referenceBlock name="checkout.root">
    <arguments>
        <argument name="jsLayout" xsi:type="array">
            <item name="components" xsi:type="array">
                <item name="checkout" xsi:type="array">
                    <item name="children" xsi:type="array">
                        <item name="steps" xsi:type="array">
                            <item name="children" xsi:type="array">
                                <item name="billing-step" xsi:type="array">
                                    <item name="children" xsi:type="array">
                                        <item name="payment" xsi:type="array">
                                            <item name="children" xsi:type="array">
                                                <!-- the new place -->
                                                <item name="afterMethods" xsi:type="array">
                                                    <item name="children" xsi:type="array">
                                                        <item name="copex-warranty-notice" xsi:type="array">
                                                            <item name="component" xsi:type="string">CopeX_WarrantyLabel/js/view/checkout/notice</item>
                                                        </item>
                                                        <item name="copex-warranty-garan-summary" xsi:type="array">
                                                            <item name="component" xsi:type="string">CopeX_WarrantyLabel/js/view/checkout/garan-summary</item>
                                                        </item>
                                                    </item>
                                                </item>
                                                <!-- the originals, switched off so nothing shows twice -->
                                                <item name="payments-list" xsi:type="array">
                                                    <item name="children" xsi:type="array">
                                                        <item name="before-place-order" xsi:type="array">
                                                            <item name="children" xsi:type="array">
                                                                <item name="copex-warranty-notice" xsi:type="array">
                                                                    <item name="config" xsi:type="array">
                                                                        <item name="componentDisabled" xsi:type="boolean">true</item>
                                                                    </item>
                                                                </item>
                                                                <item name="copex-warranty-garan-summary" xsi:type="array">
                                                                    <item name="config" xsi:type="array">
                                                                        <item name="componentDisabled" xsi:type="boolean">true</item>
                                                                    </item>
                                                                </item>
                                                            </item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </item>
            </item>
        </argument>
    </arguments>
</referenceBlock>