Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
Changing order grid row color depending on order status
 
Insolo
Jr. Member
 
Avatar
Total Posts:  11
Joined:  2010-04-26
 

Hi all!

Does anyone know how to change row background color in admin Orders grid? Depending on the order status.

Example: Completed orders are with green background and other red. Also cancelled orders could be black or something.

This could speed up processing orders.

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
filmpro
Jr. Member
 
Total Posts:  7
Joined:  2010-08-27
 

I am looking to accomplish the same thing. Does anyone have an answer, or are able to point us in the right direction? Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
lugobox
Member
 
Total Posts:  61
Joined:  2010-12-14
 

same here ! this feature would be wonderful i had this implemented in prestashop and now i miss i!

 
Magento Community Magento Community
Magento Community
Magento Community
 
lmcsheff
Jr. Member
 
Total Posts:  20
Joined:  2010-09-22
 

Me too!

Anyone got any pointers?

 
Magento Community Magento Community
Magento Community
Magento Community
 
dannyh
Jr. Member
 
Total Posts:  15
Joined:  2010-01-17
 

Yes, was looking for the same.
But..like so many posts in the forum...it’s all questions an no answers:(

 
Magento Community Magento Community
Magento Community
Magento Community
 
mooshi
Sr. Member
 
Avatar
Total Posts:  88
Joined:  2009-07-25
Australia
 

*bumpity bump...would be useful!

 
Magento Community Magento Community
Magento Community
Magento Community
 
sukk1e
Jr. Member
 
Total Posts:  28
Joined:  2011-04-19
 

You can find it in the templatefile:
adminhtml/template/widget/grid.phtml

around Line 155 you will see the TR being called where you need to code in a check which checks the status and gives an additional style to the row.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Scotty_23
Jr. Member
 
Total Posts:  5
Joined:  2010-07-12
 

This is exactly what I’m looking for after moving over from Prestashop. I really miss this feature and I’ve only just realised how easy this feature makes for tracking orders. I can’t actually believe that no one has come up with an extension to address this, I can guarantee that it would be very popular.

I don’t suppose anyone could supply any code or clues for us novices to implement this feature ourselves?

 
Magento Community Magento Community
Magento Community
Magento Community
 
abellizzi
Jr. Member
 
Total Posts:  8
Joined:  2011-06-09
 

I found that solution http://stackoverflow.com/questions/6569386/approach-on-changing-row-color-on-orders-grid-in-admin

But didnt seem to work, at least to me…

Does anybody know how to do that ? it shouldnt be that difficult…

 
Magento Community Magento Community
Magento Community
Magento Community
 
sanmic
Member
 
Total Posts:  54
Joined:  2009-12-26
 

Hi,

Has anyone got this to work?

/Michael

 
Magento Community Magento Community
Magento Community
Magento Community
 
rrroulio
Sr. Member
 
Avatar
Total Posts:  88
Joined:  2008-03-26
france moselle
 

it is possible in admin grid template. be carefull when you upgrade version !

in /app/design/adminhtml/default/default/template/widget/grid.phtml
search :

<?php echo (($_html $_column->getRowField($_item)) != '' $_html '&nbsp;'?>
replace by this code and adapt with your visible translated status, add status in $bad and add corrected code with html and css in $good
<?php //echo (($_html = $_column->getRowField($_item)) != '' ? $_html : '&nbsp;') ?>
                        
<?php     
//color status                           
$bad=array('On Hold','Canceled','Closed');
$good=array('<span style="color:#88BC18;text-transform:uppercase;"><b>On Hold</b></span>','<span style="color:#0D69BF;text-transform:uppercase;font-size:11px;"><b>Canceled<b></span>','<span style="color:red;"><i><b>Closed</b></i></span>');
$color_me=str_replace($bad,$good,$_column->getRowField($_item));
echo ((
$_html $color_me) != '' $_html '&nbsp;'
//end color status?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
lyledg
Jr. Member
 
Total Posts:  4
Joined:  2011-11-02
 

I tried thsi solution ( http://stackoverflow.com/questions/6569386/approach-on-changing-row-color-on-orders-grid-in-admin ) too in v 1.7.0.2, and it did not work either.

Anyone have a solution that works, please?

Cheers

 
Magento Community Magento Community
Magento Community
Magento Community
 
centerfireguns
Jr. Member
 
Total Posts:  3
Joined:  2010-12-11
 

The post from rroulio has an error, change

//end color status?>

to

//end color status
?>

It works to change the color of the order status in the grid, it does not change the entire background grid color, but it does help to more easily see different order status’. Tested in CE 1.7 and EE 1.11.

I could not get the the post from lyledg to the stackoverflow answer to work.

 
Magento Community Magento Community
Magento Community
Magento Community
 
willmilagro
Jr. Member
 
Total Posts:  1
Joined:  2011-06-23
 

Using best pratice you should use method “getRowClass” in your grid class.
When method is called from widget/grid.phtml, one parameter is passed with information from row.
Example, to change background color you can declare:

public function getRowClass($item{
if($item->getStatus() == 'canceled'{
return 'background-red';
}

return false;
}

and in your admin css you should add the class:

.background-red {
background
-color:red !important;
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
myladeybugg
Member
 
Total Posts:  32
Joined:  2013-01-30
 
rrroulio - 20 June 2012 06:46 AM

it is possible in admin grid template. be carefull when you upgrade version !

in /app/design/adminhtml/default/default/template/widget/grid.phtml
search :

<?php echo (($_html $_column->getRowField($_item)) != '' $_html '&nbsp;'?>
replace by this code and adapt with your visible translated status, add status in $bad and add corrected code with html and css in $good
<?php //echo (($_html = $_column->getRowField($_item)) != '' ? $_html : '&nbsp;') ?>
                        
<?php     
//color status                           
$bad=array('On Hold','Canceled','Closed');
$good=array('<span style="color:#88BC18;text-transform:uppercase;"><b>On Hold</b></span>','<span style="color:#0D69BF;text-transform:uppercase;font-size:11px;"><b>Canceled<b></span>','<span style="color:red;"><i><b>Closed</b></i></span>');
$color_me=str_replace($bad,$good,$_column->getRowField($_item));
echo ((
$_html $color_me) != '' $_html '&nbsp;'
//end color status?>

I’d like to have a different color for pending, processing, and complete. Do you know how I could do that? Can I just copy the code above and replace the $bad value and the style?

 
Magento Community Magento Community
Magento Community
Magento Community
 
myladeybugg
Member
 
Total Posts:  32
Joined:  2013-01-30
 

For anyone interested in changing the color for all order statuses. I followed rrroulio post and just added a little bit to it.

in /app/design/adminhtml/default/default/template/widget/grid.phtml
search :

<?php echo (($_html $_column->getRowField($_item)) != '' $_html '&nbsp;'?>

and replace it with:

<?php //echo (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?>

<?php     
//color status                           
$bad=array('On Hold','Canceled','Closed','Pending Payment','Pending','Processing','Complete');
$good=array('<span style="color:#88BC18;text-transform:uppercase;"><b>On Hold</b></span>','<span style="color:red;text-transform:uppercase;font-size:11px;"><b>Canceled<b></span>','<span style="color:red;"><i><b>Closed</b></i></span>','<span style="color:#0D69BF;text-transform:uppercase;font-size:11px;"><b>Pending Payment<b></span>','<span style="color:#0D69BF;text-transform:uppercase;font-size:11px;"><b>Pending<b></span>','<span style="color:goldenrod;text-transform:uppercase;font-size:11px;"><b>Processing<b></span>','<span style="color:green;text-transform:uppercase;font-size:11px;"><b>Complete<b></span>');
$color_me=str_replace($bad,$good,$_column->getRowField($_item));
echo ((
$_html $color_me) != '' $_html '&nbsp;'
//end color status
?>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2