Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product grid is not getting displayed, getting undefined array key "name" in logs. #35783

Open
5 tasks
malikt opened this issue Jul 19, 2022 · 45 comments · May be fixed by #36782
Open
5 tasks

Product grid is not getting displayed, getting undefined array key "name" in logs. #35783

malikt opened this issue Jul 19, 2022 · 45 comments · May be fixed by #36782
Assignees
Labels
Area: Product Component: Attributes Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P3 May be fixed according to the position in the backlog. Progress: PR in progress Reported on 2.4.1 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@malikt
Copy link

malikt commented Jul 19, 2022

Preconditions and environment

  • Magento 2.4.4
  • Upgraded from M2.4.1
  • PHP 8.1

Steps to reproduce

  1. Login as admin.
  2. Go to Store->attributes->product search code "name" and set Values Required to "NO"
  3. Create a product without name in 2.4.1 and then upgrade to 2.4.4 along with PHP.
  4. Now, create a Product without name after setting the 'Name' attribute as not mandatory.

Expected result

The Product Grid should load fine as usual.

Actual result

The Product Grid throws an alert of something went wrong and freezes.

Additional information

The Log shows the below error:
main.CRITICAL: Exception: Warning: Undefined array key "name" in /vendor/magento/module-catalog/Ui/Component/Listing/Columns/ProductActions.php on line 61 in /vendor/magento/framework/App/ErrorHandler.php:61

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@m2-assistant
Copy link

m2-assistant bot commented Jul 19, 2022

Hi @malikt. Thank you for your report.
To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@malikt
Copy link
Author

malikt commented Jul 19, 2022

After debugging a little bit, I have fixed the Grid issue.
edit the file:
/vendor/magento/module-catalog/Ui/Component/Listing/Columns/ProductActions.php
and replaced the line 61 from:
'ariaLabel' => __('Edit ') . $item['name'],
to
'ariaLabel' => __('Edit ') . isset($item['name'])?$item['name']:'',

@engcom-Lima engcom-Lima self-assigned this Jul 20, 2022
@m2-assistant
Copy link

m2-assistant bot commented Jul 20, 2022

Hi @engcom-Lima. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Lima
Copy link
Contributor

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @engcom-Lima. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@engcom-Lima engcom-Lima changed the title Undefined array key "name" Undefined array key "name" in logs. Jul 21, 2022
@engcom-Lima engcom-Lima changed the title Undefined array key "name" in logs. Product grid is not getting displayedn & getting undefined array key "name" in logs. Jul 21, 2022
@engcom-Lima engcom-Lima changed the title Product grid is not getting displayedn & getting undefined array key "name" in logs. Product grid is not getting displayed, getting undefined array key "name" in logs. Jul 21, 2022
@engcom-Lima
Copy link
Contributor

engcom-Lima commented Jul 21, 2022

✔️ Issue confirmed

Issue got reproduced in 2.4-develop branch.

Description: Product grid is not displayed in the admin panel.

Pre-requisite:

  1. Install fresh M 2.4.1
  2. Upgrade to latest version.
  3. PHP 8.1

Steps to reproduce:

  1. Install 2.4.1.
  2. Login as admin.
  3. Go to Store->attributes->product search code "name" and set Values Required to "NO"
  4. Create a product without name in 2.4.1 and then upgrade to latest version of Magento along with PHP.
  5. Now, create a Product without name after setting the 'Name' attribute as not mandatory.

Expected result: Grid should be displayed.
Actual result: In my case, grid is not visible and getting error in the admin panel.
Screenshots:
Screenshot from 2022-07-21 12-47-06

Screenshot from 2022-07-21 12-42-11

Found new issue related to this issue : #35789
Hence, confirming this issue.

Thanks

@engcom-Lima engcom-Lima added Component: Ui Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: Product Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Jul 21, 2022
@engcom-Lima engcom-Lima removed the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Jul 21, 2022
@engcom-Lima engcom-Lima added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed and removed Issue: ready for confirmation labels Jul 21, 2022
@engcom-Lima engcom-Lima removed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Component: Ui Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: Product labels Jul 21, 2022
@rohit-prjpt
Copy link

Yes, that is patch in code, instead fix the value in database to fix it with current code,

Hi @rohit-prjpt, Go to ProductDataProvider.php file and edit the code on line 286. Here, you have to add check if array key "visibility" is set then execute the code.

@MilenV
Copy link

MilenV commented Nov 16, 2023

Hello @rohit-prjpt @MIANZAHOOR @hgati

We executed suggested query below in the database on Production, but unfortunately returned results were EMPTY.
SELECT sku,entity_id FROM catalog_product_entity WHERE entity_id NOT IN (SELECT entity_id FROM catalog_product_entity_int WHERE attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE attribute_code='visibility'))
Do you have any other suggestions you might be able to provide us with?

