Smile-SA / magento2-module-custom-entity-product-link

31 stars 12 forks source link

Products list addto name block #28

Closed Amadeco closed 2 years ago

Amadeco commented 3 years ago

I was trying to add wishlist button to the current list without success.

For now (in theme, Magento_Wishlist directory) : Note catalogsearch.product.addto

<?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" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml">
                <arguments>
                    <argument name="triggers" xsi:type="array">
                        <item name="addToWishlistLink" xsi:type="string">.action.towishlist</item>
                    </argument>
                </arguments>
            </block>
            <referenceBlock name="catalogsearch.product.addto">
                <block class="Magento\Wishlist\Block\Catalog\Product\ProductList\Item\AddTo\Wishlist"
                       name="category.product.addto.wishlist" as="wishlist" before="compare"
                       template="Magento_Wishlist::catalog/product/list/addto/wishlist.phtml"/>
            </referenceBlock>
            <referenceContainer name="category.product.list.additional">
                <block class="Magento\Wishlist\Block\AddToWishlist"
                    name="category.product.list.additional.wishlist_addto"
                    template="Magento_Wishlist::addto.phtml"/>
            </referenceContainer>
        </referenceContainer>
    </body>
</page>