Skip to main content
19 votes
Accepted

Magento : How to Check if Mysql Column Exists?

You can use this to check if table column exists. $installer = $this; $installer->startSetup(); $connection = $installer->getConnection(); $tableName = $installer->getTable('...
Priyank's user avatar
  • 7,712
13 votes
Accepted

Magento 2: Add custom column to filter option in order grid?

For the performance, the Order Admin Grid will load the values from sales_order_grid. So, we need to add more columns to this table. app/code/Vendor/SalesOrder/Setup/UpgradeSchema.php <?php ...
Khoa TruongDinh's user avatar
11 votes
Accepted

Magento 2 Filter not working while Custom column added on Sales Grid Using Ui Component

I have the same issue and $this->addFilterToMap() fix my issue.. check this answer Magento 2 grid uiComponent: include a table alias in a column filter
Emipro Technologies Pvt. Ltd.'s user avatar
8 votes
Accepted

How to add Email address in sales orders admin grid?

First of all, you need to get the customer email by performing a join with sales_flat_order table. Your _prepareCollection() function will be: protected function _prepareCollection() { $...
Alex Constantinescu's user avatar
7 votes

Magento 2 - How to add a custom column in customer grid

Solution for Magento 2.1 Add the attribute to the customer grid index: etc/indexer.xml <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:...
Fabian Schmengler's user avatar
7 votes
Accepted

Magento 1.9 - How to add serial number in sales orders list & invoice list?

Please follow below step to add SR No into Sales order items list. Open app/design/adminhtml/default/default/template/sales/order/view/items.phtml file and replace with below code. <?php $...
Bhavin Pethani's user avatar
6 votes
Accepted

Make column unique in install schema script

You can use addIndex method having type \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE, like: $table = $installer->getConnection()->newTable( $installer->getTable(...
Siarhey Uchukhlebau's user avatar
6 votes
Accepted

Magento 2 bar disappeared in Sales Order Grid after adding column

The bar was under the table and not disappeared. Just adjust the order and you'll get this solved. I solved the problem in Magento 2.2.x adding <listingToolbar name="listing_top"/> on top of ...
Vixent's user avatar
  • 349
6 votes
Accepted

Remove column from Order grid based on condition

It Might be helpful to you. <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <...
Dharmendra Jadav's user avatar
5 votes

Disable filter for column in Magento 2 grid component

It is simple, just comment or remove "filter" node in column definition: <column name="prxgt_is_in_odoo"> <argument name="data" xsi:type="array"> <item name="...
Alex Gusev's user avatar
  • 2,039
5 votes

Magento 2 - How to add a custom column in customer grid

Finally got the solution : We need to create indexer.xml file in /etc/di folder. Main thing is view_id in view_id we need to pass "coloumn_name" which we need to show in grid. For example here i ...
Manthan Dave's user avatar
  • 9,896
5 votes
Accepted

Magento2 how to set default columns in admin grid

magento provide facility to add product attribute directly in grid without any customization. Please check carefully the selected checkbox are all table columns while unchecked are product attributes....
poojan sharma's user avatar
4 votes

Magento 2 adminhtml custom column sorting ascending and descending

<column name="order_state" class="Foobar\InvoiceOrderStatus\Ui\Component\Listing\Column\Status"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"&...
Prince Patel's user avatar
  • 22.9k
4 votes

Magento 2 : Change Admin grid column width

At the moment on Magento 2.3.2 the only working solution requires adding configuration in 2 peaces in List (Grid) UI component: Setup resizeConfig for columns config. Setup resizeDefaultWidth for ...
Oleksii Lisovyi's user avatar
4 votes

How to remove/hide columns from sales grid by default

You need to override sales_order_grid.xml as you said. Put this code into your module, file view/adminhtml/ui_component/sales_order_grid.xml <?xml version="1.0" encoding="UTF-8"?> <!-- /*...
Sasa Jovanovic's user avatar
3 votes

Is the column `Action` very important?

$this->addColumn('action', array(...)) adds the action column in the grid. Yes if you wish to remove you can. You can remove from css, commenting or by removing the whole code.It will not break ...
Priyank's user avatar
  • 7,712
3 votes
Accepted

Is the column `Action` very important?

Generally, the Action column is not important as long as it is doing the same as clicking on the row. Action tab is added when there are more operations to perform on a row, like in the CMS Pages grid ...
Piyush's user avatar
  • 5,904
3 votes
Accepted

Magento 2 Grid custom column value in Ui Listing

Remove argument component from app/code/Vendor/Theme/view/adminhtml/ui_component/your_ui_grid.xml <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/select</item> If ...
Prince Patel's user avatar
  • 22.9k
3 votes
Accepted

Magento2 remove columns from admin sales order view page items grid

You can Try this its work for me. Add sales_order_view.xml file in your custom module Packagename/Modulename/view/adminhtml/layout and remove column as per your requirement. <block class="Magento\...
poojan sharma's user avatar
3 votes
Accepted

Remove item column from Order PDF print

Im showing the files where it is (you can override it ) vendor/magento/module-sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php Remove this on draw() function: // draw Tax $lines[0][]...
Ylgen Guxholli's user avatar
3 votes
Accepted

How to update custom column value in quote_item table magento 2

I suggest you use implement extension attribute for this field at here. See how to use Extension attribute. https://devdocs.magento.com/guides/v2.3/extension-dev-guide/extension_attributes/adding-...
Amit Bera's user avatar
  • 77.6k
2 votes
Accepted

Are truncate, nl2br, and escape real UI Component Column Configurations

Looking closely at 2.1, I don't think these arguments are used for now, hopefully they will in future releases. The only way to acheive the truncate effect in a Ui listing I found so far is to act ...
F. Perrin's user avatar
  • 176
2 votes

How to add new column to existing module table?

Please use : $installer = $this; $installer->startSetup(); $installer->getConnection() ->addColumn($installer->getTable('sales/order'),'custom_value', array( 'type' => ...
Sneha Panchal's user avatar
2 votes
Accepted

How to add customized column in Admin i.e Sales?

You have to change in two different files You can set header from app/design/adminhtml/default/default/template/sales/order/view/items.phtml and add data from app/design/adminhtml/default/default/...
Vaibhav Ahalpara's user avatar
2 votes
Accepted

How to add searchable column "shipping methods" into Sales/Orders admin grid?

Please try the below code to show shipping method in sales grid. protected function _prepareCollection() { $collection = Mage::getResourceModel($this->_getCollectionClass()); $...
Ranipriyanka's user avatar
2 votes

How to add searchable column "shipping methods" into Sales/Orders admin grid?

Try with the below carrierList function. public function getCarrierList() { $shippingMethods = Mage::getSingleton('shipping/config')->getActiveCarriers(); $methods = array(); foreach(...
Ranipriyanka's user avatar
2 votes

How to add Email address in sales orders admin grid?

To avoid "ambiguous" filter_index' => 'main_table.grand_total is required. Problem solved.
Rob D. A.'s user avatar
  • 867
2 votes

Grid column not showing in admin grid on Magento 2

I was not careful and I forgot about the "column" option and my column was not selected. Maybe this will help someone.
Alin Lupoiu's user avatar
  • 2,672
2 votes
Accepted

How to set custom value to identity column of a table in Magento 2

When you provide primary_key While inserting a row, Magento assumes it as an Update operation and it fails because no such identity exist in Database. However if you still want to insert a row with ...
Rizwan Dhuka's user avatar
2 votes
Accepted

Magento2: Duplicate 2 tables in an overwritten method

As if you changed the name then magento identifies it as separate attribute or field thats why its not working. You need to use the below code: if ($this->isOrder()) { $this->addColumn( ...
Sukumar Gorai's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible