Adding order attribute to the orders grid in Magento 1.4.1

I think everyone has noticed that since 1.4.1 Magento uses separate table for displaying of the order grid in the backend.
I have created a small example with trivial client request, that displays the main aspects of such a customization.
Your client asked you to add customer phone number to the orders grid. It requires a column adding to sales_flat_order_grid table and filling it with telephone value from sales_flat_order_address table. You need to create a custom module to implement the feature. The module should consist of setup script that uses sales setup model, observer that observes grid population and adds the custom column to it, and, of course, the layout file that adds the column to the grid.
The module name will be EcomDev_PhoneForOrderGrid and it will be placed in local code pool, so you need to create the directory app/code/local/EcomDev/PhoneForOrderGrid.
Then you need to create the setup script to define custom column in the grid table:
app/code/local/EcomDev/PhoneForOrderGrid/sql/ecomdev_phoneforordergrid_setup/mysql4-install-0.1.0.php
<?php
/**
* Setup scripts, add new column and fulfills
* its values to existing rows
*
*/
/* @var $this Mage_Sales_Model_Mysql4_Setup */
$this->startSetup();
// Add column to grid table
$this->getConnection()->addColumn(
$this->getTable('sales/order_grid'),
'customer_telephone',
"varchar(255) not null default ''"
);
// Add key to table for this field,
// it will improve the speed of searching & sorting by the field
$this->getConnection()->addKey(
$this->getTable('sales/order_grid'),
'customer_telephone',
'customer_telephone'
);
// Now you need to fullfill existing rows with data from address table
$select = $this->getConnection()->select();
$select->join(
array('address'=>$this->getTable('sales/order_address')),
$this->getConnection()->quoteInto(
'address.parent_id = order_grid.entity_id AND address.address_type = ?',
Mage_Sales_Model_Quote_Address::TYPE_BILLING
),
array('customer_telephone' => 'telephone')
);
$this->getConnection()->query(
$select->crossUpdateFromSelect(
array('order_grid' => $this->getTable('sales/order_grid'))
)
);
$this->endSetup();
The next step is the creation of the observer that handles grid columns generation event and adds your custom column. The event name is “sales_order_resource_init_virtual_grid_columns”.
app/code/local/EcomDev/PhoneForOrderGrid/Model/Observer.php
<?php
/**
* Event observer model
*
*
*/
class EcomDev_PhoneForOrderGrid_Model_Observer
{
/**
* Adds virtual grid column to order grid records generation
*
* @param Varien_Event_Observer $observer
* @return void
*/
public function addColumnToResource(Varien_Event_Observer $observer)
{
/* @var $resource Mage_Sales_Model_Mysql4_Order */
$resource = $observer->getEvent()->getResource();
$resource->addVirtualGridColumn(
'customer_telephone',
'sales/order_address',
array('billing_address_id' => 'entity_id'),
'telephone'
);
}
}
Now you need to display you column in orders grid widget, so you need to create the layout update:
app/design/adminhtml/default/default/layout/ecomdev/phoneforordergrid.xml
<?xml version="1.0"?>
<layout>
<!-- main layout definition that adds the column -->
<add_order_grid_column_handle>
<reference name="sales_order.grid">
<action method="addColumnAfter">
<columnId>customer_telephone</columnId>
<arguments module="customer" translate="header">
<header>Telephone</header>
<index>customer_telephone</index>
<type>text</type>
</arguments>
<after>shipping_name</after>
</action>
</reference>
</add_order_grid_column_handle>
<!-- order grid action -->
<adminhtml_sales_order_grid>
<!-- apply the layout handle defined above -->
<update handle="add_order_grid_column_handle" />
</adminhtml_sales_order_grid>
<!-- order grid view action -->
<adminhtml_sales_order_index>
<!-- apply the layout handle defined above -->
<update handle="add_order_grid_column_handle" />
</adminhtml_sales_order_index>
</layout>
After you have created the logic of the customization you need to configure the module and enable it by the adding configuration and bootstrap files:
app/code/local/EcomDev/PhoneForOrderGrid/etc/config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<EcomDev_PhoneForOrderGrid>
<version>0.1.0</version> <!-- define version for sql upgrade -->
</EcomDev_PhoneForOrderGrid>
</modules>
<global>
<models>
<ecomdev_phoneforordergrid>
<class>EcomDev_PhoneForOrderGrid_Model</class>
</ecomdev_phoneforordergrid>
</models>
<events>
<!-- Add observer configuration -->
<sales_order_resource_init_virtual_grid_columns>
<observers>
<ecomdev_phoneforordergrid>
<model>ecomdev_phoneforordergrid/observer</model>
<method>addColumnToResource</method>
</ecomdev_phoneforordergrid>
</observers>
</sales_order_resource_init_virtual_grid_columns>
</events>
<resources>
<!-- initialize sql upgrade setup -->
<ecomdev_phoneforordergrid_setup>
<setup>
<module>EcomDev_PhoneForOrderGrid</module>
<class>Mage_Sales_Model_Mysql4_Setup</class>
</setup>
</ecomdev_phoneforordergrid_setup>
</resources>
</global>
<adminhtml>
<layout>
<!-- layout upgrade configuration -->
<updates>
<ecomdev_phoneforordergrid>
<file>ecomdev/phoneforordergrid.xml</file>
</ecomdev_phoneforordergrid>
</updates>
</layout>
</adminhtml>
</config>
app/etc/modules/EcomDev_PhoneForOrderGrid.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
Module bootstrap file
-->
<config>
<modules>
<EcomDev_PhoneForOrderGrid>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Sales />
</depends>
</EcomDev_PhoneForOrderGrid>
</modules>
</config>
Now your client is satisfied!
And even more:
If you need to add an existing column from sales_flat_order table (subtotal for example), then it is much more easier, because resource model detects the same name of columns in grid and main table and fulfill it automatically, so you shouldn’t create the observer to add it. Just add a new column, fulfill old values and create a layout action for the column adding to grid.
Categories
Recent posts
- CheckItOut! 1.3.0 will make your customer much more happier!
- Test Driven Magento Development Seminar Video and Code
- Register for Free Magento Development Seminar!
- Checkout the new office of superior Magento development
- EcomDev breaks Magento speed record!
Recent comments
- Praful Rajput on Adding order attribute to the orders grid in Magento 1.4.1
- Omar on Adding order attribute to the orders grid in Magento 1.4.1
- Paulo on Estimate shipping rates on the product page
- jenish on Custom configuration fields in Magento
- Homero on Adding order attribute to the orders grid in Magento 1.4.1

