0

Warning: Undefined array key "name" in D:\xampp\htdocs\mage2rock\vendor\magento\module-catalog\Ui\Component\Listing\Columns\ProductActions.php on line 61

Exception in D:\xampp\htdocs\mage2rock\vendor\magento\framework\App\ErrorHandler.php:62

I am getting this error when products assign to the categories, Those products are not displaying in products page

3 Answers 3

1

You have a product that does not have a name, you can update the name via the database or you can follow the below steps.

Open your vendor file:

vendor\magento\module-catalog\Ui\Component\Listing\Columns\ProductActions.php

And Update the below code:

/**
 * Prepare Data Source
 *
 * @param array $dataSource
 * @return array
 */
public function prepareDataSource(array $dataSource)
{
    if (isset($dataSource['data']['items'])) {
        $storeId = $this->context->getFilterParam('store_id');

        foreach ($dataSource['data']['items'] as &$item) {
            if (isset($item['name'])) {
                $item[$this->getData('name')]['edit'] = [
                    'href' => $this->urlBuilder->getUrl(
                        'catalog/product/edit',
                        ['id' => $item['entity_id'], 'store' => $storeId]
                    ),
                    'ariaLabel' => __('Edit ') . $item['name'],
                    'label' => __('Edit'),
                    'hidden' => false,
                ];
            }
        }
    }

    return $dataSource;
}

Here I only add isset() condition in the exiting code. After you are able to see the grid remove or update the product name. Once the issue is fixed please revert the changes to the above file.

Please Run Below Commands

php bin/magento cache:clean;
0

Please Run Below Commands

php bin/magento setup:upgrade;
Php bin/magento s:s:d -f;
php bin/magento cache:flush;
0

You can try run indexer command

php bin/magento indexer:reindex
php bin/magento cache:flush

or check the product from admin panel, open product edit page from admin and make sure visibility is not set on Not Visible Individually if you're adding simple product

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.