cancel
Showing results for 
Search instead for 
Did you mean: 

magento 2 Element with ID 'customer_review_list.toolbar' already exists when i override block

magento 2 Element with ID 'customer_review_list.toolbar' already exists when i override block

when i override block "Magento\Review\Block\Customer\ListCustomer" i showing following error "Element with ID 'customer_review_list.toolbar' already exists."

my code is for di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Review\Block\Customer\ListCustomer" type="Company\Review\Block\Customer\ListCustomer" /> 
</config>

 Block file

<?php
namespace Company\Review\Block\Customer;
class ListCustomer extends \Magento\Review\Block\Customer\ListCustomer {
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Customer\Model\Session $customerSession,
\Magento\Newsletter\Model\SubscriberFactory $subscriberFactory,
\Magento\Customer\Api\CustomerRepositoryInterface $customerRepository,
\Magento\Customer\Api\AccountManagementInterface $customerAccountManagement,
\Magento\Review\Model\ResourceModel\Review\Product\CollectionFactory $collectionFactory,
\Magento\Customer\Helper\Session\CurrentCustomer $currentCustomer,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Catalog\Model\Product $product,
\Magento\Framework\Stdlib\DateTime\DateTime $date,
array $data = array())
{
$this->_storeManager = $storeManager;
$this->_product = $product;
parent::__construct($context, $customerSession, $subscriberFactory, $customerRepository, $customerAccountManagement, $collectionFactory, $currentCustomer, $data);
}
/**
*
* @return type
*/
public function getMediaBaseUrl()
{
return $this->_storeManager->getStore()->getBaseUrl().'pub/media/catalog/product/';
}
/**
*
* @param type $id
* @return type
*/
public function getProductImage($id){
$product = $this->_product->load($id);
return $product->getImage();
}