61 votes
Accepted

Magento 2 How to Add a New Column to Orders Grid

After lots of digging into Magento's core code, I found a solution to my question. Instead of adding a column to the grid via the database, I created a UI component sales_order_grid.xml under [...
André Ferraz's user avatar
42 votes

Magento 2 How to Add a New Column to Orders Grid

My solution may be a bit more efficient 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 (...
MageParts's user avatar
  • 521
30 votes
Accepted

Magento2.1 ui grid, remove or clear filter issue (after removing filter, result row apply to whole collection)

Just to add to the previous solution by Tony Bartiloro. The specific fix is to add the 'storageConfig' item. If this is missing you will see the issue where row data is duplicated. <item name="...
Chris's user avatar
  • 984
23 votes
Accepted

Magento 1.9.2.0: table "sales_flat_order_grid" contains extra space in customer's name value

In Magento 1.9.2 the middle name has been added to this column: Source: https://github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/core/Mage/Sales/Model/Resource/Order.php#L93-L99 $...
Fabian Schmengler's user avatar
18 votes

Add More Mass action in Order grid in magento2

You need to define router for adminhtml in order to get it work with your custom module. You can define the same at app\code{{your_package}}{{your_module}}\etc\adminhtml\routes.xml as like below: ...
Himmat Paliwal's user avatar
18 votes

Magento2.1 ui grid, remove or clear filter issue (after removing filter, result row apply to whole collection)

i had same issue and I resolve with this code in ui_component xml: <dataSource name="storelocator_store_listing_data_source"> <argument name="dataProvider" xsi:type="configurableObject"&...
Tony Bartiloro's user avatar
17 votes

Column 'store_id' in where clause is ambiguous when adding custom order attribute to grid and changing store

use below code just before the $this->setCollection($collection); $collection->addFilterToMap('store_id', 'main_table.store_id'); Second Solution edit your column code: if (!Mage::app()->...
Prashant Valanda's user avatar
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
12 votes

Add More Mass action in Order grid in magento2

Within your module you will want to create the following file: view/adminhtml/ui_component/sales_order_grid.xml With the following: <?xml version="1.0" encoding="UTF-8"?> <listing ...
Ash Smith's user avatar
  • 511
12 votes

Magento2.1 ui grid, remove or clear filter issue (after removing filter, result row apply to whole collection)

I've got the same issue on Magento 2.3 and resolved by using the following code in ui_component.xml. <dataSource component="Magento_Ui/js/grid/provider" name="listing_data_source&...
Aasim Goriya's user avatar
  • 5,304
12 votes
Accepted

Magento 2 Could not acquire lock for cron group: default

In our case the issue was caused by a hanging cron job. The solution was to kill the cron job then everything returned to normal. https://help.nexcess.net/magento/how-to-find-and-remove-hanging-...
nlaitchison's user avatar
11 votes
Accepted

Admin Grid - Remove columns from export

Got it, if set is_system true for a column, it will not be exported.So $this->addColumn('customer_name', array( 'header' => Mage::helper('sales')->__('Customer'), 'index' ...
Abdul Ghaffar'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
11 votes

Magento 2 + Custom column added sku on grid not showing data in export file

To add SKUs Column in order Ui grid. You need to modify below files. TO add column, add below code in your module [vendor]/[module]/view/adminhtml/ui_component/sales_order_grid.xml <?xml ...
Nirav Patel's user avatar
11 votes

Add Phone Number column in sales order grid

Please add the ui_component class for your column as per below. <?xml version="1.0" encoding="UTF-8"?> <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
Aasim Goriya's user avatar
  • 5,304
10 votes

(Zend_Db_Statement_Exception): SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'created_at' in where clause is ambiguous

You can achieve this task by below 2 option Option - 1 You need to change 'created_at' column in view/adminhtml/ui-component/sales_order_grid.xml Change column <column name="created_at" ...
Suresh Chikani's user avatar
10 votes
Accepted

Add Phone Number column in sales order grid

You added the column in ui_component correctly Just replace the _renderFiltersBefore function with my function in your module collection class Path should be Vendor/Yourmodule/Model/ResourceModel/...
Muhammad Hasham's user avatar
9 votes

Export a field from custom model grid with a diferent render to Csv

I got it. There is the renderExport method to do it. My render file: class Namespace_MyModule_Block_Adminhtml_Sales_Order_Renderer_Grid_MyModule extends ...
Denis Spalenza's user avatar
8 votes

Add Column to Admin > Sales > Orders Grid

Its a 2 step simple process. (for ex. i want to add Email Address and Order City in this order grid). Copy this core file to you local first in same directory. app/code/core/Mage/Adminhtml/Block/Sales/...
Abhilash's user avatar
7 votes

Magento 2 How to Add a New Column to Orders Grid

The answers here were very helpful, thank you! Here's an answer with some updated material (usage of db_schema.xml vs setup scripts, how to populate column data & clear UI bookmarks). 1. Create ...
Logan's user avatar
  • 446
6 votes
Accepted

Convert SQL Select to Magento getCollection statement

Something like this should do the trick: $table = Mage::getSingleton('core/resource')->getTableName('sales/order_status_history'); $collection = Mage::getResourceModel('sales/order_grid_collection'...
Peter O'Callaghan's user avatar
6 votes
Accepted

Magento 2: display yes/no in order grid instead 0/1 (Custom column value)

After some digging found the solution. What i need was just to make some changes in ui_comonent XML file: I changed this: <?xml version="1.0"?> <listing xmlns:xsi="http://www.w3.org/2001/...
Akhil Gupta's user avatar
  • 1,946
6 votes
Accepted

Magento 2, add color style in Status column in sale order

Create a module named Vendor_Module. Create all the files and structure like below: Step 1: /app/code/Vendor/Module/registration.php <?php \Magento\Framework\Component\ComponentRegistrar::...
Sukumar Gorai's user avatar
6 votes
Accepted

Magento 2 - Call custom phtml before order grid

Add new block in your custom module for your custom phtml File path should be like: app\code\Vendor\Module\Block\Adminhtml\Yourblockname.php <?php namespace Vendor\Module\Block\Adminhtml; class ...
Muhammad Hasham's user avatar
5 votes
Accepted

Hide completed orders from sales/orders

The observer way: <events> <sales_order_grid_collection_load_before> <observers> <vendor_module_salesgrid> <model>module/observer&...
Raphael at Digital Pianism's user avatar
5 votes
Accepted

Magento2 Add Quote ID in Sales Order Grid

Add sequence tag inside module.xml <sequence> <module name="Magento_Sales"/> </sequence> Create Vendor/Module/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3....
Sohel Rana's user avatar
  • 35.2k
5 votes
Accepted

Magento 2 sales order grid custom column export csv issue

join is happening twice in process of exporting, to avoid it, add checking in registry: use Magento\Framework\Message\ManagerInterface as MessageManager; use Magento\Framework\Registry; use Magento\...
Ilja's user avatar
  • 1,248
4 votes
Accepted

How to add/join sales_flat_order.customer_firstname column to transaction grid?

I'm noticing this. sales_flat_order.increment_id = sales_payment_transaction.order_id increment_id does not equate to order_id. Rather, it should like below. sales_flat_order.entity_id = ...
laketuna's user avatar
  • 6,820
4 votes
Accepted

How to format weight to display 2 decimal places in Orders Grid?

There are a couple of ways to do it. SQL-level $collection->getSelect() ->columns(array('weight' => new Zend_Db_Expr("DECIMAL(weight, 2)"))); Here we re-define the weight column in the ...
Rick Buczynski's user avatar
4 votes
Accepted

Get product image on success page

Try the below code it will works fine. <?php $order_id = Mage::getSingleton('checkout/session')->getLastRealOrderId(); $order_details = Mage::getModel('sales/order')->...
saravanavelu's user avatar
  • 3,941

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