Can you please give us an idea what we should do with below line of code 286?

Go to ProductDataProvider.php file and edit the code on line 286.
Here, you have to add check if array key "visibility" is set then execute the code.

Regards,
Milen Velinov

@rohit-prjpt
Copy link

Hello @rohit-prjpt @MIANZAHOOR @hgati

We executed suggested query below in the database on Production, but unfortunately returned results were EMPTY. SELECT sku,entity_id FROM catalog_product_entity WHERE entity_id NOT IN (SELECT entity_id FROM catalog_product_entity_int WHERE attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE attribute_code='visibility')) Do you have any other suggestions you might be able to provide us with?

Can you please give us an idea what we should do with below line of code 286?

Go to ProductDataProvider.php file and edit the code on line 286.
Here, you have to add check if array key "visibility" is set then execute the code.

Regards, Milen Velinov

@MilenV In that case more detailed debug required, can't guess what is going on without debugging.

@MilenV
Copy link

MilenV commented Nov 16, 2023

Hello @rohit-prjpt

I am providing you with the whole error we caught.

Exception: Warning: Undefined array key "visibility" in /app/vka64lyl5tm4m/vendor/amasty/pgrid/Plugin/Catalog/Ui/DataProvider/Product/ProductDataProvider.php on line 286 in /app/vka64lyl5tm4m/vendor/magento/framework/App/ErrorHandler.php:62 Stack trace: #0 /app/vka64lyl5tm4m/vendor/amasty/pgrid/Plugin/Catalog/Ui/DataProvider/Product/ProductDataProvider.php(286): Magento\Framework\App\ErrorHandler->handler() #1 /app/vka64lyl5tm4m/vendor/amasty/pgrid/Plugin/Catalog/Ui/DataProvider/Product/ProductDataProvider.php(427): Amasty\Pgrid\Plugin\Catalog\Ui\DataProvider\Product\ProductDataProvider->_initExtra() #2 /app/vka64lyl5tm4m/vendor/amasty/pgrid/Plugin/Catalog/Ui/DataProvider/Product/ProductDataProvider.php(389): Amasty\Pgrid\Plugin\Catalog\Ui\DataProvider\Product\ProductDataProvider->processExtraColumn() #3 /app/vka64lyl5tm4m/vendor/magento/framework/Interception/Interceptor.php(146): Amasty\Pgrid\Plugin\Catalog\Ui\DataProvider\Product\ProductDataProvider->afterGetData() #4 /app/vka64lyl5tm4m/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Catalog\Ui\DataProvider\Product\ProductDataProvider\Interceptor->Magento\Framework\Interception\{closure}() #5 /app/vka64lyl5tm4m/generated/code/Magento/Catalog/Ui/DataProvider/Product/ProductDataProvider/Interceptor.php(23): Magento\Catalog\Ui\DataProvider\Product\ProductDataProvider\Interceptor->___callPlugins() #6 /app/vka64lyl5tm4m/vendor/magento/module-ui/Component/Listing.php(38): Magento\Catalog\Ui\DataProvider\Product\ProductDataProvider\Interceptor->getData() #7 /app/vka64lyl5tm4m/vendor/magento/framework/View/Element/UiComponent/Context.php(250): Magento\Ui\Component\Listing->getDataSourceData() #8 /app/vka64lyl5tm4m/vendor/magento/framework/View/Layout/Generic.php(75): Magento\Framework\View\Element\UiComponent\Context->getDataSourceData() #9 /app/vka64lyl5tm4m/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Layout\Generic->build() #10 /app/vka64lyl5tm4m/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Layout\Generic\Interceptor->___callParent() #11 /app/vka64lyl5tm4m/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Layout\Generic\Interceptor->Magento\Framework\Interception\{closure}() #12 /app/vka64lyl5tm4m/generated/code/Magento/Framework/View/Layout/Generic/Interceptor.php(23): Magento\Framework\View\Layout\Generic\Interceptor->___callPlugins() #13 /app/vka64lyl5tm4m/vendor/magento/framework/View/Layout/Generator/Structure.php(46): Magento\Framework\View\Layout\Generic\Interceptor->build() #14 /app/vka64lyl5tm4m/vendor/magento/module-ui/TemplateEngine/Xhtml/Result.php(102): Magento\Framework\View\Layout\Generator\Structure->generate() #15 /app/vka64lyl5tm4m/vendor/magento/module-ui/TemplateEngine/Xhtml/Result.php(124): Magento\Ui\TemplateEngine\Xhtml\Result->appendLayoutConfiguration() #16 /app/vka64lyl5tm4m/vendor/magento/module-ui/Controller/Adminhtml/Index/Render.php(91): Magento\Ui\TemplateEngine\Xhtml\Result->__toString() #17 /app/vka64lyl5tm4m/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Ui\Controller\Adminhtml\Index\Render->execute() #18 /app/vka64lyl5tm4m/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Ui\Controller\Adminhtml\Index\Render\Interceptor->___callParent() #19 /app/vka64lyl5tm4m/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Ui\Controller\Adminhtml\Index\Render\Interceptor->Magento\Framework\Interception\{closure}() #20 /app/vka64lyl5tm4m/generated/code/Magento/Ui/Controller/Adminhtml/Index/Render/Interceptor.php(23): Magento\Ui\Controller\Adminhtml\Index\Render\Interceptor->___callPlugins() #21 /app/vka64lyl5tm4m/vendor/magento/framework/App/Action/Action.php(111): Magento\Ui\Controller\Adminhtml\Index\Render\Interceptor->execute() #22 /app/vka64lyl5tm4m/vendor/magento/module-backend/App/AbstractAction.php(151): Magento\Framework\App\Action\Action->dispatch() #23 /app/vka64lyl5tm4m/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Backend\App\AbstractAction->dispatch() #24 /app/vka64lyl5tm4m/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Ui\Controller\Adminhtml\Index\Render\Interceptor->___callParent() #25 /app/vka64lyl5tm4m/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(145): Magento\Ui\Controller\Adminhtml\Index\Render\Interceptor->Magento\Framework\Interception\{closure}() #26 /app/vka64lyl5tm4m/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch() #27 /app/vka64lyl5tm4m/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Ui\Controller\Adminhtml\Index\Render\Interceptor->Magento\Framework\Interception\{closure}() #28 /app/vka64lyl5tm4m/generated/code/Magento/Ui/Controller/Adminhtml/Index/Render/Interceptor.php(32): Magento\Ui\Controller\Adminhtml\Index\Render\Interceptor->___callPlugins() #29 /app/vka64lyl5tm4m/vendor/magento/framework/App/FrontController.php(245): Magento\Ui\Controller\Adminhtml\Index\Render\Interceptor->dispatch() #30 /app/vka64lyl5tm4m/vendor/magento/framework/App/FrontController.php(212): Magento\Framework\App\FrontController->getActionResponse() #31 /app/vka64lyl5tm4m/vendor/magento/framework/App/FrontController.php(147): Magento\Framework\App\FrontController->processRequest() #32 /app/vka64lyl5tm4m/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch() #33 /app/vka64lyl5tm4m/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent() #34 /app/vka64lyl5tm4m/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() #35 /app/vka64lyl5tm4m/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor->___callPlugins() #36 /app/vka64lyl5tm4m/vendor/magento/framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch() #37 /app/vka64lyl5tm4m/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http->launch() #38 /app/vka64lyl5tm4m/pub/index.php(30): Magento\Framework\App\Bootstrap->run() #39 {main}

