gpt4 book ai didi

magento - 在管理员中更改订单网格上的行颜色的方法

转载 作者:行者123 更新时间:2023-12-01 08:38:48 26 4
gpt4 key购买 nike

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

最好的方法是什么?

最佳答案

完整、有效的解决方案:

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

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

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

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 中创建或编辑 admin 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>

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

colorize() 函数可以根据您的订单状态和首选配色方案进行编辑。

关于magento - 在管理员中更改订单网格上的行颜色的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6569386/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com