Добавьте цвет в колонку-носитель, чтобы заказать стол в административном офисе Prestashop - PullRequest
0 голосов
/ 25 апреля 2020

Добавьте столбец носителей, и к таблице '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', это принесет мне тот же цвет статуса заказа, но я хочу определить другой тип цвета для носителей

1 Ответ

0 голосов
/ 25 апреля 2020

Добавить обратный вызов:

...
'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>';
}
...