在admin中改变订单网格上的行颜色的方法

Ovi*_*diu 3 grid magento

我需要根据订单状态更改magento订单网格中的行颜色.首先,我不想要一个具有可配置接口的复杂解决方案.我只是想知道从哪里开始.

什么是最好的方法?

ʍǝɥ*_*ʇɐɯ 10

完整的工作解决方案:

复制js/mage/adminhtml/grid.jsjs/colors/adminhtml/grid.js

制作文件666和文件夹(js/colors&js/colors/adminhtml)777.

编辑它并在第208行(包含}.bind(this)之前)添加:

colorize();
Run Code Online (Sandbox Code Playgroud)

在文件末尾添加:

function colorize () {
    $$('td').each(function(macguffin) {
       if(macguffin.innerHTML.strip()=="Processing") macguffin.parentNode.setStyle({backgroundColor: 'Orange' });
        if(macguffin.innerHTML.strip()=="Pending") macguffin.parentNode.setStyle({backgroundColor: 'Gold', color:'Black' });
        if(macguffin.innerHTML.strip()=="Payment Review") macguffin.parentNode.setStyle({backgroundColor: 'LightPink' });
        if((macguffin.innerHTML.strip()=="On Hold")||(macguffin.innerHTML.strip()=="Payment Review")) macguffin.parentNode.setStyle({backgroundColor: 'HotPink' });
        if(macguffin.innerHTML.strip()=="Suspected Fraud") macguffin.parentNode.setStyle({backgroundColor: 'Red' });
        if((macguffin.innerHTML.strip()=="Closed")||(macguffin.innerHTML.strip()=="Canceled")||(macguffin.innerHTML.strip()=="Cancelled")) macguffin.parentNode.setStyle({backgroundColor: 'LightBlue', fontStyle: 'italic' });
        if(macguffin.innerHTML.strip()=="Complete") macguffin.parentNode.setStyle({backgroundColor: 'Green' });
  });
}
document.observe("dom:loaded", colorize);
Run Code Online (Sandbox Code Playgroud)

现在创建或编辑admin local.xml文件 app/design/adminhtml/default/default/layout/local.xml

编辑它包括:

<?xml version="1.0"?>
<layout version="0.1.0">
  <default>
    <reference name="head">
        <action method="removeItem"><type>js</type><name>mage/adminhtml/grid.js</name></action>
        <action method="addItem"><type>js</type><name>colors/adminhtml/grid.js</name></action> 
    </reference>
  </default>
</layout>
Run Code Online (Sandbox Code Playgroud)

订单网格现在将呈现鲜艳的颜色,您应该能够清楚地看到需要注意的订单.

colorize()可以编辑该功能以适合您的订单状态和首选配色方案.