I am trying to rewrite the protected function _prepareCollection method inside \Magento\Wishlist\Block\Customer\Wishlist however the wishlist page in my account now returns blank and it never makes it into the rewritten method.
Here is my di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<preference for="Magento\Wishlist\Block\Customer\Wishlist" type="Namespace\Module\Block\Customer\Favorites" />
</config>
And here is my php file located at Namespace/Module/Block/Customer/Favorites
<?php
namespace Namespace\Module\Block\Customer;
class Favorites extends \Magento\Wishlist\Block\Customer\Wishlist
{
protected function _prepareCollection($collection)
{
parent::_prepareCollection($collection);
die('working');
}
}
Am i missing something here ? I know that I can't use a plugin because they don't work with protected methods. Is that now the same with class rewrites as well ? Help!