Ошибка ядра Magento 2 обнаружена во всех 2.1.x, 2.2


Шаги по воспроизведению

  1. Перейдите в раздел Отчеты - > По клиентам

  2. Введите имя клиента в поле поиска

  3. Нажмите на поиск

Он покажет

Неустранимая ошибка: Столбец не найден: 1054 Неизвестный столбец "имя_пользователя" в предложении "где", запрос был: ВЫБЕРИТЕ КОЛИЧЕСТВО (ОТДЕЛЬНАЯ деталь.идентификатор пользователя) ИЗ обзора КАК main_table

Я нашел эту ошибку во всех Magento 2.1.x. И опубликованный выпуск на github

Https://github.com/magento/magento2/issues/10301

У кого-нибудь есть идеи по этому поводу?

РЕДАКТИРОВАТЬ:

Эта проблема все еще сохраняется в Magento 2.1.8, 2.2 и 2.2 EE

Author: Prince Patel, 2017-07-21

1 answers

Вот решение...

Создать новый модуль

Vendor/Module/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>

Vendor/Module/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>

Vendor/Module/Block/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;
    }
}

Vendor/Module/Model/ResourceModel/Review/Customer/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);
    }
}
 6
Author: Nicholas Miller, 2017-07-23 18:40:59