Magento 2.4.2 中的销售订单网格问题:找不到列

Sales Order Grid issue in Magento 2.4.2: Column not found

在销售订单网格的管理中,我收到以下错误。请指导:

Column not found: 1054 Unknown column 'allocated_sources' in 'order clause', query was: SELECT `main_table`.*, group_concat(sales_order_item.sku SEPARATOR ", ") AS `skus`, group_concat(sales_order_item.name SEPARATOR ",") AS `names`, `braintree_transaction_details`.`transaction_source` FROM `sales_order_grid` AS `main_table`
 LEFT JOIN `sales_order_item` ON sales_order_item.order_id = main_table.entity_id
 LEFT JOIN `braintree_transaction_details` ON braintree_transaction_details.order_id = main_table.entity_id GROUP BY `main_table`.`entity_id` ORDER BY allocated_sources ASC

我在网格中多了一列,即分配的资源。

请检查您数据库中的“allocated_sources”列。我猜它还没有创建或者你加入错误 table.

我得到了相同的解决方案。 只需覆盖模块销售订单网格并添加以下代码。升级您的模块并刷新缓存。它会起作用。

1 - 创建一个符合 Magento 标准的新模块 2 - 使用此内容覆盖文件 view/adminhtml/ui_component/sales_order_grid.xml

<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <columns name="sales_order_columns">
        <column name="allocated_sources"
                class="Magento\InventoryShippingAdminUi\Ui\Component\Listing\Column\AllocatedSources"
                component="Magento_InventoryShippingAdminUi/js/order/grid/cell/allocated-sources">
            <settings>
                <filter>false</filter>
                <label translate="true">Allocated sources</label>
                <sortable>false</sortable>
            </settings>
        </column>
    </columns>
</listing>

您的问题将得到解决。 谢谢, 拉希