rashi
rashi

Reputation: 137

Sales Order Grid issue in Magento 2.4.2: Column not found

On admin in Sales Order Grid, I am getting the following error. Please guide on this:

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

I have one extra column in grid i.e. Allocated Sources.

Upvotes: 1

Views: 2299

Answers (2)

rashi
rashi

Reputation: 137

I got the solution for the same. Just override the module sales order grid & add the following code. Upgrade your module & Flush the cache. It will work.

1 - Create a new module with Magento standards 2 - Override file with this content 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>

Your problem will be solved. Thanks, Rashi

Upvotes: 2

Please check the "allocated_sources" column in your database. I guess it hasn't been created yet or you are joining the wrong table.

Upvotes: 0

Related Questions