103 comments
Hi, thanks for this great tutorial. Works 100%. Can you explain how you would include the shipping from the order into the grid rather than the telephone number. I can sort of see how it is done but could do with a bit of guidance of the query to use in the mysql4 file.
Thanks, Alistair
Written by Alistair
28 July 2010 on 12:42 amHi Alistair,
If you want to add more fields from shipping address, you need to add just more columns to grid table, like (shipping_country, shipping_city, shipping_postcode, etc) and map the corresponding fields from shipping address entry (country_id, city, postcode). To fulfill existing rows just add these columns to the select object in the install script. Send an email to ivan dot chepurnyi at ecomdev dot org if you have any questions.
Written by Ivan Chepurnyi
28 July 2010 on 2:12 amI see it will display telephones in order grid after module install.
What about telephones from new orders?
Written by Alexandr
28 July 2010 on 2:02 pmThat’s why EcomDev_PhoneForOrderGrid_Model_Observer observes sales_order_resource_init_virtual_grid_columns event. It adds telephone to virtual grid columns definitions, so order resource model will update the new values during the grid table updating.
Written by Ivan Chepurnyi
28 July 2010 on 3:10 pmHi,
Do I need to do something similar if I want to add a custom field to the checkout form?
I was able to add a new tab with some fields but don’t know how to save them with the order.
I was following several modules and tutorials but I think changes in 1.4.1 break it.
Thanks
Written by pablo
16 August 2010 on 7:42 amHi Pablo,
To add a custom attribute to checkout form, you need:
1. Add it to quote and order entities.
2. Add your input field to the checkout form through the layout
3. Than you need to create event observer for one of the events for saving the data to quote, it can be controller (postdispatch) or model (possible evens can be found in checkout models)
4. Add your attribute code to sales_convert_quote fieldset with to_order aspect.
Than you can perform some steps from this tutorial to display your custom field in the orders grid.
Written by Ivan Chepurnyi
16 August 2010 on 9:25 amHi Ivan,
I think that adding the field to the quote and order entities is not enough because in 1.4.1
we need to add a column to sales_flat_order and sales_flat_quote.
http://www.widgetsandburritos.com/technical/programming/customer-order-comment-magento-1-4-1-0/
This post looks interesting:
http://www.magentocommerce.com/boards/viewthread/19344/
I’m not sure what event to use and how to actually save the custom field to the quote.
Once it is saved to the quote I think that step 4 you mentioned should move it to the order automatically.
Thanks
Written by pablo
17 August 2010 on 7:58 amHi Pablo,
Actually if you have extended your setup model from Mage_Sales_Model_Mysql4_Setup you even should not think about adding a column. Sales Setup Model performs it depends on wich type of attribute you have specified.
This code will add a new column to sales_flat_order table, but it wont add a record to eav_attribute table, because sales module is flat now.
$installer->addAttribute(‘order’, ‘custom_attribute_name’, array(‘type’=>’int’));
Where $installer is an instance of Mage_Sales_Model_Mysql4_Setup or another class that was extended from it.
So if your extension was using Sales Setup Model, so it will work in 1.4.1 without any modifications. But a lot of extensions that are placed on Magento Connect written without thinking about upgrade-ability (eg. using another setup model, instead of customized module’s one) and when new Magento version releases store owners always have headache.
The event names you are looking for:
- controller_action_predispatch_checkout_onepage_saveorder
Use Mage::getSingleton(‘checkout/type_onepage’)->getQuote() to save data and
$observer->getEvent()->getControllerAction()->getRequest() to get the request
- controller_action_predispatch_checkout_multishipping_overviewpost
Use Mage::getSingleton(‘checkout/type_multishipping’)->getQuote() to save data and $observer->getEvent()->getControllerAction()->getRequest() to get the request
Written by Ivan Chepurnyi
20 August 2010 on 5:56 pmI’ve created a setup script at code/local/Mycomp/mymod/sql/Mymod_setup/mysql4-install-0.1.0.php:
startSetup();
$installer->addAttribute(‘order’, ‘myfield1′, array(‘type’=>’text’));
$installer->endSetup();
I’ve deleted mymod_setup from core_resource and cleared the cache.
When magento creates a new entry in core_resource I don’t see my new column in sales_flat_order.
In your example, why do you use $this->getConnection()->addColumn instead of $installer->addAttribute?
How do I use the quote to save data?
Shouldn’t I get the quote from the event?
Mage::getSingleton(‘checkout/type_onepage’)->getQuote()
Thanks
Written by pablo
21 August 2010 on 6:18 pmSeems you have forgotten to define your custom setup model and extend it from Mage_Sales_Model_Mysql4_Setup. You can do it in such a way:
config.xml
<global> <resources> <mymod_setup> <setup> <module>Mycomp_Mymod</module> <class>Mycomp_Mymod_Model_Mysql4_Setup</class> <setup> </mymod_setup> </resources> </global>Mycomp/Mymod/Model/Mysql4/Setup.php
<?php class Mycomp_Mymod_Model_Mysql4_Setup extends Mage_Sales_Model_Mysql4_Setup { }Also please make the letter case in the directory names the same with definitions in your module configuration file.
Mycomp/Mymod/sql/Mymod_setup/ is invalid directory name if you have defined in resources ‘mymod_setup’.
As for the quote data saving.
You need to call something like the following on event:
$quote = Mage::getSingleton(‘checkout/type_onepage’)->getQuote(); $quote->setMyfield1('value');where setMyfield1 method is camel style transformed setter name of your custom attribute ‘myfield1′.
As for the event data. This is not possible, because in those events there are no quote object passed, because all of them are called before a controller action dispatch. But the object you need is used as a singleton in a checkout model.
Written by Ivan Chepurnyi
25 August 2010 on 5:35 pmHi Pedro,
Payment method for order is linked through field parent_id. So the condition should be like the following:
array(‘entity_id’ => ‘parent_id’) // These will be rendered in query like ‘order_payment.parent_id = order.entity_id’
Sincerely
Written by Ivan Chepurnyi
27 August 2010 on 1:57 pmHi. I want show the payment method, but in observer i don’t know how to write the contitional for the join
$resource = $observer->getEvent()->getResource(); $resource->addVirtualGridColumn( 'customer_paymentmethod', 'sales/order_payment', array('entity_id' => 'entity_id'), 'method' );Some body can hep me?
Written by Pedro Victor
27 August 2010 on 1:27 pmThanks, but not work i’m using megento 1.4.1.1 after the update froma 1.3.2.4 version
my script to setup is:
$this->startSetup(); $this->getConnection()->addColumn( $this->getTable('sales/order_grid'), 'customer_paymentmethod', "varchar(255) not null default ''" ); $this->getConnection()->addKey( $this->getTable('sales/order_grid'), 'customer_paymentmethod', 'customer_paymentmethod' ); $select = $this->getConnection()->select(); $select->join( array('address'=>$this->getTable('sales/order_payment')), 'address.parent_id = order_grid.entity_id ', array('customer_paymentmethod' => 'method') ); $this->getConnection()->query( $select->crossUpdateFromSelect( array('order_grid' => $this->getTable('sales/order_grid')) ) ); $this->endSetup();Thanks
Written by Pedro Victor
27 August 2010 on 2:27 pmWhat an error are you receiving? And have you reinstalled your custom module after the changes I have asked about?
To reinstall the module you need to remove record from core_resource table with your module resource name and flush Magento cache.
Written by Ivan Chepurnyi
27 August 2010 on 6:10 pmIvan,
Instead of extending Mage_Sales_Model_Mysql4_Setup, can I just instantiate it in my mysql4-install.x.php file?
I need to be able to modify the sales table, profile table and to create my own custom flat table from the same install script.
Thanks
Written by pablo
29 August 2010 on 1:38 amYes you can, as well as you can define more than one setup resource for a module.
Written by Ivan Chepurnyi
31 August 2010 on 2:27 amThank you. It’s been helpful.
There’s a little typo in config.xml as the version should be 0.1.0 and not 1.0.0.
I first copied-pasted quite stupidly and wondered why the setup didn’t work
Written by Laurent Sarrazin
15 September 2010 on 1:12 amActually it should work with 1.0.0 version because it setup script will look for versions from 0.0.0 to 1.0.0 version for a setup. Maybe you have forgotten to clear cache first time? But anyway thanks for finding typo, it is corrected now
Written by Ivan Chepurnyi
15 September 2010 on 4:29 pmHi,
tks for your script, this can help me !
But, if i want to display products names and SKU, do you think it’s easy ? Or i must change more code ?
Best regards,
Cedric
Written by rapamiti
15 September 2010 on 7:22 pmYes I also thought it was the case but it was not… Maybe the cache… Anyway, you saved me a lot of time. Thank you again.
Written by Laurent Sarrazin
15 September 2010 on 11:18 pmHi Ivan,
I’ve to add one custom field as “Representative Number” in admin order creation form. I am able to add this field in the form and it appears while creating the order. To save this field in database, I’ve done the following changes ..
1)- Added one attribute in eav_attribute table with “entity_type_id” = 15, attribute_code as “representative_number”, “backend_type” = varchar etc.
2)- After adding attribute I’ve added new column in “sales_flat_order” table as “representative_number”.
3)- To save this field value, I made change in core/Mage/Adminhtml/Model/Sales/Order/Create.php in function importPostData($data) and added following lines
if (isset($data['representative_number'])) { $this->getQuote()->addData($data['representative_number']); }After doing so when I save order, representative number field is not saved in database, any idea what I’m missing?
Any kind of help will be greatly appreciated.
Thanks in advance,
Anil
Written by Anil Gupta
16 September 2010 on 1:53 pmIf you have done it by yourself not through the sql upgrade, there might be a problem in DDL cache. Magento caches table structures even if cache is enabled. So only one way to make it appear during the save you need to push “Flush Magento Cache” button on “Cache Management” page.
Written by Ivan Chepurnyi
17 September 2010 on 4:53 pmProduct Names and SKU’s it is separate table with multiple rows, so you maybe you should think about creation of column in grid table. Would be much easier to observe order collection after load event and load collection of items for current page and assign these items to according orders. Then just add custom renderer for order grid that will display these items there.
Written by Ivan Chepurnyi
17 September 2010 on 5:20 pmThanks for the nice write-up. In case anyone else finds it useful, I used the following to add the payment method to the grid:
// Add payment column to grid table $this->getConnection()->addColumn( $this->getTable('sales/order_grid'), 'payment', "varchar(255) not null default ''" ); // Add key to table for this field, $this->getConnection()->addKey( $this->getTable('sales/order_grid'), 'payment', 'payment' ); // Now fill existing rows with data from address table $select = $this->getConnection()->select(); $select->join( array('order_payment'=>$this->getTable('sales/order_payment')), $this->getConnection()->quoteInto('order_payment.parent_id = order_grid.entity_id'), array('payment' => 'method') ); $this->getConnection()->query( $select->crossUpdateFromSelect( array('order_grid' => $this->getTable('sales/order_grid')) ) );Written by pipfrogmike
21 September 2010 on 2:57 pmHi Ivan,
I want to show Payment Method, User Group & company in Order Grid on order list page. & I am succeed in it but the problem I am facing is its not allowing me to sort/search using these additional Columns. Can you please help.
Thanks,
Amit
Written by Amit Mishra
22 September 2010 on 10:42 amHave you added these columns to grid table? What is the error, that you get while trying to search/sort column?
Written by Ivan Chepurnyi
22 September 2010 on 4:06 pmHi, and thanks for the excellent guide!
I want to add billing or shipping company to the grid, but i dont know what to replace in your code.
Ive replaced all references from “customer_telephone” to “billing_company” but i dont get it to work.
Any idea what im doing wrong?
Thanks
Johan
Written by Johan
23 September 2010 on 7:49 pmPlease send me your code to my email: ivan [dot] chepurnyi [at] ecomdev.org and I will help you.
Written by Ivan Chepurnyi
30 September 2010 on 1:22 amHi, and thank you for this tutorial. Works great! I’ve even gotten it to show my custom order fields in the grid, which is perfect! How would I go about adding my custom order fields to the admin sales order view? I’d like it in the main order info box, below Order Date, Order Status, and Purchased From.
I see where that is happening in app/design/adminhtml/default/default/template/sales/order/view/info.phtml, and I know what to add, like I can use $_order->getCustomFieldName(), and modified this file to test out viewing my fields, but how can I do that without modifying this actual file?
Thank you!
Written by Sandie T
1 October 2010 on 4:07 amHi Ivan,
I have followed the process you mentioned above for adding a new column in Order Grid. I wanted to add Payment Method, Customer Group & Company fields in the Order Grid.
In mysql setup file I modified your code like –
$this->startSetup(); // Add column to grid table $this->getConnection()->addColumn( $this->getTable('sales/order_grid'), 'customer_group_id', "int(11) not null default '0'" ); $this->getConnection()->addColumn( $this->getTable('sales/order_grid'), 'method', "varchar(255) not null default ''" ); $this->getConnection()->addColumn( $this->getTable('sales/order_grid'), 'company', "varchar(255) not null default ''" ); // Add key to table for this field, // it will improve the speed of searching & sorting by the field $this->getConnection()->addKey( $this->getTable('sales/order_grid'), 'customer_group_id', 'customer_group_id' ); $this->getConnection()->addKey( $this->getTable('sales/order_grid'), 'method', 'method' ); $this->getConnection()->addKey( $this->getTable('sales/order_grid'), 'company', 'company' ); // Now you need to fullfill existing rows with data from address table $select = $this->getConnection()->select(); $select->join( array('address'=>$this->getTable('sales/order_address')), $this->getConnection()->quoteInto( 'address.parent_id = order_grid.entity_id AND address.address_type = ?', Mage_Sales_Model_Quote_Address::TYPE_BILLING ), array('company' => 'company') ); $select->join( array('order_payment'=>$this->getTable('sales/order_payment')), $this->getConnection()->quoteInto( 'order_payment.parent_id = order_grid.entity_id' ), array('method' => 'method') ); $select->join( array('order'=>$this->getTable('sales/order')), $this->getConnection()->quoteInto( 'order.entity_id = order_grid.entity_id' ), array('customer_group_id' => 'customer_group_id') ); $this->getConnection()->query( $select->crossUpdateFromSelect( array('order_grid' => $this->getTable('sales/order_grid')) ) ); $this->endSetup(); & in Observer.php I wrote - class SnvApp_FieldsForOrderGrid_Model_Observer { /** * Adds virtual grid column to order grid records generation * * @param Varien_Event_Observer $observer * @return void */ public function addColumnToResource(Varien_Event_Observer $observer) { /* @var $resource Mage_Sales_Model_Mysql4_Order */ $resource = $observer->getEvent()->getResource(); $resource->addVirtualGridColumn( 'company', 'sales/order_address', array('billing_address_id' => 'entity_id'), 'company' ); $resource->addVirtualGridColumn( 'method', 'sales/order_payment', array('parent_id' => 'entity_id'), 'method' ); $resource->addVirtualGridColumn( 'customer_group_id', 'sales/order', array('entity_id' => 'entity_id'), 'customer_group_id' ); } }& did required changes in the files you mentioned above. but still no field been added to the order grid table neither I can access them. Please help me. I need it to finish as soon as possible.
Thanks
Amit
Written by Amit Mishra
6 October 2010 on 11:15 amHi Ivan,
Sorry to bother you. Its working fine. I just have to refresh cache of my magento store. Thanks a lot for such a nice tutorial.
Regards,
Amit
Written by Amit Mishra
6 October 2010 on 12:24 pmHi John,
Just use company instead of billing_company. it will work. If still confused then see the code I posted in the comment above to your comment.
Regards,
Amit
Written by Amit Mishra
6 October 2010 on 12:26 pmHi Sandie,
The only way you can go is use layout file, for adminhtml_sales_order_view handle you need to set your template custom template for order_info block.
Written by Ivan Chepurnyi
9 October 2010 on 1:40 pmThanks Amit for your suggestion!
Ive tried using company instead of billing_company but no difference.
Didnt you need to change the references from telephone to company in app/design/adminhtml/default/default/layout/ecomdev/phoneforordergrid.xml to get it working to?
you can email directly if you want info [at] kabelbutiken [dot] com
Thanks
Johan
Written by Johan
12 October 2010 on 2:24 pmHi Ivan,
I have added fields in Order Grid but after that Order are not being Placed on front end.
Please help me.
Regards,
Amit
Written by Amit Mishra
19 October 2010 on 6:17 pmHere is the error I am getting –
exception ‘Zend_Db_Statement_Exception’ with message ‘SQLSTATE[42000]: Syntax error or access violation: 1110 Column ‘customer_group_id’ specified twice’ in /var/www/vhosts/maleedge.com/subdomains/dev/httpdocs/en/lib/Zend/Db/Statement/Pdo.php:234
Written by Amit Mishra
19 October 2010 on 6:41 pmHi Ivan,
Thanks a lot for this nice module and also for your helpful conversation.
I used this module in a magento site, it is working nicely. But, after using this, I can’t submit order, It says “There was an error processing your order. Please contact us or try again later.”.
Also, I can’t add order comments in order details at magento admin panel. Whenever I tried to add comments, it says “Could not add comments”.
I tried a lot……but found nothing..
…except one….
Whenever I changed the observer events in this file app/code/local/EcomDev/PhoneForOrderGrid/etc/config.xml, I can submit order and also can add comments. But, in that case, telephone number is not showing for new order in order grid. It is showing the telephone number for the older orders nicely.
I changed the event name to “sales_resource_init_virtual_grid_columns” instead of using “sales_order_resource_init_virtual_grid_columns”.
What can be the cause here? Please help me.
Thanks again.
Ronniee
Written by Ronniee
26 October 2010 on 3:08 pmPlease enable logging errors and look into var/log/exception.log file for details of the error.
Please post these error text here
Written by Ivan Chepurnyi
26 October 2010 on 5:29 pmHello again,
I cant find a way to display anything else then phonenumber (that dosnt work on all orders either)
Is there anyone here that could put together a module package like the example above that add columns for billing company and payment method.
Thanks
Johan
Written by Johan
10 November 2010 on 12:20 amHi… Please help me.. I am also same problem… i got error when my place order…“There was an error processing your order. Please contact us or try again later.”.
Please Help me….
My error log(exception.log) file error:
2010-11-19T06:14:02+00:00 ERR (3):
exception ‘Zend_Db_Statement_Exception’ with message ‘SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘main_table.parent_id’ in ‘on clause” in C:xampphtdocsnossalibZendDbStatementPdo.php:234
Stack trace:
#0 C:xampphtdocsnossalibZendDbStatement.php(300): Zend_Db_Statement_Pdo->_execute(Array)
#1 C:xampphtdocsnossalibZendDbAdapterAbstract.php(468): Zend_Db_Statement->execute(Array)
#2 C:xampphtdocsnossalibZendDbAdapterPdoAbstract.php(238): Zend_Db_Adapter_Abstract->query(‘INSERT INTO `sa…’, Array)
#3 C:xampphtdocsnossalibVarienDbAdapterPdoMysql.php(333): Zend_Db_Adapter_Pdo_Abstract->query(‘INSERT INTO `sa…’, Array)
#4 C:xampphtdocsnossaappcodecoreMageSalesModelMysql4OrderAbstract.php(174): Varien_Db_Adapter_Pdo_Mysql->query(‘INSERT INTO `sa…’)
#5 C:xampphtdocsnossaappcodecoreMageSalesModelAbstract.php(51): Mage_Sales_Model_Mysql4_Order_Abstract->updateGridRecords(’3′)
#6 C:xampphtdocsnossaappcodecoreMageSalesModelOrder.php(1744): Mage_Sales_Model_Abstract->_afterSave()
#7 C:xampphtdocsnossaappcodecoreMageCoreModelAbstract.php(307): Mage_Sales_Model_Order->_afterSave()
#8 C:xampphtdocsnossaappcodecoreMageCoreModelResourceTransaction.php(150): Mage_Core_Model_Abstract->save()
#9 C:xampphtdocsnossaappcodecoreMageSalesModelServiceQuote.php(181): Mage_Core_Model_Resource_Transaction->save()
#10 C:xampphtdocsnossaappcodecoreMageSalesModelServiceQuote.php(227): Mage_Sales_Model_Service_Quote->submitOrder()
#11 C:xampphtdocsnossaappcodecoreMageCheckoutModelTypeOnepage.php(618): Mage_Sales_Model_Service_Quote->submitAll()
#12 C:xampphtdocsnossaappcodecoreMageCheckoutcontrollersOnepageController.php(451): Mage_Checkout_Model_Type_Onepage->saveOrder()
#13 C:xampphtdocsnossaappcodecoreMageCoreControllerVarienAction.php(418): Mage_Checkout_OnepageController->saveOrderAction()
#14 C:xampphtdocsnossaappcodecoreMageCoreControllerVarienRouterStandard.php(254): Mage_Core_Controller_Varien_Action->dispatch(‘saveOrder’)
#15 C:xampphtdocsnossaappcodecoreMageCoreControllerVarienFront.php(177): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#16 C:xampphtdocsnossaappcodecoreMageCoreModelApp.php(304): Mage_Core_Controller_Varien_Front->dispatch()
#17 C:xampphtdocsnossaappMage.php(596): Mage_Core_Model_App->run(Array)
#18 C:xampphtdocsnossaindex.php(80): Mage::run(”, ‘store’)
#19 {main}
2010-11-19T06:14:05+00:00 ERR (3):
exception ‘Zend_Mail_Transport_Exception’ with message ‘Unable to send mail’ in C:xampphtdocsnossalibZendMailTransportSendmail.php:105
Stack trace:
#0 C:xampphtdocsnossalibZendMailTransportAbstract.php(348): Zend_Mail_Transport_Sendmail->_sendMail()
#1 C:xampphtdocsnossalibZendMail.php(973): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
#2 C:xampphtdocsnossaappcodecoreMageCoreModelEmailTemplate.php(392): Zend_Mail->send()
#3 C:xampphtdocsnossaappcodecoreMageCoreModelEmailTemplate.php(445): Mage_Core_Model_Email_Template->send(‘owner@example.c…’, ‘Owner’, Array)
#4 C:xampphtdocsnossaappcodecoreMageCheckoutHelperData.php(217): Mage_Core_Model_Email_Template->sendTransactional(‘checkout_paymen…’, ‘general’, ‘owner@example.c…’, ‘Owner’, Array)
#5 C:xampphtdocsnossaappcodecoreMageCheckoutcontrollersOnepageController.php(479): Mage_Checkout_Helper_Data->sendPaymentFailedEmail(Object(Mage_Sales_Model_Quote), ‘SQLSTATE[42S22]…’)
#6 C:xampphtdocsnossaappcodecoreMageCoreControllerVarienAction.php(418): Mage_Checkout_OnepageController->saveOrderAction()
#7 C:xampphtdocsnossaappcodecoreMageCoreControllerVarienRouterStandard.php(254): Mage_Core_Controller_Varien_Action->dispatch(‘saveOrder’)
#8 C:xampphtdocsnossaappcodecoreMageCoreControllerVarienFront.php(177): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#9 C:xampphtdocsnossaappcodecoreMageCoreModelApp.php(304): Mage_Core_Controller_Varien_Front->dispatch()
#10 C:xampphtdocsnossaappMage.php(596): Mage_Core_Model_App->run(Array)
#11 C:xampphtdocsnossaindex.php(80): Mage::run(”, ‘store’)
#12 {main}
Thanks,
C.vignesh
Written by vignesh
19 November 2010 on 9:50 amvery nice module. everything working well but i have this problem. when place order in my site it through the exception “There was an error processing your order. Please contact us or try again later.”
Written by vignesh
19 November 2010 on 10:02 amHi.. Ronniee.. did you got any solution for this error.. Replay me…
Now i am in same fix like this….
Written by vignesh
19 November 2010 on 10:07 amPlease send me a copy of your module here ichepurnyi [at] ecomdev [dot] org
Written by Ivan Chepurnyi
19 November 2010 on 9:25 pmI sent to your mail Ivan Chepurnyi.
Thanks,
Vignesh
Written by vignesh
20 November 2010 on 6:03 pmHi Ivan,
Adminhtml grids are setup to open a view page when a user clicks on one of the rows. How would you go about inserting a custom view summary block via Ajax into a list page when a row is clicked, instead of going to the new view page? For example if you are in Sales -> Orders and click on an order row, instead of getting a detailed view, a summary shows up on the top of the page and lists cart details, and billing/shipping information. Clicking ‘View’ would still take you to the regular view page.
Thanks,
Angelko
Written by Angelko
7 December 2010 on 5:03 amHi Angelko,
It won’t be a problem, just create a custom cotroller with layout which is loaded without default handle and use standard order view blocks.
Written by Ivan Chepurnyi
7 December 2010 on 1:19 pmThanks Ivan. I’m not sure how to do all that, but I think I can figure it out.
=angelko
Written by Angelko
7 December 2010 on 10:26 pmGot the OrderController for Sales -> Order grid working. Still understanding what to do with the layout.
=angelko
Written by Angelko
8 December 2010 on 5:05 amSame problem here… reason for checkout error is located in the observer (think so). When removing “$resource->addVirtualGridColumn()”, order is submitted, but the new field(s) in grid table stay of couse empty.
I’m not very familiar with the magento core api, so no idea what is going wrong
I need this nice piece of code for an annoying client >.<
Used Magento version is 1.4.1.1
Written by Ina
13 December 2010 on 3:34 pmI found the problem in Vignesh’s code.. Seems all of you used the same part of code from Amit:
$resource->addVirtualGridColumn( ‘method’, ‘sales/order_payment’, array(‘parent_id’ => ‘entity_id’), ‘method’ );Here is the problem in third argument for addVirtualGridColumn method: array(‘parent_id’ => ‘entity_id’) where ‘parent_id’ and ‘entity_id’ should be swapped, because array key is the colum in order table and array value is the column in target table.
So the final code should be:
$resource->addVirtualGridColumn( 'method', 'sales/order_payment', array('entity_id' => 'parent_id'), 'method' );Written by Ivan Chepurnyi
13 December 2010 on 4:41 pmIvan you are my HERO!
[img]http://www.greensmilies.com/smile/smiley_emoticons_torte5.gif[/img]
Yesterday i changed these two columns for testing, but also changed it for telephone… *plonk*
Working code is:
$resource->addVirtualGridColumn( 'customer_telephone', 'sales/order_address', array('billing_address_id' => 'entity_id'), 'telephone' ); $resource->addVirtualGridColumn( 'paymethod', 'sales/order_payment', array('entity_id' => 'parent_id'), 'method' );Written by Ina
14 December 2010 on 10:28 am100% functional in magento 1.4.1.1
But not in 1.4.2.0
What modification is necessary, any see
Written by Marcio
17 December 2010 on 9:17 pmAfter reviewing of 1.4.2 features, I will update this post with the fix…
Written by Ivan Chepurnyi
17 December 2010 on 9:47 pmVery nice and informative tutorial! Do you already have some information about the 1.4.2-issues?
In 1.4.2 the “sales_order_resource_init_virtual_grid_columns” is not fired.
Thanks again!
Written by Martijn
6 January 2011 on 12:01 pmHi again,
I now got payment method column working, still having problem with company and customer email-adress. If someone got any suggestions to get this please let me know.
I also wonder if its possible to set the column with in the layout xml file. Plus it would be nice to add a dropdown box for the payment column..
Can this be done?
Many thanks
Johan
Written by Johan
10 January 2011 on 10:55 pmWorked great, thanks. I added the shipping_description field. If you or anyone else knows how to make it a dropdown (as Johan suggested), that would be even better.
Written by Duncan
18 January 2011 on 1:03 amok after all files implementation how do I install the module? sorry but im new to magento…
Written by Manuel
18 March 2011 on 10:46 pmThank you for the nice explanation, but do I have to use same technique while adding new attribute to Customer and adding new column for that attribute in Admin/Customer?
Written by Zoran
27 March 2011 on 3:43 amDon’t bother answering the above question, I realized what the code is doing and I must admit, this is the best method I have seen so far from all about extending admin grids, it’s also the most elegant way without hacking the core.
Written by Zoran
27 March 2011 on 4:19 pmHi Ivan,
this is my sql setup
<?php /** * Setup scripts, add new column and fulfills * its values to existing rows * */ /* @var $this Mage_Sales_Model_Mysql4_Setup */ $this->startSetup(); // Add column to grid table $this->getConnection()->addColumn( $this->getTable('sales/order_grid'), 'payment', "varchar(255) not null default ''" ); // Add key to table for this field, // it will improve the speed of searching & sorting by the field $this->getConnection()->addKey( $this->getTable('sales/order_grid'), 'payment', 'payment' ); // Now you need to fullfill existing rows with data from address table $select = $this->getConnection()->select(); $select->join( array('order_payment'=>$this->getTable('sales/order_payment')), $this->getConnection()->quoteInto('order_payment.parent_id = order_grid.entity_id'), array('payment' => 'method') ); $this->getConnection()->query( $select->crossUpdateFromSelect( array('order_grid' => $this->getTable('sales/order_grid')) ) ); $this->endSetup(); ?>And
<?php /** * Setup scripts, add new column and fulfills * its values to existing rows * */ /* @var $this Mage_Sales_Model_Mysql4_Setup */ $this->startSetup(); // Add column to grid table $this->getConnection()->addColumn( $this->getTable('sales/order_grid'), 'payment', "varchar(255) not null default ''" ); // Add key to table for this field, // it will improve the speed of searching & sorting by the field $this->getConnection()->addKey( $this->getTable('sales/order_grid'), 'payment', 'payment' ); // Now you need to fullfill existing rows with data from address table $select = $this->getConnection()->select(); $select->join( array('order_payment'=>$this->getTable('sales/order_payment')), $this->getConnection()->quoteInto('order_payment.parent_id = order_grid.entity_id'), array('payment' => 'method') ); $this->getConnection()->query( $select->crossUpdateFromSelect( array('order_grid' => $this->getTable('sales/order_grid')) ) ); $this->endSetup(); ?>I did everything following you but
no data display in the grid
Could you help me please?
Written by Tonkiddy
21 April 2011 on 11:01 amVery nice and informative guide.
i’m trying to play with your code.
and…
i’m just dropped customer_telephone field from sales_flat_order_grid table. and then after…
i have a problem. when I place order in frontend it through the exception
“Please specify a valid grid column alias name that exists in grid table.”
if i remove your module, then checkout working fine.
Written by hyun
25 April 2011 on 2:06 amwhen i created customer_telephone field to sales_flat_order_grid table. and place order again…
but problem still same…
“Please specify a valid grid column alias name that exists in grid table.”
how to reset for sales_flat_order_grid table… same like before…( when i install you module before…)
and how remove your module data from mysql db?
Written by hyun
25 April 2011 on 2:47 amPlease check the code in observer.
Written by Ivan Chepurnyi
25 April 2011 on 7:12 amHow can i display deal name to order_grid
Written by Tonkiddy
25 April 2011 on 9:17 amI found solution. it’s a clear cache… Anyway, Thank you again.
Written by hyun
25 April 2011 on 4:26 pmCache?
Written by Ivan Chepurnyi
26 April 2011 on 12:48 pmHi Ivan… great tutorial and reference… I wonder if you have any reference on implementing a column with a type of “options” as opposed “text” and populating the options into the select menu that options creates… Thanks again
Written by Laurie
20 May 2011 on 12:17 pmI am interested how can I add a custom order attribute inside the order details page. The idea is to have a checkbox there saying it is escalated order and then when the Invoice is sent if this is ticked a special text to be displayed in the Invoice. I know how to add this inside the Invoice but how can i add this attribute on order details page.
Thanks in advance.
Written by Milen
24 May 2011 on 8:24 amHi Ivan,
thanks for this article. Ive used it to show customer email on order grid. But i’ve noticed when i only add the database column in installer script, and code to fill email field for existing orders everyting works fine.
When i do an order now, the new order appears in the order grid including the email column.
I was thinking the event observer part was to add the customer email to the grid table when a new order was placed, but it looks like i’m wrong.
Can you give a little more explaination about when the event is fired?
Thanks a lot!
Written by Edwin Koster
9 June 2011 on 8:08 amBy the way, it looks like all comments on this page are witten at the 27th of july.. (but i wrote mine today)
I think it’s a little bug?
Written by Edwin Koster
9 June 2011 on 8:10 amHi Edwin,
If you use attribute from order entity you don’t need to define observer for addition virtual column, because this attribute exists in order table and will be fulfilled automatically on order save action. This event add instructions for order resource model from what place it should retrieve data for grid, after the order save action.
See the last paragraph in the article.
Written by Ivan Chepurnyi
9 June 2011 on 8:27 amAs for bug, yeah, seems the wordpress developer who created our theme used wrong function for date retrieval, so it showed post date with comment time, instead of comment time. I just fixed that small issue.
Written by Ivan Chepurnyi
9 June 2011 on 8:29 amHi Ivan
This is really helpful. I’m trying to add the shipping description field to the grid. I have the column added and displayed but it’s not populating the old data from sales_flat_order. Where am I going wrong?
Here is my SQL install file:
<?php /** * Setup scripts, add new column and fulfills * its values to existing rows * */ /* @var $this Mage_Sales_Model_Mysql4_Setup */ $this->startSetup(); // Add column to grid table $this->getConnection()->addColumn( $this->getTable('sales/order_grid'), 'shipping_description', "varchar(255) not null default ''" ); // Add key to table for this field, // it will improve the speed of searching & sorting by the field $this->getConnection()->addKey( $this->getTable('sales/order_grid'), 'shipping_description', 'shipping_description' ); // fill existing rows with data $select = $this->getConnection()->select(); $select->join( array('order'=>$this->getTable('sales/order')), $this->getConnection()->quoteInto('order.entity_id = order_grid.entity_id',''), array('shipping_description' => 'shipping_description') ); $this->getConnection()->query( $select->crossUpdateFromSelect( array('order_grid' => $this->getTable('sales/order_grid')) ) ); $this->endSetup();Thanks!
Simon
Written by Simon Young
26 June 2011 on 7:02 amHi Ivan,
Almost everything works, that is, I got my additional columns added to the table and filled with data. However, the grid is not updated. As mentioned earlier in another comment, the “sales_order_resource_init_virtual_grid_columns” doesn’t seem to fire, at least no in v1.5.1.0. I logged the dispatched events which are:
Any comment HIGHLY appreciated. Many thanks.
Written by Frederik Krautwald
27 June 2011 on 12:21 amPlease disregard my above post. The event does fire after all. It was a typo in my xml file that caused the situation. Sorry for any inconvenience or trouble, and thank you so much for the great articles and sharing of insight in Magento’s code and functionality.
Written by Frederik Krautwald
27 June 2011 on 12:26 pmWould you by any chance know if there is an opposite method to addVirtualColumn, such as removeVirtualColumn, or alike?
I have added to columns, ‘Bill to Company’ and ‘Ship to Company’, and would like remove the standard ‘Bill to Name’ and ‘Ship to Name’ columns. I have found that these standard columns are hardcoded in Mage_Sales_Model_Mysql4_Order. Do I have to bypass this class by adding my own in my module, or is there as smarter way?
Written by Frederik Krautwald
27 June 2011 on 12:47 pmaddVirtualColumn used only in saving order process, when records for grid table are generated. You should look into grid block columns logic:
For your purpose it is better just perform one more addColumn with the same column id as ship to name and bill to name but with different ‘index’ where your new column names will be.
Written by Ivan Chepurnyi
27 June 2011 on 8:09 pmIvan,
Great tutorial you’ve provided. I’m looking for this functionality overall, but the column I’d like to add is for that of a custom product attribute.
I was thinking I could use the joinAttribute function to pull that attribute for the product/sku that’s been ordered, but first off I’m not exactly sure what the code should look like, and second, the ordering of multiple products for an order may cause some problems.
Any ideas on how to approach this… or how the code might look?
Thanks!
Brian
Written by brian b
6 July 2011 on 10:08 pmhi,
great tutorial, big up!
Written by mzentrale
29 July 2011 on 11:49 amHi,
This is very nice article.can u explain the same steps for adding phone number column in magento 1.5.But,It is not working.I means phone number is not being displayed on the sales order grid.
Adding order attribute to the orders grid in Magento 1.5
Thanks
Written by Rajesh
8 August 2011 on 7:44 amIt works the same for 1.5, there is no modification needed for making it possible. You just need to change attribute that will be used in the code.
Written by Ivan Chepurnyi
11 August 2011 on 9:45 amHi, Ivan!
And how to add a column with “options” type and options given by some model?
Written by Roomine Bolevar
29 August 2011 on 1:29 pmGreat article, works well. Thanks!
Written by Oleg
23 September 2011 on 5:39 pmI am trying to apply this same principal to create a delivery date field in the grid and a ship date field in the grid. The delivery Date generates they date that customer chooses for shipping… the ship date is suppose to reflect a when the package is released from the warehouse I have tried and failed miserable at this can create a grid column but maybe you may know of better method of calling out something like this
Written by James
18 October 2011 on 9:40 pm@James, where is your shipping date field is stored? In the order or in the order address table?
Written by Ivan Chepurnyi
18 October 2011 on 11:39 pmHey, Ivan!
Thanks again for another one good Magento solution.
But i’m not sure that changing of Magento Core tables is a good idea. Please, let me suggest another one solution for the same task.
I’ve created new simple module and added new table `my_order_phone`, that has joined to sales/order_grid table through `increment_id` field.
Next step – override Magento Core Block.
In class My_Module_Block_Mage_Adminhtml_Sales_Order_Grid, that extended Mage_Adminhtml_Block_Sales_Order_Grid i’ve overrided ‘_prepareCollection’ and ‘_prepareColumns’ methods to add needed join to the my table and add new column to the grid, with custom renderer if needed.
Last step – add an observer to save extended data after saving an order.
Written by Sergey A. Lisenko
20 October 2011 on 7:53 amThanks for such info , how can we get the product thumbnails in sales order grid ?
Thanks again
Written by vipin sahu
21 October 2011 on 2:23 amGreat Tutorial! This worked like a charm.
Quick Question – how do you get the newly added columns to show when you export as .csv? Is there a special function for exporting that also needs to be modified?
Thanks again! This is great stuff.
Written by Nick
29 October 2011 on 4:20 pmI found a way that works but might not be the best solution:
I modified the file here: app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php (I think the whole point of this is to not have to modify this file)
Added the following:
/* NJC Custom Columns */ $this->addColumn('license_total', array( 'header' => Mage::helper('sales')->__('License Fee'), 'index' => 'license_total', 'type' => 'currency', 'currency' => 'order_currency_code', )); $this->addColumn('convenience_fee', array( 'header' => Mage::helper('sales')->__('Convenience Fee'), 'index' => 'convenience_fee', 'type' => 'currency', 'currency' => 'order_currency_code', )); $this->addColumn('postage', array( 'header' => Mage::helper('sales')->__('Postage'), 'index' => 'postage', 'type' => 'currency', 'currency' => 'order_currency_code', )); /* End Custom Columns */Now the columns come out in the .csv export as desired.
Is there a better way to accomplish this?
Thanks, hopefully this helps someone.
Written by Nick
29 October 2011 on 4:38 pmI really agree with Ivan regarding this great approach of using event-observer method. I know it can be done using Adminhtml > Sales > Order Grid Overriding but what if some other extension overrides that Block? Who wins the battle?
It’s always good to use event-observer method whenever possible. Magento should provide as much as events for the purpose.
Thanks Ivan for the great post and sharing with us.
Cheers!!
Written by MagePsycho
31 October 2011 on 1:14 pmIvan, I really need your help in the case that i was unable to make the added custom columns in the csv export. Is there any xml config for that?
Let me know.
Thanks
Regards
Written by MagePsycho
3 November 2011 on 2:17 pmI’m need to add a column with the country and another with the province/state instead of the phone number on 1.5.1
Anything I should be aware of for 1.5.1 or some ideas I should be aware of?
Thanks
Written by DigitalDeath
4 December 2011 on 6:15 amHi,
I followed this code . I have a custom module named “subscription” .I am trying to place subscription start date in sales admin grid.In ” Config.xml ” i putbelow code:-
0.1.0
<!–
Subscription_Start_Model
–>
Subscription_Start_Model
Mage_Sales_Model_Mysql4
sales_flat_order_grid
subscription_start/observer
addColumnToResource
Subscription_Start
Mage_Sales_Model_Mysql4_Setup
subscription/start.xml
Subscription_Start_Model_Mysql4
sales_flat_order_grid
Observer.php:-
public function addColumnToResource(Varien_Event_Observer $observer)
{
/* @var $resource Mage_Sales_Model_Mysql4_Order */
$resource = $observer->getEvent()->getResource();
$resource->addVirtualGridColumn(
‘subscription_start_date’,
‘subscription’,
array(” => ”),
‘start_date’
);
}
in sql file:–
$this->startSetup();
// Add column to grid table
$this->getConnection()->addColumn(
$this->getTable(‘sales/order_grid’),
‘subscription_start_date’,
‘datetime NULL’
);
// Add key to table for this field,
// it will improve the speed of searching & sorting by the field
$this->getConnection()->addKey(
$this->getTable(‘sales/order_grid’),
‘subscription_start_date’,
‘subscription_start_date’
);
// Now you need to fullfill existing rows with data from address table
$select = $this->getConnection()->select();
$select->join(
array(‘subscription’=>$this->getTable(‘subscription’)),
$this->getConnection()->quoteInto(‘subscription.subscription_id = order_grid.entity_id ‘//, Mage_Sales_Model_Quote_Address::TYPE_BILLING
),
array(‘subscription_start_date’ => ‘start_date’)
);
$this->getConnection()->query(
$select->crossUpdateFromSelect(
array(‘order_grid’ => $this->getTable(‘sales/order_grid’))
)
);
$this->endSetup();$this->startSetup();
// Add column to grid table
$this->getConnection()->addColumn(
$this->getTable(‘sales/order_grid’),
‘subscription_start_date’,
‘datetime NULL’
);
// Add key to table for this field,
// it will improve the speed of searching & sorting by the field
$this->getConnection()->addKey(
$this->getTable(‘sales/order_grid’),
‘subscription_start_date’,
‘subscription_start_date’
);
// Now you need to fullfill existing rows with data from address table
$select = $this->getConnection()->select();
$select->join(
array(‘subscription’=>$this->getTable(‘subscription’)),
$this->getConnection()->quoteInto(‘subscription.subscription_id = order_grid.entity_id ‘//, Mage_Sales_Model_Quote_Address::TYPE_BILLING
),
array(‘subscription_start_date’ => ‘start_date’)
);
$this->getConnection()->query(
$select->crossUpdateFromSelect(
array(‘order_grid’ => $this->getTable(‘sales/order_grid’))
)
);
$this->endSetup();
Field is created but value is not coming .Please help me. It’s very urgent for me.
Thanks,
Swapna.
Written by Swapna
27 December 2011 on 12:19 pmHow to add column “Product name” and “Email” “Quantity” in Oder list?. Help me!. Thanks!.
Written by kamejoko
28 December 2011 on 6:26 pmI am running this code successfully.
i have add the customer email in place of telephone.
it give me this error when i try to edit the order
SQLSTATE[42000]: Syntax error or access violation: 1110 Column ‘customer_email’ specified twice
Written by manan
5 January 2012 on 12:42 pmDoes this tutorial work for Magento 1.6++?
Written by andy
21 February 2012 on 12:56 pmSure
Written by Ivan Chepurnyi
27 February 2012 on 8:33 amI am having some issues and errors with this. “exception ‘Mage_Core_Exception’ with message ‘Please specify a valid grid column alias name that exists in grid table.’ in”
I need to bring in three columns.
cc_type with dropdown filter
base_tax_amount as currency
subtotal before tax as currency
I have tried many ways but I am still not able to get this working.
Written by CKENT
19 March 2012 on 7:58 pmI got it but like others the newly created fields do not export when you click on export to CSV. Is there any way to make this do that?
Written by CKENT
20 March 2012 on 3:13 amHello
I need to create a new column in the grid order of Magento, but I need the value to be read in a MySQL table I created separately.
This table has a field that identifies the request, and with a value that I wish to present new field in the grid.
I can do this from the model presented in this article?
That is, create a way to “read” the table I created, identify the application number, and return the desired value?
Any help or tip is welcome.
Thank you.
Homero Ottoni
Written by Homero
12 April 2012 on 3:32 pmHello
I need to change the status of the application in the the screen grid, after the invoices are printed. The client needs to check claims to have invoices printed from this screen. So I created a separate table, to manage this situation.
But I do not know how to present the status of whether or not printed on the grid order, you know a way to do this directly by the system of Magento?
The printing of the bill changes a field in the tables in Magento?
Thank you.
Written by Homero
12 April 2012 on 3:53 pmI need to add Category name column in order detail page items section. plus i need to make sortable columns there… any one help me thanks in advance
Written by Omar
19 April 2012 on 5:39 pmHello,
This is really nice tutorial.
We are developing our project in magento 1st time for for gadgets and mobile selling.
So when we create invoice for particular order at that time I should be able to update/enter the (IMEI)number for particular invoice.
and show in invoice.
(we need to add custom field when we create Invoice for Order )
pls help me for this task..
Written by Praful Rajput
23 April 2012 on 1:40 pmComment?
Please use [php][/php] and [xml][/xml] for your code snippets