2

Order Tab is showing Blank when i click on the following path in admin panel:

Customers->Edit(Particular Customer)->Click on Order Tab of Customer

Information Section. This is the screenshot Blank Order Tab

Please help me for solve this issue in Magento-2.2.7

1

Try this:

EDIT:

Add in or add an InstallSchema.php from this path of your custom module:

Vendor/Module/Setup/InstallSchema.php

<?php

namespace vendor\module\Setup;

use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;

class InstallSchema implements InstallSchemaInterface
{

/**
 * {@inheritdoc}
 * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
 */
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
    $installer = $setup;

    $installer->startSetup();

    /* While module install, creates column in sales_order_grid table */

    $eavTable = $installer->getTable('sales_order_grid');

    $columns = [
        'quote_id' => [
            'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
            'nullable' => true,
            'comment' => 'Quote Id',
        ],
    ];

    $connection = $installer->getConnection();
    foreach ($columns as $name => $definition) {
        $connection->addColumn($eavTable, $name, $definition);
       }

    $installer->endSetup();
}
}

Add this line in your di.xml

<virtualType name="Magento\Sales\Model\ResourceModel\Order\Grid" type="Magento\Sales\Model\ResourceModel\Grid">
    <arguments>
        <argument name="columns" xsi:type="array">
            <item name="quote_id" xsi:type="string">sales_order.quote_id</item>
        </argument>
    </arguments>
</virtualType>  

Then create a sales_order_grid.xml from this path of your custom_module:

Vendor/Module/view/adminhtml/ui_component

<?xml version="1.0" encoding="UTF-8"?>
<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="quote_id">
            <argument name="data" xsi:type="array">
            <item name="js_config" xsi:type="array">
                <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/column</item>
            </item>
            <item name="config" xsi:type="array">
                <item name="visible" xsi:type="boolean">true</item>
                <item name="dataType" xsi:type="string">text</item>
                <item name="align" xsi:type="string">left</item>
                <item name="label" xsi:type="string" translate="true">Quote Id</item>
            </item>
        </argument>
        </column>
    </columns>
</listing>  

Note: Don't forget to run setup:upgrade then setup:static-content:deploy after.

  • it showing blank quote_id in order_grid. Please see this paste.pics/4SW6I @magefms – Lovely Setia Feb 19 at 13:27
  • try to create a new order and check again , this does not apply to current orders during installation – fmsthird Feb 20 at 2:53
  • quote id will only be generated once order is placed. check again with the new order – fmsthird Feb 20 at 3:16
  • I have updated the answer, please check again. – fmsthird Feb 20 at 5:26
  • I will run both commands,but this column is not created in sales_order_grid .And it show error when order is placed. @magefms – Lovely Setia Feb 21 at 5:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.