Open /app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php
Create the file structure of :
/app/code/local/Mage/Adminhtml/Block/Sales/Order/Grid.php
Copy the contents of the Core file, and paste into the Local version.
Find the protected function _prepareCollection. You are going to modify this function by adding one line to make the custom attribute available for inserting into the grid.
Just add this line :$collection->getSelect()->join('sales_flat_order', 'main_table.entity_id = sales_flat_order.entity_id',array('shipping_description'));
after this line:
$collection = Mage::getResourceModel($this->_getCollectionClass());
So altogether you should have a function that looks like this: protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->join('sales_flat_order', 'main_table.entity_id = sales_flat_order.entity_id',array('shipping_description'));
$this->setCollection($collection);
return parent::_prepareCollection();
}
So now that you’ve modified that function we need to add the new column to the grid using the addColumn method. So now find the _prepareColumns() function.
Now just add this code : $this->addColumn('shipping_method', array(
'header' => Mage::helper('sales')->__('Shipping Method'),
'index' => 'shipping_description',
));
In order to prevent a massive “SQLSTATE[23000]: Integrity constraint violation: 1052 Column ‘status’ in where clause is ambiguous” ERROR when sorting your orders…Make sure you add this:'filter_index'=>'main_table.status',
to the addColumn Status array
Now save and upload your new Local Grid.php file, login to Magento Admin, Browse to Sales > Orders and you will see your BRAND NEW SHINY column!
Cheers!
相关推荐
安装Mysql-python时报错Adding Python Information to the Windows Registry 需要使用register.py cmd python register.py
- FIX: The TFlexPanel.FindControlAtPoint method maked virtual to realize RealTime-capability when on mouse cursor moving the flex-object search not occurs. - FIX: After deleting the selected points ...
标题“Taking the pain out of adding a horizontal scrollbar to a listbox”指向的就是这样一个问题:如何优雅地为列表框添加水平滚动条,以提升用户体验。这里我们将详细探讨这个主题,并提供一些实践技巧。 ...
标题中的"A class for adding icons to the system tray"指的是在计算机操作系统中,特别是在Windows环境下,创建一个能够将图标显示在任务栏系统托盘区域的程序或类。系统托盘区域是位于任务栏右下角的区域,通常...
This book is designed to teach you how to use AdonisJs....It is my hope that by the time you are finished reading this book, you’ll know all you need to know in order to build your online business.
Obstacles are considered by eliminating the collision points from the tessellated space and by adding a penalty function to the motion time in the local optimization. The computational efficiency of ...
America’s wireless industry is ready to invest $275 billion to deploy next-generation 5G networks — creating 3 million new jobs and adding $500 billion to our economy, according to Accenture.
在IT领域,尤其是在软件开发中,"Adding filters to the Open File dialog"是一个常见的需求,它涉及到用户界面(UI)的设计和用户体验(UX)优化。Open File dialog是大多数应用程序中的一个基本组件,允许用户选择...
在Ubuntu VPS上安装Docker时,可能会遇到一个常见的错误:“Cannot connect to the Docker daemon at unix:///var/run/docker.sock.” 这个问题通常是由于Docker守护进程未运行或者是由于Linux内核版本过低导致的。...
- **Scalability:** The ability of a system or network to handle a growing amount of work by adding resources to the system. - **Availability:** The measure of a system's ability to operate ...
Adding Password Management to Your Templates(cloudstack)
The extension encapsulates most of the ideas in the logic programming language Prolog.The pedagogical method of The Reasoned Schemer is a series of questions and answers, which proceed with the ...
标题 "A tutorial on adding columns to Explorer’s details view via" 是一篇关于如何通过列处理程序外壳扩展在Windows资源管理器(Explorer)的详细视图中添加自定义列的教程。这通常涉及到增强Windows操作系统中...
信息安全_数据安全_Adding Social Intelligence to Smart Devices 应急响应 内外威胁 工控安全 web安全 数据脱敏
- Event OnGetNextStream - Allows you to zip from multiple streams when using the ZipFromStream method. This improves performance since repeated calls to ZipFromStream causes the archive to be updated ...
adding the key to the cache, enter "n". If you do not trust this host, press Return to abandon the connection. Store key in cache? (y/n) 重编译改 Store key 默认为y 不用再 echo y | plink.exe 这样的方式