2

I would like to update the following layout .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>
        <referenceBlock name="minicart">
            <arguments>
                <argument name="jsLayout" xsi:type="array">
                    <item name="components" xsi:type="array">
                        <item name="minicart_content" xsi:type="array">
                            <item name="config" xsi:type="array">
                                <item name="itemRenderer" xsi:type="array">
                                    <item name="default" xsi:type="string">defaultRenderer</item>
                                    <item name="simple" xsi:type="string">defaultRenderer</item>
                                    <item name="virtual" xsi:type="string">defaultRenderer</item>
                                </item>
                            </item>
                            <item name="children" xsi:type="array">
                                <item name="item.renderer" xsi:type="array">
                                    <item name="component" xsi:type="string">uiComponent</item>
                                    <item name="config" xsi:type="array">
                                        <item name="displayArea" xsi:type="string">defaultRenderer</item>
                                        <item name="template" xsi:type="string">Magento_Checkout/minicart/item/default</item>
                                    </item>
                                    <item name="children" xsi:type="array">
                                        <item name="item.image" xsi:type="array">
                                            <item name="component" xsi:type="string">Magento_Catalog/js/view/image</item>
                                            <item name="config" xsi:type="array">
                                                <item name="template" xsi:type="string">Magento_Catalog/product/image</item>
                                                <item name="displayArea" xsi:type="string">itemImage</item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

by adding

<item name="mytype" xsi:type="string">mytypeRenderer</item>

under 'itemRenderer'

I then define the xml file in my module :

<?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">
    <body>
        <referenceBlock name="minicart">
            <arguments>
                <argument>
                    <item name="mytype" xsi:type="string" after="virtual">mytypeRenderer</item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

but it is not working...

THank you for your help

EDIT 1 :

<?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">
    <update handle="checkout_cart_sidebar_item_renderers"/>
    <body>
        <referenceBlock name="minicart">
            <arguments>
                <argument name="jsLayout" xsi:type="array">
                    <item name="components" xsi:type="array">
                        <item name="minicart_content" xsi:type="array">
                            <item name="config" xsi:type="array">
                                <item name="itemRenderer" xsi:type="array">
                                    <item name="mytype" xsi:type="string">mytypeRenderer</item>
                                </item>
                            </item>
                            <item name="children" xsi:type="array">
                                <item name="item.renderer" xsi:type="array">
                                    <item name="component" xsi:type="string">uiComponent</item>
                                    <item name="config" xsi:type="array">
                                        <item name="displayArea" xsi:type="string">mytypeRenderer</item>
                                        <item name="template" xsi:type="string">Vendor_Module/checkout/minicart/item/default</item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>
0

Please try

<?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">
    <body>
      <referenceBlock name="minicart">
            <arguments>
                <argument name="jsLayout" xsi:type="array">
                    <item name="components" xsi:type="array">
                        <item name="minicart_content" xsi:type="array">
                            <item name="config" xsi:type="array">
                               <item name="itemRenderer" xsi:type="array">
                                    <item name="mytype" xsi:type="string">mytypeRenderer</item>
                               </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>
2
  • Thank you for your answer. It does not work... same result : none of the mytype items are displayed in minicart
    – Alexglvr
    Aug 22 '17 at 7:44
  • Maybe it is due to the associated template definition... Please see my EDIT1
    – Alexglvr
    Aug 22 '17 at 10:56

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.