×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: bejoy balan
Added: Jun 15, 2016 10:37 AM
Views: 20
http://stackoverflow.com/questions/6569386/approach-on-changing-row-color-on-orders-grid-in-admin
  1.  
  2.  
  3. Copy js/mage/adminhtml/grid.js to js/colors/adminhtml/grid.js
  4.  
  5. Make the file 666 and the folders (js/colors & js/colors/adminhtml) 777.
  6.  
  7. Edit it and after line 208 (before the line containing }.bind(this)) add:
  8.  
  9. colorize();
  10. At the end of the file add:
  11.  
  12. function colorize () {
  13.     $$('td').each(function(macguffin) {
  14.        if(macguffin.innerHTML.strip()=="Processing") macguffin.parentNode.setStyle({backgroundColor: 'Orange' });
  15.         if(macguffin.innerHTML.strip()=="Pending") macguffin.parentNode.setStyle({backgroundColor: 'Gold', color:'Black' });
  16.         if(macguffin.innerHTML.strip()=="Payment Review") macguffin.parentNode.setStyle({backgroundColor: 'LightPink' });
  17.         if((macguffin.innerHTML.strip()=="On Hold")||(macguffin.innerHTML.strip()=="Payment Review")) macguffin.parentNode.setStyle({backgroundColor: 'HotPink' });
  18.         if(macguffin.innerHTML.strip()=="Suspected Fraud") macguffin.parentNode.setStyle({backgroundColor: 'Red' });
  19.         if((macguffin.innerHTML.strip()=="Closed")||(macguffin.innerHTML.strip()=="Canceled")||(macguffin.innerHTML.strip()=="Cancelled")) macguffin.parentNode.setStyle({backgroundColor: 'LightBlue', fontStyle: 'italic' });
  20.         if(macguffin.innerHTML.strip()=="Complete") macguffin.parentNode.setStyle({backgroundColor: 'Green' });
  21.   });
  22. }
  23. document.observe("dom:loaded", colorize);
  24.  
  25.  
  26. ---------------
  27.  
  28.  
  29. function colorize () {
  30.     $$('td').each(function(macguffin) {
  31.  
  32.       //  if(macguffin.innerText.strip()=="Pending Credit Card") {
  33.                 //      macguffin.parentNode.setStyle({backgroundColor: 'LightPink', color:'Black' });
  34.  
  35.                 //}
  36. var el2 = macguffin.innerHTML;
  37. var div = document.createElement('div');
  38. div.innerHTML = el2;
  39. if(div.firstElementChild !=null)
  40. if(div.firstElementChild.nodeName == 'SPAN'){
  41.         if(div.firstElementChild.readAttribute('ifpaytab')=='paytab_txn_id'){
  42.                 macguffin.parentNode.setStyle({backgroundColor: 'Lightgreen', color:'Black' });
  43.                
  44.         }
  45. }
  46.   });