Whenever we order multiple products and then attempt to visit the order grid page, an error occurs, as shown in screenshot-1.
Screenshot-1
Steps To Reproduce
Clone clean shop.
Install “MarkShust_OrderGrid” module.
Go to the database and perform the following query to check the maximum value of the 'GROUP_CONCAT' function.
(SHOW VARIABLES LIKE 'group_concat_max_len';)
If the output is not '1024 bytes' then perform the following query to set the maximum value of 'GROUP_CONCAT' function to
'1024 bytes'. (SET GLOBAL group_concat_max_len = 1024;)
Go to the Backend->Catalog->Products.
Create multiple products with the long names , and make sure that total length of the combined product names goes above the maximum value of 'GROUP_CONCAT' function , which is '1024 bytes'.
(E.g. Create one simple product which allows you to make the product name upto 255 letters , also make sure that the SKU name doesn't get above 64 letters , as it allows upto 64 letters . Now create other 4 products same as this , which has product names upto 255 letters and SKU names upto 64 letters. So that will be total 5 products.
So the calculation will be {255*5 = 1275} , which is greater than 1024.)
Visit frontend , then order those multiple products together.
Go to the Backend->Sales->Orders.
Expected Result
When we try to visit the order grid page , it should display product’s details in the Order Items column on the order grid page.
Actual Result
When we try to visit the order grid page , it shows an error as shown in screenshot-1.
Additional Information
The issue arises due to the use of the 'GROUP_CONCAT' function in the module , as shown in screenshot-2 . As the 'GROUP_CONCAT' function comes with its default maximum value which is '1024 bytes' . Even if we increase this limit , there is no gurantee that this error will not occur in the future . Suppose the customer orders more products at once and combinedly product names goes above the maximum value of 'GROUP_CONCAT' function . So changing the limit can't be the solution for this error. So I have removed 'GROUP_CONCAT' function and also made some changes in the following file , as you can see in this pull request. After applying this changes , the error got solved and now whenever you visit the order grid page , it will show all the product’s details in the Order Items column on the order grid page as shown in screenshot-3.
Preconditions
Magento Version : 2.4.6-p2 Module Version : 1.1.1
Related Issue
https://github.com/markshust/magento2-module-ordergrid/issues/15
Description
Whenever we order multiple products and then attempt to visit the order grid page, an error occurs, as shown in screenshot-1.
Screenshot-1
Steps To Reproduce
Expected Result
When we try to visit the order grid page , it should display product’s details in the Order Items column on the order grid page.
Actual Result
When we try to visit the order grid page , it shows an error as shown in screenshot-1.
Additional Information
The issue arises due to the use of the 'GROUP_CONCAT' function in the module , as shown in screenshot-2 . As the 'GROUP_CONCAT' function comes with its default maximum value which is '1024 bytes' . Even if we increase this limit , there is no gurantee that this error will not occur in the future . Suppose the customer orders more products at once and combinedly product names goes above the maximum value of 'GROUP_CONCAT' function . So changing the limit can't be the solution for this error. So I have removed 'GROUP_CONCAT' function and also made some changes in the following file , as you can see in this pull request. After applying this changes , the error got solved and now whenever you visit the order grid page , it will show all the product’s details in the Order Items column on the order grid page as shown in screenshot-3.
File Name
markshust/magento2-module-ordergrid/Model/ResourceModel/Order/Grid/Collection.php
Screenshot-2
Screenshot-3