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

The order grid page breaks and gives an error. #15

Open
bhavyamodi29 opened this issue Jan 22, 2024 · 6 comments
Open

The order grid page breaks and gives an error. #15

bhavyamodi29 opened this issue Jan 22, 2024 · 6 comments

Comments

@bhavyamodi29
Copy link

Preconditions

Magento Version : 2.4.6-p2
Module Version : 1.1.1

Description

When we order a product which has pipe symbol ( “ | ” ) in its SKU , then we try to visit the order grid page , it shows an error as shown in screenshot-1.

Screenshot-1

image

Steps To Reproduce

  1. Clone clean shop.
  2. Install “MarkShust_OrderGrid” module.
  3. Go to the Backend->Catalog->Products.
  4. Create any product with the pipe symbol ( “ | ” ) in its SKU ( e.g. SKU = Test | Product).
  5. Visit frontend , then order that product.
  6. 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 as shown in screenshot-2.

Screenshot-2

image

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 pipe symbol ( “ | ” ) as a delimiter in the explode function , which separates the SKU , Quantity , and Product Name , as shown in screenshot-3 . Consider using a different delimiter that is unlikely to appear in SKUs , such as a semicolon.

File Name

markshust/magento2-module-ordergrid/Model/ResourceModel/Order/Grid/Collection.php

Screenshot-3

image

@erfanimani
Copy link

I have come across this issue a few times as well, but never ended up investigating it.

The pipe comes from an SQL concat function, I don't think changing it to a semicolon is a good idea — someone somewhere will run into the same problem. Because the pipe is used purely internal, instead it could perhaps be changed to something like {ordergrid_separator}.

@markshust
Copy link
Owner

I think it makes sense for you to be able to define the delimiter from the admin. Will this work? I don't think there ever will be a single character which works for everyone.

@erfanimani
Copy link

erfanimani commented Apr 30, 2024

Hi @markshust, what do you think of my previous comment? From what I understand it doesn't need to be a single character (in which case there would be a string of characters that would work for everyone).

I don't think we should make the module more complex and get people to configure the module when it should be plug and play.

@kasperth
Copy link

@markshust I agree with @erfanimani on his approach. Keeping it it simple as possible.

@markshust
Copy link
Owner

Ah I don't know what I was thinking. I agree.

@kasperth
Copy link

@markshust When do you reckon looking into this? My colleague has en open PR with a possible solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants