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

Moving a category breaks GraphQL filter by URL path #39183

Open
1 of 5 tasks
xpoback opened this issue Sep 18, 2024 · 2 comments
Open
1 of 5 tasks

Moving a category breaks GraphQL filter by URL path #39183

xpoback opened this issue Sep 18, 2024 · 2 comments
Assignees
Labels
Issue: ready for confirmation Reported on 2.4.7-p1 Indicates original Magento version for the Issue report.

Comments

@xpoback
Copy link
Contributor

xpoback commented Sep 18, 2024

Preconditions and environment

  • Magento 2.4.7-p1
  • Multistore setup

Steps to reproduce

  1. Create a category tree as follows:
    Parent 1 (url_path: parent-1) -> Child 1 (url_path: parent-1/child-1)
    Parent 2 (url_path: parent-2)

  2. Send a GraphQL query (in my case with header store: store_code):

query products {
  products(
    filter: {
      category_url_path: {
        eq: "parent-1/child-1"
      }
    }
  ) {
    total_count
  }
}

Expected and actual result: success response.

  1. In admin area, move category Parent 1 into Parent 2:
    Parent 2 (url_path: parent-2) -> Parent 1 (url_path: parent-2/parent-1) -> Child 1 (url_path: parent-2/parent-1/child-1)

  2. Send a GraphQL query (in my case with header store: store_code):

query products {
  products(
    filter: {
      category_url_path: {
        eq: "parent-2/parent-1/child-1"
      }
    }
  ) {
    total_count
  }
}

Expected result

Expected result:
Moving a category correctly saves the saves all attributes so that everything keeps working, including GraphQL

Specifically here: a successful GraphQL response

Actual result

GraphQL error message "message": "No category with the provided category_url_path was found" for a category that

Additional information

The reason behind this problem is that the url_path attribute values are correctly generated for the store but not for the default scope.
The example for an affected category on the sample data in vanilla Magento after category "Men" was moved into "Gear":

[main]> select * from catalog_category_entity_varchar where value = 'gear/men/tops-men';
+----------+--------------+----------+-------------------+--------+
| value_id | attribute_id | store_id | value             | row_id |
+----------+--------------+----------+-------------------+--------+
|      330 |          120 |        1 | gear/men/tops-men |     12 |
+----------+--------------+----------+-------------------+--------+
1 row in set (0.000 sec)

As a result, there is a GraphQL error message. Adding a value for store 0 fixes the problem.

Here's an SQL query that shows which categories are affected after a move (has value for store ID 1 and no value for store ID 0):

SET @url_path_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code='url_path' AND entity_type_id=3);
SELECT ccev1.value
FROM catalog_category_entity AS cce
         LEFT JOIN catalog_category_entity_varchar AS ccev0
                   ON ccev0.row_id = cce.row_id AND ccev0.store_id = 0 AND ccev0.attribute_id = @url_path_id
         LEFT JOIN catalog_category_entity_varchar AS ccev1
                   ON ccev1.row_id = cce.row_id AND ccev1.store_id = 1 AND ccev1.attribute_id = @url_path_id
WHERE ccev0.value IS NULL
  AND ccev1.value IS NOT NULL;

Resaving the affected category (in admin area or programmatically) regenerates url_path and it starts working again.

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”.
Copy link

m2-assistant bot commented Sep 18, 2024

Hi @xpoback. Thank you for your report.
To speed up processing of this issue, 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:


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ 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.

Copy link

m2-assistant bot commented Sep 18, 2024

Hi @engcom-Bravo. 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).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas 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-Bravo engcom-Bravo added the Reported on 2.4.7-p1 Indicates original Magento version for the Issue report. label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: ready for confirmation Reported on 2.4.7-p1 Indicates original Magento version for the Issue report.
Projects
Status: Ready for Confirmation
Development

No branches or pull requests

2 participants