[添加运营商列,并在表'ps_carrier_lang'中添加一个名为'color'的列,如状态所示,我希望显示该颜色。
'carrierdelay' => array(
'title' => $this->l('Envio'),
'type' => 'text',
'align' => 'text-center',
'class' => 'fixed-width-xl',
'color' => 'color',
'filter_key' => 'carrier_lang!delay',
'filter_type' => 'text',
'order_key' => 'carrier_lang!delay'
),
如果输入'color'=>'color',它将为我带来与订单状态相同的颜色,但我想为承运人定义另一种颜色
添加回叫:
...
'carrierdelay' => array(
'title' => $this->l('Envio'),
'type' => 'text',
'align' => 'text-center',
'class' => 'fixed-width-xl',
'color' => 'color',
'filter_key' => 'carrier_lang!delay',
'filter_type' => 'text',
'order_key' => 'carrier_lang!delay'
'callback' => 'colorCarrier'
),
...
function colorCarrier($value, $object) {
if ($object['carrierdelay'] > 3) { // Do the compare that you need, and set desired colors
$backgroundColor = '#4169E1';
$color = 'white';
}
// Return span with color and string
return '<span class="label color_field" style="background-color:'.$backgroundColor.';color:'.$white.'">'.$this->l("Delayed").'</span>';
}