0

I extended this class: Magento\Catalog\Block\Adminhtml\Category\Tab\Produc to add another column qty. This is how I added the column:

protected function _prepareColumns()
{
    parent::_prepareColumns();

    $this->addColumnAfter('qty', [
        'header' => __('Qty'),
        'index' => 'qty',
        'header_css_class' => 'col-visibility',
        'column_css_class' => 'col-visibility'
    ], 'sku');
    $this->sortColumnsByOrder();
    return $this;
}

it works and it displays it like this:

enter image description here

But I would like to add a FROM-TO instead, like I have for the price or position columns: enter image description here

How can I achieve this ? Thanks!

1 Answer 1

0

I just needed to add this :

'type' => 'number',

so the full code should look like:

$this->addColumnAfter('qty', [
    'header' => __('Qty'),
    'index' => 'qty',
    'type' => 'number',
    'header_css_class' => 'col-visibility',
    'column_css_class' => 'col-visibility'
], 'sku');
1
  • 1
    please consider marking your own answer as valid solution so that others can see it too :)
    – Diana
    Commented Aug 2, 2021 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.