2

I have custom admin grid, I want to add product edit link on it.

I have a column that is showing product id, I want to use edit link instead of id. code for that column is this:

$this->addColumn(
    'product_id',
    [
        'header' => __('Edit Product'),
        'index' => 'product_id',
    ]
);

1 Answer 1

1

Add this action column in your grid file. It will add the product edit option in grid.

$this->addColumn('action', array(
                        'header' => __('Action'),
                        'width' => '100',
                        'type' => 'action',
                        'getter' => 'getProductId',
                        'actions' => array(
                            array(
                                'caption' => __('View'),
                                'url' => array('base' => 'catalog/product/edit'),
                                'target'=>'_blank',
                                'field' => 'product_id'
                            )
                        ),
                        'filter' => false,
                        'sortable' => false,
                        'index' => 'id',
                        'is_system' => true,
                    ));

I hope this will help

1
  • Thanks Muhammad Hasham, very helpful Commented Apr 24, 2019 at 10:08

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.