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

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

| improve this answer | |
  • Thanks Muhammad Hasham, very helpful – Magedev2301 Apr 24 '19 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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