Magento Background Order Grid table get Shipping_description

Source: Internet
Author: User

Sometimes the grid table in the background we want to see what shipping method is selected for the current order.

For example: Before the door to add the way, then when there are many orders need to filter out the door from the orders, first deal with those who need to send courier.

Workaround:

(It's a good idea to rewrite the module without modifying the core file.) This is no longer a reminder. )

1. Modify the _getcollectionclass function in the grid.php to

Return ' sales/order_grid_collection ';

Revision changed to

Return ' sales/order_collection ';
But it is obviously unreasonable to do so, because you will find that shipping name is empty.

Of course you can modify the $collection join Sales_flat_order_grid (I haven't tested it).

2. Most of the information found online is

Add a join for $collection for example:

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 ();}

Then AddColumn () in the _preparecolumns () function of grid.php
$this->addcolumnafter (' shipping_description ', Array (            ' header ' = ' mage::helper (' Sales ')->__ (' Shipping Method '),            ' index ' = ' shipping_description ',            ' width ' = ' 100px ',            ' filter_index ' = ' sales_flat_ ' Order.shipping_description ',        ), ' method ');

But in doing so you will find that many filtering (search) functions are not good enough, such as searching for an order number.


In fact, the solution is simply to rewrite all the values in the grid.php you have rewritten and take the parameters Filter_index

Example: increment_id

$this->addcolumn (' real_order_id ', Array (            ' header ' = + mage::helper (' Sales ')->__ (' Order # '),            ' Width ' + ' 80px ',            ' type '  = ' text ',            ' index ' = ' increment_id ',            ' filter_index ' = ' main_ ' table.increment_id ',        ));




Magento Background Order Grid table get Shipping_description

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.