在管理中更改订单网格上的行颜色的方法 [英] Approach on changing row color on orders grid in admin

查看:22
本文介绍了在管理中更改订单网格上的行颜色的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I need to change row color in magento orders grid based on order status. For start I don't want a complex solution with configurable interface. I just want to know where to start.

最好的方法是什么?

推荐答案

完整、有效的解决方案:

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

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

Make the file 666 and the folders (js/colors & js/colors/adminhtml) 777.

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

Edit it and after line 208 (before the line containing }.bind(this)) add:

colorize();

在文件末尾添加:

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

现在在 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>

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

The orders grid will now be in vibrant colours and you should be able to clearly see what orders need attention.

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

The colorize() function can be edited to suit your order states and preferred colour scheme.

这篇关于在管理中更改订单网格上的行颜色的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