这是解决方案...
创建新模块
供应商/模块/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendor_Module" setup_version="2.1.0">
<sequence>
<module name="Magento_Review"/>
</sequence>
</module>
</config>
供应商/模块/etc/adminhtml/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\Reports\Block\Adminhtml\Review\Customer" type="Vendor\Module\Block\Adminhtml\Review\Customer" />
<preference for="Magento\Reports\Model\ResourceModel\Review\Customer\Collection" type="Vendor\Module\Model\ResourceModel\Review\Customer\Collection" />
</config>
供应商/模块/块/Adminhtml/Review/Customer.php
<?php
namespace Vendor\Module\Block\Adminhtml\Review;
class Customer extends \Magento\Reports\Block\Adminhtml\Review\Customer
{
protected function _prepareLayout()
{
parent::_prepareLayout();
$customerNameColumn = $this->getChildBlock('grid')
->getChildBlock('grid.columnSet')
->getChildBlock('customer_name');
$customerNameColumn->setFilterIndex([
'customer.firstname',
'customer.lastname'
]);
return $this;
}
}
供应商/模块/模型/资源模型/审查/客户/Collection.php
<?php
namespace Vendor\Module\Model\ResourceModel\Review\Customer;
class Collection extends \Magento\Reports\Model\ResourceModel\Review\Customer\Collection
{
public function addFieldToFilter($field, $condition = null)
{
if (is_array($field) && array_key_exists('like', $condition)) {
$condition = array_fill(0, count($field), $condition);
}
return parent::addFieldToFilter($field, $condition);
}
}
firstname
替代方法来代替customer_name
。由于customer_name
与任何表都不匹配