0

I have replaced the vendor/magento/module-wishlist/Block/Customer/Wishlist.php for my own app/code/myVendor/myModule/Block/Customer/Wishlist.php

I have written in the app/code/myVendor/myModule/etc/di.xml:

<preference for="Magento\Wishlist\Block\Customer\Wishlist"
                type="myVendor\myModule\Block\Customer\Wishlist"/>

The only modification of the new block is:

<?php
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace myVendor\myModule\Block\Customer;

class Wishlist extends \Magento\Wishlist\Block\Customer\Wishlist
{
    /**
     * Preparing global layout
     * @return void
     */
    protected function _prepareLayout()
    {
        parent::_prepareLayout();
        $this->pageConfig->getTitle()->set(__('My Backorders'));
    }
}

Also, I have modified the layout xml in order to remove some elements. The new file is in app/design/frontend/myThemeVendor/MyThemeModule/Magento_Wishlist/layout/wishlist_index_index.xml

<?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">
    <update handle="customer_account"/>
    <body>
        <referenceContainer name="content">
            <referenceBlock class="Magento\Wishlist\Block\Customer\Wishlist" name="customer.wishlist" template="view.phtml" cacheable="false">
                <referenceContainer name="customer.wishlist.buttons" as="control_buttons" label="Wishlist Control Buttons">
                    <referenceBlock class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.share" template="button/share.phtml" cacheable="false" remove="true"/>
                </referenceContainer>
            </referenceBlock>
        </referenceContainer>

        <referenceBlock name="customer.wishlist.button.toCart" remove="true"/>
    </body>
</page>

The result is this:

enter image description here

It does effectively change the literal even though it doesn't show any product. If I disable the override through the di.xml and leave it back as before:

enter image description here

You can see how it now works pefectly. For me, it makes no sense, hopefully someone can see something.

Your Answer

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

Browse other questions tagged or ask your own question.