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 [...
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 (...
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="...
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
$...
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:
...
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"&...
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()->...
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
...
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 ...
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&...
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-...
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' ...
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
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 ...
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:...
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" ...
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/...
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 ...
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/...
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 ...
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'...
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/...
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::...
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 ...
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&...
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....
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\...
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 = ...
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 ...
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')->...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
order-grid × 342magento-1.9 × 104
magento2 × 101
sales-order × 85
grid × 51
orders × 40
adminhtml × 35
filter × 17
collection × 16
admin × 15
magento-1.8 × 14
database × 13
magento-2.1 × 12
magento2.3 × 12
export × 12
massaction × 12
sales-order-grid × 12
uicomponent × 11
order-status × 11
magento-1.7 × 10
magento2.2 × 10
admin-panel × 9
sales × 9
magento-1 × 8
csv × 8