last day (40 days later) » 

7:04 AM
hi
4
A: How can i get Tracking Number on Sales order grid

Jaimin SutariyaYou can do it with below. Add below code in your app/code/local/Vendor/Module/etc/config.xml <?xml version="1.0"?> <config> <modules> <Vendor_Module> <version>0.1.0</version> </Vendor_Module> </modules> <global> <blocks> <module> <class>Vendor_Mo...

how can i add mail id on sales order grid
this is the complete code which you gave last
<?php
class Vendor_Module_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
{
protected function _prepareCollection()
{

$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->joinLeft(array("track_table"=>Mage::getSingleton('core/resource')->getTableName('sales/shipment_track')), "main_table.entity_id = track_table.order_id",array('track_number'))->group('main_table.entity_id');
$collection->join(array('payment'=>'sales/order_payment'),'main_table.entity_id=payment.parent_id','method');
 
7:24 AM
you mean email address of customer?
@Rathinam
 
yes
$this->addColumnAfter('email', array(
'header' => Mage::helper('sales')->__('Email'),
'index' => 'email',
'type'=> 'text',
'filter_index' => 'sales_flat_order_address.email',
),'status');
$this->sortColumnsByOrder();
}
this what i added but not working
 
okay let me check
 
$this->addColumnAfter('email', array( --> addcolumnafter ?
 
7:41 AM
Your code is correct
you need to add email field to your collection
@Rathinam
 
$collection->getSelect()->join('sales_flat_order_address', 'main_table.entity_id = sales_flat_order_address.parent_id',array('telephone','email','city','postcode',‌​'country_id' ) )->where("sales_flat_order_address.address_type = 'billing'");
 
update your code _prepareCollection
$collection->getSelect()->join('sales_flat_order_address', 'main_table.entity_id = sales_flat_order_address.parent_id',array('telephone','city','postcode','country‌​_id' ) )->where("sales_flat_order_address.address_type = 'billing'");
replace above with below
$collection->getSelect()->join('sales_flat_order_address', 'main_table.entity_id = sales_flat_order_address.parent_id',array('telephone','city','postcode','country‌​_id','email' ) )->where("sales_flat_order_address.address_type = 'billing'");
here I added 'email'
in array array('telephone','city','postcode','country‌​_id' )
 
here is my full code with changes still not working
<?php
class Vendor_Module_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
{
protected function _prepareCollection()
{

$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->joinLeft(array("track_table"=>Mage::getSingleton('core/resource')->getTableName('sales/shipment_track')), "main_table.entity_id = track_table.order_id",array('track_number'))->group('main_table.entity_id');
$collection->join(array('payment'=>'sales/order_payment'),'main_table.entity_id=payment.parent_id','method');
 
there is a typo mistake here
/** email */
$this->addColumnAfter('email', array(
'header' => Mage::helper('sales')->__('Email'),
'index' => 'email',
'type'=> 'text',
'filter_index' => 'sales_flat_order_address.email',
),'status');
please remove
$this->sortColumnsByOrder();
}
from
/** email */
$this->addColumnAfter('email', array(
'header' => Mage::helper('sales')->__('Email'),
'index' => 'email',
'type'=> 'text',
'filter_index' => 'sales_flat_order_address.email',
),'status');
$this->sortColumnsByOrder();
}
 
is it okay,,
<?php
class Vendor_Module_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
{
protected function _prepareCollection()
{

$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->joinLeft(array("track_table"=>Mage::getSingleton('core/resource')->getTableName('sales/shipment_track')), "main_table.entity_id = track_table.order_id",array('track_number'))->group('main_table.entity_id');
$collection->join(array('payment'=>'sales/order_payment'),'main_table.entity_id=payment.parent_id','method');
still not working
 
7:54 AM
I'll provide full code
one min
 
okay
 
<?php
class Vendor_Module_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
{
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->joinLeft(array("track_table"=>Mage::getSingleton('core/resource')->getTableName('sales/shipment_track')), "main_table.entity_id = track_table.order_id",array('track_number'))->group('main_table.entity_id');
$collection->join(array('payment'=>'sales/order_payment'),'main_table.entity_id=payment.parent_id','method');
Please use this code
 
let me check
one small doubt, how to display email after ship to name column
 
<?php
class Vendor_Module_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
{
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->joinLeft(array("track_table"=>Mage::getSingleton('core/resource')->getTableName('sales/shipment_track')), "main_table.entity_id = track_table.order_id",array('track_number'))->group('main_table.entity_id');
$collection->join(array('payment'=>'sales/order_payment'),'main_table.entity_id=payment.parent_id','method');
okay, then you can use below
 
8:58 AM
its working good, tq bro
 

  last day (40 days later) »