this is not the most constructive question for Magento development. But this is certainly one that keeps me boggled …
On the magento order grid in the backed we see that an order takes up multiple lines of space. 3 instead of 1 [in column Purchased From (Store)]. This is because we have a multistore. The resukt is that we see 1/3rd of the normal number of orders on 1 screen. No biggie, but something I want to change.
My question: How can I change the text in the column Purchased From (Store)? I would like it to be store view name or store domain. And maybe on mouseover a title is shown that does show the whole sequence. Example below.
I am looking at /app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php but dont know how to go from there and actually change this.
@Mage/Ebay: Also I think this should be something to set on/off in config for future versions.
Best Answer
You're in the right place to start your investigation at
app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php
. A look at_prepareColumns()
indicates the renderer for that column:The
type
will result in this column being rendered by theMage_Adminhtml_Block_Widget_Grid_Column_Renderer_Store::render()
method:What a terrible method! At most, block classes should handle view logic and prepare the data for rendering in a template context. Here we see an inflexible mix of logic and markup. Therefore you have two options to customize this:
Either case could be justified. Option #1 is the most direct, but it is likely to impact other views which use this same render. If that's what you want universally then go for it. For the latter you would declare a custom module block class group, rewrite the sales order grid class, and point to your custom renderer in the
type
parameter.You are not alone in asking that eBay/Magento make this more flexible. There is a hackathon project which made grids configurable in XML, and Magento 2 has this listed as a feature.