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 · 41 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 · 41 comments · May be fixed by #36782
Assignees
Labels
Area: Product Component: Ui 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.4 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
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Confirmed in Issue Confirmation and Triage Board 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
@m2-community-project m2-community-project bot moved this from Confirmed to Ready for Confirmation in Issue Confirmation and Triage Board 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
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Confirmed in Issue Confirmation and Triage Board 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
@m2-community-project m2-community-project bot moved this from Confirmed to Ready for Confirmation in Issue Confirmation and Triage Board Jul 21, 2022
@jonathanribas
Copy link

Hi, confirming this issue on 2.4.5 too, we have this issue very often on production too.

@hgati
Copy link

hgati commented Jun 1, 2023

@RiccardoRoscilli다음은 이름이 없는 제품을 찾는 쿼리입니다.

SELECT sku,entity_id FROM catalog_product_entity WHEREentity_id NOT IN (SELECTentity_id FROMcatalog_product_entity_varchar WHEREattribute_id IN (SELECT attribute_id FROMeav_attribute WHEREattribute_code='name'))

I was using Magento 2.4.6 + PHP 8.2 on production environment and had a cron job running every midnight to scrape and automatically update product information. However, this morning when I checked the admin page, the product grid was not showing up. and fortunately, I found the cause.

The product with SKU value "K00001" was originally an existing product. However, seeing that a new SKU "K00001-1" was created, it seems that during the scraping of product information, there was a duplication of the URL key, causing Magento to mistakenly create an empty product.

Not only the "name" attribute, but other attributes used in the product were also empty. Therefore, I simply deleted the product using the "delete from ~" query, and the grid displayed correctly on the admin page.

It's been a few months, and it happened again, so I came back here after searching on Google.
In my case, this error occasionally occurs when I scrap the product, perform automatic translation, and upload the content.

SELECT entity_id, sku FROM catalog_product_entity A WHERE NOT EXISTS (
	SELECT 'x' 
	FROM catalog_product_entity_varchar B, eav_attribute C
	WHERE A.entity_id=B.entity_id AND B.attribute_id=C.attribute_id AND C.attribute_code='name'
) 
entity_id  sku     
---------  --------
    24436  K08187  
<?php
require '/var/www/magento/app/bootstrap.php';
$bootstrap = Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$objectManager->get('Magento\Framework\App\State')->setAreaCode(Magento\Framework\App\Area::AREA_ADMINHTML);
$objectManager->get('\Magento\Store\Model\StoreManagerInterface')->setCurrentStore(0);
$objectManager->get('Magento\Framework\Registry')->register('isSecureArea', true);

$productCollection = $objectManager->create(\Magento\Catalog\Model\ResourceModel\Product\Collection::class);
$productCollection->addAttributeToSelect('*')->addFieldToFilter('entity_id', ['eq' => 24436])
    ->addAttributeToSort('entity_id', 'ASC');
foreach($productCollection as $prod) {
    print_r($prod->getData());
}
Array
(
    [entity_id] => 24436
    [attribute_set_id] => 11
    [type_id] => simple
    [sku] => K08187
    [has_options] => 0
    [required_options] => 0
    [created_at] => 2023-08-09 22:11:09
    [updated_at] => 2023-08-09 22:11:09
    [meta_title] => Experience this oneElegance with 
    [meta_description] => Immerse this on
    [image] => /-/f/-fu-0.jpg
    [small_image] => /-/f/-fu-0.jpg
    [thumbnail] => /-/f/-fu-0.jpg
    [options_container] => container2
    [image_label] =>  #0
    [small_image_label] =>  #0
    [thumbnail_label] =>  #0
    [url_key] => fu
    [msrp_display_actual_price_type] => 0
    [sourcing_product_id] => 2970736
    [cost_price] => 0
    [news_from_date] => 2023-08-09 00:00:00
    [news_to_date] => 2023-08-23 00:00:00
    [status] => 0
    [visibility] => 4
    [quantity_and_stock_status] => 1
    [tax_class_id] => 0
    [pre_order] => 0
    [limited_edition] => 0
    [ox_featured] => 0
    [ox_gallery_video_index] => 2
    [ox_gallery_video_listing_hover] => 0
    [ox_gallery_video_stop_on_click] => 1
    [ox_gallery_video_autoplay] => 1
    [ox_gallery_video_loop] => 1
    [ox_gallery_video_controls] => 0
    [ox_custom] => 0
    [goods_type] => 8688
    [price] => 0.000000
    [weight] => 0.000000
    [language_edition] => 6101
    [store_id] => 0
)
/* Delete the record (catalog_product_entity T/B) with entity_id */
DELETE FROM catalog_product_entity WHERE entity_id=24436

@alitopaloglu
Copy link

I ran the query above, returns no products without a name but I can still reproduce this issue on v2.4.6

@rohit-prjpt
Copy link

@alitopaloglu You have the exact error with attribute name? if you have error with different key instead of name then you might have different require attributes missing values, make sure and query for the attribute which you see on the error

@alitopaloglu
Copy link

I'm pretty sure it's the name attribute because the error message says

Warning: Undefined array key "name" in vendor/magento/module-catalog/Ui/Component/Listing/Columns/ProductActions.php on line 61

@rohit-prjpt
Copy link

@alitopaloglu You might have caching issue or try to print the product object to debug on the same file
vendor/magento/module-catalog/Ui/Component/Listing/Columns/ProductActions.php on line 61
so you'll see which product is causing issues

@vandijkstef
Copy link

There is a PR up to solve this on the rendering layer, but I have no clue how to move forward from here.

@asim-blueprintprep
Copy link
Contributor

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.

@MIANZAHOOR
Copy link

MIANZAHOOR commented Nov 8, 2023

This error occurs when you have imported any product without a name.
You have to remove the error by replacing the following code in the path file.

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

        `      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,
                            ];
                        } else {
                            $item[$this->getData('name')]['edit'] = [
                                'href' => $this->urlBuilder->getUrl(
                                    'catalog/product/edit',
                                    ['id' => $item['entity_id'], 'store' => $storeId]
                                ),
                                'label' => __('Edit'),
                                'hidden' => false,
                            ];
                        }
                    }
                }

`

@MilenV
Copy link

MilenV commented Nov 15, 2023

Hello @MIANZAHOOR, @hgati @malikt and Team,

We observe similar issue on Production where we are on Adobe Commerce ver. 2.4.5-p2
Actual Exception being thrown refers to Undefined array key "visibility"
Exception: Warning: Undefined array key "visibility" in /app/vka64lyl5tm4m/vendor/amasty/pgrid/Plugin/Catalog/Ui/DataProvider/Product/ProductDataProvider.php on line 286

Please could you advise us how this can be troubleshooted and resolved potentially?

Regards,
Milen Velinov

@rohit-prjpt
Copy link

Hello @MIANZAHOOR, @hgati @malikt and Team,

We observe similar issue on Production where we are on Adobe Commerce ver. 2.4.5-p2 Actual Exception being thrown refers to Undefined array key "visibility" Exception: Warning: Undefined array key "visibility" in /app/vka64lyl5tm4m/vendor/amasty/pgrid/Plugin/Catalog/Ui/DataProvider/Product/ProductDataProvider.php on line 286

Please could you advise us how this can be troubleshooted and resolved potentially?

Regards, Milen Velinov

You must have NULL values stored for attribute "visibility", so use the following query to find out those products

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'))

@MIANZAHOOR
Copy link

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.

@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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Product Component: Ui 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.4 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
Low Priority Backlog
  
Pull Request In Progress
Development

Successfully merging a pull request may close this issue.