Magento 2. Sales -> Invoices - add column to grid












1














How may i add column to Sales -> Invoices grid?










share|improve this question
















bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    1














    How may i add column to Sales -> Invoices grid?










    share|improve this question
















    bumped to the homepage by Community yesterday


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      1












      1








      1







      How may i add column to Sales -> Invoices grid?










      share|improve this question















      How may i add column to Sales -> Invoices grid?







      magento2 grid invoice sales column






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 29 '16 at 15:30









      Raphael at Digital Pianism

      53.4k19111269




      53.4k19111269










      asked Feb 29 '16 at 15:27









      Roma KisRoma Kis

      216




      216





      bumped to the homepage by Community yesterday


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community yesterday


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          This solution may be a bit more efficient and 100% tested working since it follows the native way of adding a column to the grid, and you won't have to load every order displayed on the page to obtain the column data (utilising the sales_invoice_grid table instead). The above is a great example of how to create a customised renderer though.



          app/code/[vendor]/[package]/view/adminhtml/ui_component/sales_order_invoice_grid.xml



          <!-- Add the column "custom_column" (Custom Column) to the sales invoice grid. -->
          <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_invoice_columns">
          <column name="custom_column">
          <argument name="data" xsi:type="array">
          <item name="config" xsi:type="array">
          <item name="filter" xsi:type="string">text</item>
          <item name="label" xsi:type="string" translate="true">Custom Column</item>
          </item>
          </argument>
          </column>
          </columns>




          Please note that you must enable the column using the drop-down widget above the invoice grid before it appears.



          app/code/[vendor]/[package]/etc/di.xml



          <!-- Sync the column "custom_column" between the sales_invoice and sales_invoice_grid tables -->
          <virtualType name="MagentoSalesModelResourceModelOrderInvoiceGrid">
          <arguments>
          <argument name="columns">
          <item name="custom_column" xsi:type="string">sales_invoice.custom_column</item>
          </argument>
          </arguments>
          </virtualType>


          Sample setup code to add column to sales_invoice_grid table (use this in your install/upgrade script). The same code works for the sales_invoice table by the way.



          $setup->getConnection()->addColumn(
          $setup->getTable('sales_invoice_grid'),
          'custom_column',
          [
          'type' => MagentoFrameworkDBDdlTable::TYPE_TEXT,
          'length' => 255,
          'nullable' => true,
          'comment' => 'Custom Column'
          ]
          );


          For details information. Please check Add column in Sales Invoice/Order grid in Magento 2



          Hope it helps you! :-)






          share|improve this answer























          • how where you able to get this filtered?
            – xhallix
            Apr 30 '17 at 17:44











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "479"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f103959%2fmagento-2-sales-invoices-add-column-to-grid%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          This solution may be a bit more efficient and 100% tested working since it follows the native way of adding a column to the grid, and you won't have to load every order displayed on the page to obtain the column data (utilising the sales_invoice_grid table instead). The above is a great example of how to create a customised renderer though.



          app/code/[vendor]/[package]/view/adminhtml/ui_component/sales_order_invoice_grid.xml



          <!-- Add the column "custom_column" (Custom Column) to the sales invoice grid. -->
          <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_invoice_columns">
          <column name="custom_column">
          <argument name="data" xsi:type="array">
          <item name="config" xsi:type="array">
          <item name="filter" xsi:type="string">text</item>
          <item name="label" xsi:type="string" translate="true">Custom Column</item>
          </item>
          </argument>
          </column>
          </columns>




          Please note that you must enable the column using the drop-down widget above the invoice grid before it appears.



          app/code/[vendor]/[package]/etc/di.xml



          <!-- Sync the column "custom_column" between the sales_invoice and sales_invoice_grid tables -->
          <virtualType name="MagentoSalesModelResourceModelOrderInvoiceGrid">
          <arguments>
          <argument name="columns">
          <item name="custom_column" xsi:type="string">sales_invoice.custom_column</item>
          </argument>
          </arguments>
          </virtualType>


          Sample setup code to add column to sales_invoice_grid table (use this in your install/upgrade script). The same code works for the sales_invoice table by the way.



          $setup->getConnection()->addColumn(
          $setup->getTable('sales_invoice_grid'),
          'custom_column',
          [
          'type' => MagentoFrameworkDBDdlTable::TYPE_TEXT,
          'length' => 255,
          'nullable' => true,
          'comment' => 'Custom Column'
          ]
          );


          For details information. Please check Add column in Sales Invoice/Order grid in Magento 2



          Hope it helps you! :-)






          share|improve this answer























          • how where you able to get this filtered?
            – xhallix
            Apr 30 '17 at 17:44
















          0














          This solution may be a bit more efficient and 100% tested working since it follows the native way of adding a column to the grid, and you won't have to load every order displayed on the page to obtain the column data (utilising the sales_invoice_grid table instead). The above is a great example of how to create a customised renderer though.



          app/code/[vendor]/[package]/view/adminhtml/ui_component/sales_order_invoice_grid.xml



          <!-- Add the column "custom_column" (Custom Column) to the sales invoice grid. -->
          <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_invoice_columns">
          <column name="custom_column">
          <argument name="data" xsi:type="array">
          <item name="config" xsi:type="array">
          <item name="filter" xsi:type="string">text</item>
          <item name="label" xsi:type="string" translate="true">Custom Column</item>
          </item>
          </argument>
          </column>
          </columns>




          Please note that you must enable the column using the drop-down widget above the invoice grid before it appears.



          app/code/[vendor]/[package]/etc/di.xml



          <!-- Sync the column "custom_column" between the sales_invoice and sales_invoice_grid tables -->
          <virtualType name="MagentoSalesModelResourceModelOrderInvoiceGrid">
          <arguments>
          <argument name="columns">
          <item name="custom_column" xsi:type="string">sales_invoice.custom_column</item>
          </argument>
          </arguments>
          </virtualType>


          Sample setup code to add column to sales_invoice_grid table (use this in your install/upgrade script). The same code works for the sales_invoice table by the way.



          $setup->getConnection()->addColumn(
          $setup->getTable('sales_invoice_grid'),
          'custom_column',
          [
          'type' => MagentoFrameworkDBDdlTable::TYPE_TEXT,
          'length' => 255,
          'nullable' => true,
          'comment' => 'Custom Column'
          ]
          );


          For details information. Please check Add column in Sales Invoice/Order grid in Magento 2



          Hope it helps you! :-)






          share|improve this answer























          • how where you able to get this filtered?
            – xhallix
            Apr 30 '17 at 17:44














          0












          0








          0






          This solution may be a bit more efficient and 100% tested working since it follows the native way of adding a column to the grid, and you won't have to load every order displayed on the page to obtain the column data (utilising the sales_invoice_grid table instead). The above is a great example of how to create a customised renderer though.



          app/code/[vendor]/[package]/view/adminhtml/ui_component/sales_order_invoice_grid.xml



          <!-- Add the column "custom_column" (Custom Column) to the sales invoice grid. -->
          <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_invoice_columns">
          <column name="custom_column">
          <argument name="data" xsi:type="array">
          <item name="config" xsi:type="array">
          <item name="filter" xsi:type="string">text</item>
          <item name="label" xsi:type="string" translate="true">Custom Column</item>
          </item>
          </argument>
          </column>
          </columns>




          Please note that you must enable the column using the drop-down widget above the invoice grid before it appears.



          app/code/[vendor]/[package]/etc/di.xml



          <!-- Sync the column "custom_column" between the sales_invoice and sales_invoice_grid tables -->
          <virtualType name="MagentoSalesModelResourceModelOrderInvoiceGrid">
          <arguments>
          <argument name="columns">
          <item name="custom_column" xsi:type="string">sales_invoice.custom_column</item>
          </argument>
          </arguments>
          </virtualType>


          Sample setup code to add column to sales_invoice_grid table (use this in your install/upgrade script). The same code works for the sales_invoice table by the way.



          $setup->getConnection()->addColumn(
          $setup->getTable('sales_invoice_grid'),
          'custom_column',
          [
          'type' => MagentoFrameworkDBDdlTable::TYPE_TEXT,
          'length' => 255,
          'nullable' => true,
          'comment' => 'Custom Column'
          ]
          );


          For details information. Please check Add column in Sales Invoice/Order grid in Magento 2



          Hope it helps you! :-)






          share|improve this answer














          This solution may be a bit more efficient and 100% tested working since it follows the native way of adding a column to the grid, and you won't have to load every order displayed on the page to obtain the column data (utilising the sales_invoice_grid table instead). The above is a great example of how to create a customised renderer though.



          app/code/[vendor]/[package]/view/adminhtml/ui_component/sales_order_invoice_grid.xml



          <!-- Add the column "custom_column" (Custom Column) to the sales invoice grid. -->
          <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_invoice_columns">
          <column name="custom_column">
          <argument name="data" xsi:type="array">
          <item name="config" xsi:type="array">
          <item name="filter" xsi:type="string">text</item>
          <item name="label" xsi:type="string" translate="true">Custom Column</item>
          </item>
          </argument>
          </column>
          </columns>




          Please note that you must enable the column using the drop-down widget above the invoice grid before it appears.



          app/code/[vendor]/[package]/etc/di.xml



          <!-- Sync the column "custom_column" between the sales_invoice and sales_invoice_grid tables -->
          <virtualType name="MagentoSalesModelResourceModelOrderInvoiceGrid">
          <arguments>
          <argument name="columns">
          <item name="custom_column" xsi:type="string">sales_invoice.custom_column</item>
          </argument>
          </arguments>
          </virtualType>


          Sample setup code to add column to sales_invoice_grid table (use this in your install/upgrade script). The same code works for the sales_invoice table by the way.



          $setup->getConnection()->addColumn(
          $setup->getTable('sales_invoice_grid'),
          'custom_column',
          [
          'type' => MagentoFrameworkDBDdlTable::TYPE_TEXT,
          'length' => 255,
          'nullable' => true,
          'comment' => 'Custom Column'
          ]
          );


          For details information. Please check Add column in Sales Invoice/Order grid in Magento 2



          Hope it helps you! :-)







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 26 '17 at 7:07

























          answered Feb 25 '17 at 8:53









          Rohit KundaleRohit Kundale

          2,85511327




          2,85511327












          • how where you able to get this filtered?
            – xhallix
            Apr 30 '17 at 17:44


















          • how where you able to get this filtered?
            – xhallix
            Apr 30 '17 at 17:44
















          how where you able to get this filtered?
          – xhallix
          Apr 30 '17 at 17:44




          how where you able to get this filtered?
          – xhallix
          Apr 30 '17 at 17:44


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f103959%2fmagento-2-sales-invoices-add-column-to-grid%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          An IMO inspired problem

          Management

          Has there ever been an instance of an active nuclear power plant within or near a war zone?