I hope this is helpful enough for troubleshooting and narrow down where the issue comes from and how to fix it.

Regards,
Milen Velinov

@rohit-prjpt
Copy link

@MilenV looking at error log, seems to be error from amasty plugin, try to disable plugin amasty/pgrid and check.

@MIANZAHOOR
Copy link

Hello @MilenV
It's a bug of amasty plugin so you have to edit the code in the file ProductDataProvider.php.
Can you share code from 280 line to 295 line?

@rohit-prjpt
Copy link

Hello @MilenV It's a bug of amasty plugin so you have to edit the code in the file ProductDataProvider.php. Can you share code from 280 line to 295 line?

@MilenV
Please find the below line
if ((int)$row['visibility'] !== Visibility::VISIBILITY_NOT_VISIBLE) {

And change it to the following:
if (isset($row['visibility']) && (int)$row['visibility'] !== Visibility::VISIBILITY_NOT_VISIBLE) {

Let me know if that works or not!

@MilenV
Copy link

MilenV commented Nov 16, 2023

Hello @rohit-prjpt

Below is the part of the code between lines 274 and 298:

274 protected function _initExtra(array &$row, string $column): void
275 {
276 if (isset($row['store_id']) && $row['store_id'] !== 0) {
277 $store = $this->storeManager->getStore($row['store_id']);
278 } else {
279 $store = $this->storeManager->getWebsite($row['website_ids'][0] ?? null)->getDefaultStore();
280 }
281
282 switch ($column) {
283 case 'amasty_link':
284 $row[$column] = '';
285
286 if ((int)$row['visibility'] !== Visibility::VISIBILITY_NOT_VISIBLE) {
287 if (!empty($row['request_path'])) {
288 $row[$column] = $store->getUrl('', ['_direct' => $row['request_path']]);
289 } else {
290 $row[$column] = $store->getUrl(
291 null,
292 ['_direct' => 'catalog/product/view/id/' . $row['entity_id']]
293 );
294 }
295 break;
296 }
297 }
298 }

Regards,
Milen Velinov

@rohit-prjpt
Copy link

Hello @MilenV It's a bug of amasty plugin so you have to edit the code in the file ProductDataProvider.php. Can you share code from 280 line to 295 line?

@MilenV Please find the below line if ((int)$row['visibility'] !== Visibility::VISIBILITY_NOT_VISIBLE) {

And change it to the following: if (isset($row['visibility']) && (int)$row['visibility'] !== Visibility::VISIBILITY_NOT_VISIBLE) {

Let me know if that works or not!

change your line 286 as per my reply above

@MIANZAHOOR
Copy link

@MilenV

You have to add an additional check in which it will check the "visibility" index is set(available) or not because in you condition it doesn't found "visibility" index for $row array.
so you can do it by replacing 286 line by following line of code.

if (isset($row['visibility']) && (int)$row['visibility'] !== Visibility::VISIBILITY_NOT_VISIBLE) {

@rohit-prjpt you are right.

@mattb-ascend
Copy link

This error has also occurred for us when using the native product import - the default amount of errors is set to 10 for some reason, so you can import products with no name.

I can reproduce using the import AND including the name field. If I specify store_view_code for a newly added product, it seems that the "default" view is what the admin grid uses.

@rohit-prjpt
Copy link

This error has also occurred for us when using the native product import - the default amount of errors is set to 10 for some reason, so you can import products with no name.

I can reproduce using the import AND including the name field. If I specify store_view_code for a newly added product, it seems that the "default" view is what the admin grid uses.

When you import with store_view_code then it must set all values under defined store_view only but when you load the grid page by default it must have ADMIN Default Values but if you have store view filters in place then it must take values from specific store view,

For this specific issue, you only need to query to fix NULL value in your database, nothing else

@vakokakokit
Copy link

For Enterprise version .
Query to get product with no name.

SELECT sku, entity_id FROM catalog_product_entity WHERE row_id NOT IN ( SELECT row_id FROM catalog_product_entity_varchar WHERE attribute_id IN ( SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'name' AND entity_type_id = 4 ))

@motomaxinc
Copy link

Hi, I am new to magento and I got the same issue. I have made a website on cloudways auto installation so I am unable to find these steps. But I did find it through another directory and set product searchable vale for name to NO but the issue is still not fixed. Can someone help? Thank you.

Steps to reproduce

  1. Login as admin. - OK
  2. Go to Store->attributes->product search code "name" and set Values Required to "NO"
  3. Create a product without name in 2.4.1 and then upgrade to 2.4.4 along with PHP.
  4. Now, create a Product without name after setting the 'Name' attribute as not mandatory.

@RiccardoRoscilli
Copy link

Hello,
run the query and delete all the products with no name. There's no way they can fix it

@motomaxinc
Copy link

Thank you. I did not know how to run a query so I edited the product name in csv file, re-imported the file and it fixed the issue.

Hello, run the query and delete all the products with no name. There's no way they can fix it

@vandijkstef vandijkstef removed their assignment Mar 13, 2024
pmathbliss added a commit to pmathbliss/magento2 that referenced this issue Apr 18, 2024
magento#35783

This change was suggested to handle the name not being set on a product. A bad import could happen or the name could not be in the selected data or the name turned off from being required. Without this the catalog grid becomes unusable and left in a state that admin user cannot recover from.

Please make this change ASAP. Thanks.
@engcom-Hotel engcom-Hotel moved this to Pull Request In Progress in Low Priority Backlog Aug 19, 2024
@engcom-Delta
Copy link
Contributor

Hi @malikt ,

Thanks for your reporting and collaboration.
We have verified the issue in latest 2.4-develop instance and the issue is reproducible.
Kindly refer the screenshots.

Steps to reproduce

  1. Login as admin.
  2. Go to Store->attributes->product search code "name" and set Values Required to "NO"
    image
  3. Import product with no name.
  4. Access Catalog>Products
  5. Observe Error displays when product is imported with no name
    image

Thanks.

@engcom-Delta engcom-Delta added Component: Attributes Reported on 2.4.1 Indicates original Magento version for the Issue report. Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed and removed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Component: Ui Reported on 2.4.4 Indicates original Magento version for the Issue report. labels Sep 17, 2024
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-13014 is successfully created for this GitHub issue.

Copy link

m2-assistant bot commented Sep 17, 2024

✅ Confirmed by @engcom-Delta. Thank you for verifying the issue.
Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@Kishorchhugani
Copy link

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

From
'ariaLabel' => __('Edit ') . $item['name'],
To
'ariaLabel' => __('Edit ') . @$item['name'],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Product Component: Attributes Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P3 May be fixed according to the position in the backlog. Progress: PR in progress Reported on 2.4.1 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
Status: Pull Request In Progress
Development

Successfully merging a pull request may close this issue.