Open malikt opened 2 years ago
Hi @malikt. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:
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.
Join Magento Community Engineering Slack and ask your questions in #github channel.
:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: 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.
:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
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']:'',
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: :point_down:
[ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).Details
If 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
branchDetails
- 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.
@magento give me 2.4-develop instance
Hi @engcom-Lima. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Lima, here is your Magento Instance: https://2a9984743397f28955e3503d1b3ef2b6.instances.magento-community.engineering Admin access: https://2a9984743397f28955e3503d1b3ef2b6.instances.magento-community.engineering/admin_d133 Login: 51e40713 Password: 8787efe6e7ad
:heavy_check_mark: Issue confirmed
Issue got reproduced in 2.4-develop branch.
Description: Product grid is not displayed in the admin panel.
Pre-requisite:
Steps to reproduce:
Expected result: Grid should be displayed. Actual result: In my case, grid is not visible and getting error in the admin panel. Screenshots:
Found new issue related to this issue : https://github.com/magento/magento2/issues/35789 Hence, confirming this issue.
Thanks
We can confirm this issue too.
This could happen when there is any product stored without required attribute "name" and either you can add name value or remove that bad created product.
Is there a way to find with a query the product without name?
@RiccardoRoscilli Here is the query to find out products without name
SELECT sku,entity_id FROM
catalog_product_entityWHERE
entity_idNOT IN (SELECT
entity_idFROM
catalog_product_entity_varcharWHERE
attribute_idIN (SELECT attribute_id FROM
eav_attributeWHERE
attribute_code='name'))
SELECT sku,entity_id FROM
catalog_product_entityWHERE
entity_idNOT IN (SELECT
entity_idFROM
catalog_product_entity_varcharWHERE
attribute_idIN (SELECT attribute_id FROM
eav_attributeWHERE
attribute_code='name'))
This worked great for me. Found 6 products and then ran an import on those products to add a name/Product Name and that sorted the issue.
Reconfirming issue on 2.4.4 - Not sure why it has been able to save product entities without a name (title) set (on the base store view) but it happened. This is fully breaking the admin grid functionality, even in production, due to attempted rendering of an aria label. (So high impact for a 'minor' feature).
Fix as per comment https://github.com/magento/magento2/issues/35783#issuecomment-1189348535 is solid. Not sure why this low hanging fruit with high impact is on the low prio backlog. Will slam in a PR in a minute
Hi, confirming this issue on 2.4.5
too, we have this issue very often on production too.
@RiccardoRoscilli다음은 이름이 없는 제품을 찾는 쿼리입니다.
SELECT sku,entity_id FROM
catalog_product_entityWHERE
entity_idNOT IN (SELECT
entity_idFROM
catalog_product_entity_varcharWHERE
attribute_idIN (SELECT attribute_id FROM
eav_attributeWHERE
attribute_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
I ran the query above, returns no products without a name but I can still reproduce this issue on v2.4.6
@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
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
@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
There is a PR up to solve this on the rendering layer, but I have no clue how to move forward from here.
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.
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,
];
}
}
}
`
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
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'))
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.
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.
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
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.
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:
I hope this is helpful enough for troubleshooting and narrow down where the issue comes from and how to fix it.
Regards, Milen Velinov
@MilenV looking at error log, seems to be error from amasty plugin, try to disable plugin amasty/pgrid and check.
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?
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!
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
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
@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.
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.
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
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 ))
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
- Login as admin. - OK
- Go to Store->attributes->product search code "name" and set Values Required to "NO"
- Create a product without name in 2.4.1 and then upgrade to 2.4.4 along with PHP.
- Now, create a Product without name after setting the 'Name' attribute as not mandatory.
Hello, run the query and delete all the products with no name. There's no way they can fix it
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
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
Thanks.
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-13014 is successfully created for this GitHub issue.
:white_check_mark: 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.
Preconditions and environment
Steps to reproduce
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